curl usage to get header

后端 未结 3 1084
无人共我
无人共我 2021-01-30 20:12

Why does this not work:

curl -X HEAD http://www.google.com

But these both work just fine:

curl -I http://www.google.com

curl -         


        
3条回答
  •  生来不讨喜
    2021-01-30 21:00

    google.com is not responding to HTTP HEAD requests, which is why you are seeing a hang for the first command.

    It does respond to GET requests, which is why the third command works.

    As for the second, curl just prints the headers from a standard request.

提交回复
热议问题