classification
Title: urllib.request system proxy configuration lookup broken for OS X in Python 3
Type: behavior Stage: resolved
Components: Library (Lib), macOS Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2009-10-16 22:46 by ned.deily, last changed 2010-04-18 20:50 by ronaldoussoren. This issue is now closed.

Messages (3)
msg94153 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2009-10-16 22:46
On OS X, urllib.request in Python 3 is supposed to use the operating 
system's proxy configuration by default, unless overridden by 
environment variables or by the caller providing an explicit proxy 
configuration.

In Python 2, urllib (and, indirectly, urllib2) were modified to use the 
OS X SystemConfiguration framework API instead of the obsolete classic 
MacOS Internet Configuration via the deprecated Macintosh ic library 
module, which was removed in Python 3.

However, in the transition from Python 2 urllib/urllib2 to Python 3 
urllib.request, the changes to the darwin-specific getproxies functions 
were not made.  So, at the moment, Python 3 urllib.request tries to 
import the non-existant ic module and silently fails, effectively 
ignoring the system proxy configuration.  The solution is to forward 
port the corresponding code from Python 2 urllib along with the helper 
module _scproxy.c.
msg96185 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-12-09 21:49
I agree that _scproxy should be ported to the 3.x trees. Such a port 
should be fairly straightforward, but is harder than just copying files 
over due to the str/unicode changes in the 3.x tree.
msg103527 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-18 20:50
I've committed a port of _scproxies and the related code in urllib in r80198 (3.2), r80199 (3.1)

BTW. With some luck this should already include a fix for the crash your seeing on OSX 10.3 with the trunk and 2.6.
History
Date User Action Args
2010-04-18 20:50:44ronaldoussorensettype: behavior
stage: resolved
2010-04-18 20:50:32ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg103527
2009-12-09 21:49:18ronaldoussorensetmessages: + msg96185
2009-10-16 22:46:46ned.deilycreate