Commit 8737e775 authored by Ronald Oussoren's avatar Ronald Oussoren

Merged revisions 75482 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75482 | ronald.oussoren | 2009-10-18 09:07:00 +0200 (Sun, 18 Oct 2009) | 3 lines

  Fix for issue 7149: a regression in 2.6.3 that causes an exception when
  trying to detect proxy settings on OSX.
........
parent 4b6ce157
...@@ -1344,6 +1344,8 @@ if sys.platform == 'darwin': ...@@ -1344,6 +1344,8 @@ if sys.platform == 'darwin':
import socket import socket
from fnmatch import fnmatch from fnmatch import fnmatch
hostonly, port = splitport(host)
def ip2num(ipAddr): def ip2num(ipAddr):
parts = ipAddr.split('.') parts = ipAddr.split('.')
parts = map(int, parts) parts = map(int, parts)
...@@ -1358,6 +1360,8 @@ if sys.platform == 'darwin': ...@@ -1358,6 +1360,8 @@ if sys.platform == 'darwin':
if proxy_settings['exclude_simple']: if proxy_settings['exclude_simple']:
return True return True
hostIP = None
for value in proxy_settings.get('exceptions', ()): for value in proxy_settings.get('exceptions', ()):
# Items in the list are strings like these: *.local, 169.254/16 # Items in the list are strings like these: *.local, 169.254/16
if not value: continue if not value: continue
...@@ -1365,8 +1369,11 @@ if sys.platform == 'darwin': ...@@ -1365,8 +1369,11 @@ if sys.platform == 'darwin':
m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value) m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
if m is not None: if m is not None:
if hostIP is None: if hostIP is None:
hostIP = socket.gethostbyname(host) try:
hostIP = ip2num(hostIP) hostIP = socket.gethostbyname(hostonly)
hostIP = ip2num(hostIP)
except socket.error:
continue
base = ip2num(m.group(1)) base = ip2num(m.group(1))
mask = int(m.group(2)[1:]) mask = int(m.group(2)[1:])
......
...@@ -18,6 +18,8 @@ Core and Builtins ...@@ -18,6 +18,8 @@ Core and Builtins
Library Library
------- -------
- Issue #7149: fix exception in urllib when detecting proxy settings on OSX.
- Issue #7120: logging: Removed import of multiprocessing which is causing - Issue #7120: logging: Removed import of multiprocessing which is causing
crash in GAE. crash in GAE.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment