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: Proxy exception lookup fails on MacOS in urllib.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: ronaldoussoren, yorik.sar
Priority: normal Keywords: patch

Created on 2010-06-03 07:31 by yorik.sar, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urllib.py.diff yorik.sar, 2010-06-03 07:31 patch
Messages (6)
msg106933 - (view) Author: Yuriy Taraday (yorik.sar) Date: 2010-06-03 07:31
I have straight IP in my proxy exception list like "192.168.0.2" without mask specification.

The proxy_bypass_macosx_sysconf function verifies each item in this list by regexp r"(\d+(?:\.\d+)*)(/\d+)?" that produces two groups: IP and mask. The mask can be None here (as in my case) and this None case isn't handled, so urllib crashes with "TypeError: 'NoneType' object is unsubscriptable".

I couldn't find specification of MacOS proxy exceptions list, so I don't know whether you can use just IP or prefix without mask specification. If you can, here is small patch that adds nesessary check and guesses mask if it is not specified. If you cannot, the last question mark should be removed from regex.
msg106951 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-03 13:50
Patchs looks file, although the 'None' branch might be a bit too fancy. I haven't found a spec either, and therefore your code is probably the safest way to deduce a mask.
msg106952 - (view) Author: Yuriy Taraday (yorik.sar) Date: 2010-06-03 14:16
The strange thing is that in both 2.7 and 3.1 branches there is no such code at all. Inernet Config is used there without mentioning any exceptions despite the fact that ic module is marked as deprecated and proxy bypass is real.
msg106953 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-03 14:24
2.7 and 3.x use the SystemConfiguration framework (through the _scproxy extension)
msg106954 - (view) Author: Yuriy Taraday (yorik.sar) Date: 2010-06-03 14:33
I'm completely lost 2.7 tree in svn.
My last post was about 3.1.2 release. As I understand, System Configuration framework is being used since 2.6.5 and 3.2.
So, this bug is about all this versions.
msg108790 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-27 14:28
Committed the patch with some minor modifications in r82284 (2.7), r82285 (2.6), r82286 (3.2), r82287 (3.1)
History
Date User Action Args
2022-04-11 14:57:01adminsetgithub: 53129
2010-12-07 08:59:49ned.deilylinkissue10643 superseder
2010-06-27 14:28:49ronaldoussorensetstatus: open -> closed
type: crash -> behavior
messages: + msg108790

resolution: fixed
stage: resolved
2010-06-03 14:33:45yorik.sarsetmessages: + msg106954
versions: + Python 2.7, Python 3.2
2010-06-03 14:24:53ronaldoussorensetmessages: + msg106953
2010-06-03 14:16:37yorik.sarsetmessages: + msg106952
2010-06-03 13:50:46ronaldoussorensetassignee: ronaldoussoren

messages: + msg106951
nosy: + ronaldoussoren
2010-06-03 07:31:48yorik.sarcreate