This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Problem with urllib and proxies / Win32
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mhammond Nosy List: lemburg, mhammond
Priority: normal Keywords:

Created on 2001-06-12 18:48 by lemburg, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (5)
msg5024 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2001-06-12 18:48
There's a problem with urllib on Windows. Here's a
quote which relates to the problem:

"""
In the newest version of the urllib.   They added a
section which pulls the http web_proxy from the
windows NT registry.         Unfortunately they did not
think to check for 127.0.0.1 and remove it from
the proxy list and they also did not handle (no proxy
addresses).  As a result the new library reads the
proxy settings from the Windows NT Registry for IE and
attempts to use them.
"""

Any thoughts on how to solve this ?
msg5025 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2001-06-13 06:17
Logged In: YES 
user_id=14198

This is not a problem with the win32 proxy detection code, 
but with urllib in general.

urllib itself does not handle the concept of "proxy exclude 
list", and nor does it handle the localhost case - if a 
proxy is configured, it uses it.

So either you are after an enhancement to urllib to allow 
certain addresses to bypass the proxy, or a technique to 
allow the registry to be ignored.  I believe the latter can 
be handled by setting "ignored_proxy=something" in the 
environment.

Can you clarify exactly what you want here?  If it is the 
urllib enhancement then I am not the best person for this - 
I don't have a proxy server available, and don't have much 
code that uses urllib.
msg5026 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2001-06-13 07:28
Logged In: YES 
user_id=38388

Well the point is that if you have IE configured to use a
proxy then urllib will automagically use it for all
requests. This is obviously not ideal for certain requests
like one to the localhost.

Looking at the code I cannot find any way to switch off
proxies by using environment variables (ok, you can specify
"http_proxy=",
but that will only result in an error that the proxy is not
found).

So in the end, I think this is a bug in the sense that you
cannot turn proxy handling off and a feature request in the
sense that it should be possible to turn it off ;-)

IMHO, the localhost and 127.0.0.1 should always be excluded
from the proxy handling.
msg5027 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2001-06-13 07:38
Logged In: YES 
user_id=14198

Looking at the code, I suspect "blah_proxy" will disable 
the registry.  This will setup the scheme "blah://" to use 
a proxy, and avoid the registry code completely.  
As "blah://" is invalid, http etc requests should work fine.

While I agree in general with the fact that localhost 
should never be proxied, that makes this bug no longer 
Window specific, and not related to the IE code at all.  
Hence I am probably not the best person to have this 
assigned to - if you want it fixed that is :)
msg5028 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2002-03-28 01:59
Logged In: YES 
user_id=14198

This patch appears to have been addressed in checkin 1.129
of urllib.py.  Checkin message, by tim_one, is:

SF patch #403640: incomplete proxy handling in URLLIB
Look specific to Windows.  Don't know whether it works.
History
Date User Action Args
2022-04-10 16:04:07adminsetgithub: 34618
2001-06-12 18:48:47lemburgcreate