bash curl获取请求原始标头

时间:2011-04-15 15:41:22

标签: bash curl get request

您好我正在尝试使用CURL

发出以下GET请求
GET http://localhost:80/ HTTP/1.1

Host: localhost

Proxy-Connection: keep-alive

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16

Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Encoding: gzip,deflate,sdch

Accept-Language: en-GB,en-US;q=0.8,en;q=0.6

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

所以我试试curl -h "Host:localhost" localhost 但它不起作用,任何想法我在哪里出错?

1 个答案:

答案 0 :(得分:1)

-H而非-h

curl -H "Host:localhost" localhost