[Python-bugs-list] [ python-Bugs-432501 ] Problem with urllib and proxies / Win32

noreply@sourceforge.net noreply@sourceforge.net
Wed, 27 Mar 2002 18:00:00 -0800


Bugs item #432501, was opened at 2001-06-13 04:48
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=432501&group_id=5470

Category: Windows
Group: Platform-specific
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: M.-A. Lemburg (lemburg)
Assigned to: Mark Hammond (mhammond)
Summary: Problem with urllib and proxies / Win32

Initial Comment:
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 ?


----------------------------------------------------------------------

>Comment By: Mark Hammond (mhammond)
Date: 2002-03-28 12:59

Message:
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.


----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2001-06-13 17:38

Message:
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 :)

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2001-06-13 17:28

Message:
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.

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2001-06-13 16:17

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=432501&group_id=5470