加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

http头之---Pragma

(2012-10-19 14:10:32)
标签:

it

分类: nginx

HTTP/1.0 caches协议没有实现Cache-Control(在http1.1实现),  实现了 Pragma: no-cache的功能。

请求头中如果包含pragma头的时候,服务器端会将该请求转发给源服务器。

浏览器crtl-F5刷新的时候http请求中就会添加该头信息“Cache-Control no-cache”或者“Pragma no-cache”做回源请求。


redhat4.7中自带的curl默认会携带该头信息,导致向squid请求的时候,squid自动将请求回源了。

[@106.21 ~]# curl -V curl 7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6 Protocols: ftp gopher telnet dict ldap http file https ftps  Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz  [@106.21 ~]# cat /etc/issue Red Hat Enterprise Linux AS release 4 (Nahant Update 7) Kernel \r on an \m  [@106.21 ~]# 

不管是http1.0访问,还是http1.1访问都会携带上:

[@106.21 ~]# curl --header host:db.auto.sohu.com  http://127.0.0.1:81/rank_para_2.shtml -v 1> /dev/null            * About to connect() to 127.0.0.1 port 81 *   Trying 127.0.0.1... * connected * Connected to 127.0.0.1 (127.0.0.1) port 81 > GET /rank_para_2.shtml HTTP/1.1 User-Agent: curl/7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6 Pragma: no-cache Accept: ** host:db.auto.sohu.com  < HTTP/1.0 200 OK < Date: Thu, 27 Oct 2011 04:04:25 GMT < Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8e-fips-rhel5 < Accept-Ranges: bytes < Cache-Control: max-age=1800 < Expires: Thu, 27 Oct 2011 04:34:25 GMT < Vary: Accept-Encoding < Content-Length: 26981 < Content-Type: text/html < X-Cache: MISS from 106.21 < Via: 1.1 106.21:81 (squid/2.7.STABLE9) < Connection: close   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100 26981  100 26981    0     0  8385k      0 --:--:-- --:--:-- --:--:-- 25.7M * Closing connection #0 [@106.21 ~]# 





另一个版本的curl就不带该头信息,如下:

[@zw_79_74 ~]# curl -V curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Protocols: tftp ftp telnet dict ldap http file https ftps  Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz  [@zw_79_74 ~]# cat /etc/issue Red Hat Enterprise Linux Server release 5.5 (Tikanga) Kernel \r on an \m  [@zw_79_74 ~]#  [@zw_79_74 ~]#  [@zw_79_74 ~]# curl  --header host:db.auto.sohu.com  http://192.168.106.21:81/rank_para_2.shtml -v 1> /dev/null              * About to connect() to 192.168.106.21 port 81 *   Trying 192.168.106.21... connected * Connected to 192.168.106.21 (192.168.106.21) port 81 > GET /rank_para_2.shtml HTTP/1.1 > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 > Accept: ** >  < HTTP/1.0 504 Gateway Time-out < Server: squid/2.7.STABLE9 < Date: Thu, 27 Oct 2011 04:05:18 GMT < Content-Type: text/html < Content-Length: 1276 < X-Squid-Error: ERR_CANNOT_FORWARD 11 < X-Cache: MISS from 106.21 < Via: 1.0 106.21:81 (squid/2.7.STABLE9) < Connection: close   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100  1276  100  1276    0     0   165k      0 --:--:-- --:--:-- --:--:--     0* Closing connection #0  [@zw_79_74 ~]# 

转载自:http://sxm-0929.blog.163.com/blog/static/41802557201192711589478/

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有