考虑以下超链接:
<a href="http://www.cs.rutgers.edu/∼shklar/">
浏览器会提交什么HTTP / 1.0请求? 浏览器会提交什么HTTP / 1.1请求?
如果配置浏览器,这些请求是否会更改 联系HTTP代理?如果是,怎么样?
答案 0 :(得分:4)
虽然您可以使用tcpdump
转储实际网络流量,但curl
从命令行测试HTTP会话肯定更方便。
HTTP / 1.0请求:
curl -v -0 http://www.cs.rutgers.edu/∼shklar/
* About to connect() to www.cs.rutgers.edu port 80 (#0)
* Trying 128.6.4.24...
* connected
* Connected to www.cs.rutgers.edu (128.6.4.24) port 80 (#0)
> GET /∼shklar/ HTTP/1.0
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.cs.rutgers.edu
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Wed, 31 Oct 2012 17:57:31 GMT
< Server: Apache/1.3.26 (Unix)
< Content-Type: text/html; charset=iso-8859-1
< Connection: close
HTTP / 1.1请求:
curl -v http://www.cs.rutgers.edu/∼shklar/
* About to connect() to www.cs.rutgers.edu port 80 (#0)
* Trying 128.6.4.24...
* connected
* Connected to www.cs.rutgers.edu (128.6.4.24) port 80 (#0)
> GET /∼shklar/ HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.cs.rutgers.edu
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Wed, 31 Oct 2012 17:59:47 GMT
< Server: Apache/1.3.26 (Unix)
< Content-Type: text/html; charset=iso-8859-1
< Transfer-Encoding: chunked
使用-x (or --proxy) <[protocol://][user@password]proxyhost[:port]>
开关使用代理并查看结果。
有关curl的更多信息,请访问:http://curl.haxx.se/docs/manpage.html