[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails
Christopher Li <[EMAIL PROTECTED]> added the comment: Hi NL, Can you please try this patch on top of the original patch? Thanks Chris --- .pc/fix-up/urllib2.py 2008-02-06 01:13:10.0 -0800 +++ urllib2.py 2008-06-27 15:45:34.0 -0700 @@ -253,7 +253,7 @@ class Request: return self.__r_host def set_proxy(self, host, type): -if self.type == 'https' and not self._tunnel_host: +if self.get_type() == 'https' and not self._tunnel_host: self._tunnel_host = self.host else: self.type = type On Fri, Jun 27, 2008 at 3:22 PM, nfl <[EMAIL PROTECTED]> wrote: > > nfl <[EMAIL PROTECTED]> added the comment: > > Hi, > > looks like the attached patch only works if I use > urllib2.ProxyHandler({'https' : proxy}) at the start, but not when I use > request.set_proxy(proxy, 'https') per request. I tested with Python > 2.5.1 on Win32. > > -- > nosy: +nfl > > ___ > Python tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue1424152> > ___ > ___ 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
[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails
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..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
[issue3765] [patch] allow mmap take file offset as argument
New submission from Christopher Li <[EMAIL PROTECTED]>: The os.mmap function does not take file offset as requirement. As a result, if python want to mmap a piece of the file data at the very end of the file, it needs to mmap the every thing before that. Without offset argument, it is hard to work with large files. I make a patch to add the offset arguments to mmap function call a while back. I wish it get included in the future version of python. http://mail.python.org/pipermail/python-list/2005-May/324213.html Thanks -- components: Library (Lib) messages: 72416 nosy: chrisl severity: normal status: open title: [patch] allow mmap take file offset as argument type: feature request versions: Python 2.5 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3765> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails
Christopher Li <[EMAIL PROTECTED]> added the comment: Hi, I am working on a patch to implement the https proxy support for urllib2. It works fine for me, but feel free to change the patch. Can any one take a look please? Thanks -- nosy: +chrisl Added file: http://bugs.python.org/file9753/http-tunnel-urllib _ 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
[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails
Christopher Li <[EMAIL PROTECTED]> added the comment: In cast it is not obvious. I already attached the purpose patch "http-tunnel-urllib" in the bug. _ 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