Christopher Li <[EMAIL PROTECTED]> added the comment: Hi,
After a closer look of your testing program. I believe that your testing program is not correct. It might be the urllib way of doing things. But that is not the urllib2 way of doing it. You should add a proxy_handler rather than directly set_proxy on request objects. The reason is that, you mess req directly. The urllib2 will not handle correctly if the request needs rebuild and forward to other handlers. One example is if the request needs redirect, I believe your test program will not work. So the right way of doing things, IMHO, is just adding a proxy handler which contain the proxy you want. Then that proxy handler will just automatically set_proxy() to every request it goes out. It even works if the request needs to be rebuilt. Then my patch should just work in that case. Try to make it work for your test script will make things unnecessary complicated. That defeats the benefit of the handler call chain in urllib2. Does it make sense to you? Thanks, Chris On Mon, Jun 30, 2008 at 1:49 AM, Nagy Ferenc László <[EMAIL PROTECTED]> wrote: > The test program was: > > import urllib2 > > targeturl = 'https://www.paypal.com/' > proxyhost = 'proxy.xxxxxxxx.hu:3128' > > req = urllib2.Request(targeturl) > req.set_proxy(proxyhost, 'https') > response = urllib2.urlopen(req) > print response.info() _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1424152> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com