[issue6894] urllib2 doesn't respect "no_proxy" environment (python2.6.2)

Raphaël Barrois report at bugs.python.org
Sat Sep 12 12:12:29 CEST 2009


New submission from Raphaël Barrois <xelnor_python at melix.net>:

I discovered recently that urllib2 doesn't respect the "no_proxy" 
environment variable on linux (and on other platforms too, I think).

Here is an example of the problem :
- Set http_proxy and no_proxy environment variables (for instance 
no_proxy="localhost")

proxy_handler = urllib2.ProxyHandler()
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)

and then open an "outside" url : everything is OK (urllib2 reads 
correctly http_proxy), but for "localhost", it tries to open it 
through the proxy.

You would expect urllib2 to understand no_proxy, all the more since 
all the needed code is already available in urllib.

I have prepared a patch for urllib2 which does correct that bug.

I don't have other versions of python installed, so I couldn't check 
that se bug is still present there.

----------
components: Library (Lib)
files: python2.6.2-urllib2-no_proxy.patch
keywords: patch
messages: 92538
nosy: xelnor
severity: normal
status: open
title: urllib2 doesn't respect "no_proxy" environment  (python2.6.2)
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file14880/python2.6.2-urllib2-no_proxy.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6894>
_______________________________________


More information about the Python-bugs-list mailing list