kentical / gappproxy

Automatically exported from code.google.com/p/gappproxy
GNU General Public License v3.0
0 stars 0 forks source link

proxy.py can't run on windows xp #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
发现proxy.py在windows上似乎无法正常工作.

我试了三台机器,都是XP+ActivePython2.5,其中有两台不能正常工作
,提示大量相同的
错误:bad status 
line,找了一下原因,似乎是urllib2.urlopen和SocketServer的多线
程模型发生了冲突,不知道如何解决.

在Linux下面工作倒很正常,开始都是在Linux下跑得,所以直到昨��
�晚上才发现Windows
上的问题,但也有一台Windows机器工作正常,郁闷.

Original issue reported on code.google.com by dug...@188.com on 13 Jun 2008 at 3:33

GoogleCodeExporter commented 8 years ago
刚才找到原因了,难以想象的urllib实现:

The urlopen() function works transparently with proxies which do not require
authentication. In a Unix or Windows
environment, set the http_proxy, ftp_proxy or gopher_proxy environment 
variables to a
URL that identifies the proxy server
before starting the Python interpreter. For example (the "%" is the command 
prompt):

% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python
...

In a Windows environment, if no proxy environment variables are set, proxy 
settings
are obtained from the registry's
Internet Settings section.

简单说,windows下urllib默认会把IE设定的proxy作为自己的proxy,而��
�写的proxy程序中恰恰用
urllib做传输

这样,proxy肯定死循环了.

用urlopen得不到数据是因为它去找代理了,而设置的代理没有运
行,且在本地,怪不得我抓包根本
抓不到向外发的包...

Original comment by dug...@188.com on 16 Jun 2008 at 4:10