Title: urllib2 doesn't respect "no_proxy" environment (python2.6.2)
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: Arfrever, orsenthil, xelnor
Priority: normal Keywords: patch

Created on 2009-09-12 10:12 by xelnor, last changed 2009-10-11 06:08 by orsenthil. This issue is now closed.

File name Uploaded Description Edit
python2.6.2-urllib2-no_proxy.patch xelnor, 2009-09-12 10:12 Patch for urllib2, enabling support for the "no_proxy" environment var
Messages (4)
msg92538 - (view) Author: Raphaël Barrois (xelnor) Date: 2009-09-12 10:12
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 

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

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.
msg93848 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-11 02:02
Fixed in trunk and Committed revision 75333.
msg93849 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-11 05:58
merged into py3k revision 75334
merged into release-26maint revision 75335.
msg93850 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-11 06:08
merged in release31-maint in revision 75336

Closing the issue.
Date User Action Args
2009-10-11 06:08:53orsenthilsetstatus: open -> closed

messages: + msg93850
versions: + Python 3.1, Python 2.7, Python 3.2
2009-10-11 05:58:53orsenthilsetmessages: + msg93849
2009-10-11 02:02:56orsenthilsetresolution: fixed
messages: + msg93848
2009-10-07 15:55:12orsenthilsetassignee: orsenthil
2009-10-07 14:39:33Arfreversetnosy: + orsenthil, Arfrever
2009-09-12 10:12:27xelnorcreate