时间: 2010-09-01 / 分类: WEB后端编程 - 开发与实践 / 浏览次数: / 0 个评论 发表评论
HTTP的Get/Connect代理的区别
CSS Hack浏览器兼容IE6+IE7+IE8+IE9+FF
黄金分割与摄影构图
项目前端开发的架构
WEB前端开发中的一些编程风格和书...

在HTTP协议中,通过代理和不通过代理所取得的header信息是有所差别的。

举例说明:

proxy server : 127.0.0.1 8080
access web site: www.example.com/index.php

1) 无代理:
/index.php HTTP/1.1
HOST:
www.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,**;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: xxxxxx
Cookie: xxxxxx
Cache-Control: max-age=0

2) HTTP GET 代理(HTTP1.0/HTTP1.1都支持) – socket首先与127.0.0.1:8080建立连接
GET http:/www.example.com/index.php HTTP/1.1
HOST:
www.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,**;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: xxxxxx
Cookie: xxxxxx
Cache-Control: max-age=0

3) HTTP (只有HTTP1.1支持) – socket首先与127.0.0.1:8080建立连接
CONNECT http:/www.example.com/index.php HTTP/1.1
HOST:
www.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: xxxxxx
Cookie: xxxxxx
Cache-Control: max-age=0

注:HTTP CONNECT是在HTTP1.1协议上才新增的命令,用于支撑https加密。
所以,许多支持http connect的http proxy,比如squid,默认都限制只允许访问外部的443端口,其它端口不提供代理服务。

      站点地图 | 关于我 | 返回顶部
    Copyright © 2001-2013 { amiku.cn | zhangshunjin.com }. Powered by 

    阿米酷

    张顺金


    浙ICP备11002820号-1