我曾经curl
以这种方式请求 www.google.com:
curl -v --url "http://www.google.com"
我发现结果HTTP/1.1 302 Moved Temporarily
是Location: http://www.google.com.eg/
。
虽然当我检查 HTTP 请求标头时,我找不到任何可以告诉我的信息,例如accept-lang
.
Here's the output of the above `curl` command:
* About to connect() to www.google.com port 80 (#0)
* Trying 173.194.40.49...
* connected
* Connected to www.google.com (173.194.40.49) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.27.0
> Host: www.google.com
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 302 Moved Temporarily
< Content-Length: 216
< Location: http://www.google.com.eg/
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
< Date: Fri, 29 Mar 2013 18:44:02 GMT
< Server: gws
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: PREF=ID=9d542bb0ba74e1b0:FF=0:TM=1364582642:LM=1364582642:S=QNWV6IaUY-Uw1oUy; expires=Sun, 29-Mar-2015 18:44:02 GMT; path=/; domain=.google.com
< Set-Cookie: NID=67=jOeZdv6A3qHXveaYvn-nG0OKh1cHmwVO8VvA8U-Xv0VBA5nbMtMFcD6d94OS67GJ7ky3hoULCj9qJ97o2HwvRYigj1qGyFBWGRdSRFmi9LLEVKN03IglQrN25BQxTDPx; expires=Sat, 28-Sep-2013 18:44:02 GMT; path=/; domain=.google.com; HttpOnly
< Connection: keep-alive
<
* Connection #0 to host www.google.com left intact
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"><TITLE>302 Moved</TITLE></HEAD><BODY><H1>302 Moved</H1>The document has moved <A HREF="http://www.google.com.eg/">here</A>. </BODY></HTML>* Closing connection #0