tornado的aschttpclient,底層依賴pycurl,使用py2exe的時候,pycurl.pyd會致使程序閃退,解決方式,使用打過補丁的pycurl.pyd。html
代理客戶端的實現原理是什麼?抓個包,其實很簡單:socket鏈接代理ip,header頭部中給定真實目標url便可,包體沒有變化。web
這是直接telnet代理服務器,url填百度的包,代理服務器會去取Host,再重新構造http請求,將請求返回給當前沒close的套接字。bash
GET / HTTP/1.1 Host: www.baidu.com Connection: close Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36 Referer: http://www.cnblogs.com/ Accept-Encoding: gzip, deflate, sdch Accept-Language: zh-CN,zh;q=0.8