Quantcast
Channel: 看得透又看得远者prevail.ppt.cc/flUmLx ppt.cc/fqtgqx ppt.cc/fZsXUx ppt.cc/fhWnZx ppt.cc/fnrkVx ppt.cc/f2CBVx
Viewing all articles
Browse latest Browse all 20475

http代理的两种模式

$
0
0
做代理,用squid来做,以前一直都是用来做反向代理,其实正向代理设置也基本一样。。。
代理有两种模式,一种直接就是http代理,另外一种就是CONNECT代理.
第一种方式:
发包的方式是改变http的GET头:
浏览器的请求包模式应该是
GET http://www.163.com/ HTTP/1.1
Accept: */*
Proxy-Connection: Keep-Alive
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MAXTHON 2.0)
Host: www.163.com
Pragma: no-cache
而第二种模式,是可以建立TCP连接的,当初是为了ssl而建立的。
发包的过程是:
先发送:
CONNECT www.163.com:80 HTTP/1.1
然后代理服务器收到这个包之后,就会去和www.163.com 80建立连接
成功的话会返回:
HTTP/1.0 200 Connection established
然后客户端再发送正常的http请求:
GET / HTTP/1.1
Accept: */*
Proxy-Connection: Keep-Alive
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MAXTHON 2.0)
Host: www.163.com
Pragma: no-cache
就会拿到正常的结果了.

Viewing all articles
Browse latest Browse all 20475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>