使用以下命令的输出,
% curl -v stackoverflow.com/questions
* About to connect() to stackoverflow.com port 80 (#0)
* Trying 198.252.206.16...
* Connected to stackoverflow.com (198.252.206.16) port 80 (#0)
> GET /questions HTTP/1.1
> User-Agent: curl/7.29.0
> Host: stackoverflow.com
> Accept: */*
我可以curl -X GET -H "User-Agent: curl/7.29.0" -H "Host: stackoverflow.com" -H "Accept: */*" 198.252.206.16
复制该请求,但如何GET /questions
在命令中指定?
答案1
stackoverflow.com/questions
= 获取/问题
stackoverflow.com/87whjjgaas.asd
= 获取/87whjjgaas.asd
23.123.123.123/questions
= 获取/问题
为了
curl -X GET -H“用户代理:curl/7.29.0”-H“主机:stackoverflow.com”-H“接受:/“198.252.206.16
答案是
curl -X GET -H“用户代理:curl/7.29.0”-H“主机:stackoverflow.com”-H“接受:/“198.252.206.16/问题
:)
答案2
我需要查看服务器在某些“错误”路径下的行为。要阻止 curl 规范化路径,可以使用以下选项--path-as-is
。
curl --path-as-is http://www.example.com/_cdn_assets_/./../font-awesome/4.3.0/css/font-awesome.css