Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4947606

Browse files
committed
Fix for Issue1648102, based on the MSDN spec: If this parameter specifies the
"<local>" macro as the only entry, this function bypasses any host name that does not contain a period.
1 parent 55708cc commit 4947606

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

Lib/urllib/request.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,18 +2244,11 @@ def proxy_bypass_registry(host):
22442244
# '<local>' string by the localhost entry and the corresponding
22452245
# canonical entry.
22462246
proxyOverride = proxyOverride.split(';')
2247-
i = 0
2248-
while i < len(proxyOverride):
2249-
if proxyOverride[i] == '<local>':
2250-
proxyOverride[i:i+1] = ['localhost',
2251-
'127.0.0.1',
2252-
socket.gethostname(),
2253-
socket.gethostbyname(
2254-
socket.gethostname())]
2255-
i += 1
2256-
# print proxyOverride
22572247
# now check if we match one of the registry values.
22582248
for test in proxyOverride:
2249+
if test == '<local>':
2250+
if '.' not in rawHost:
2251+
return 1
22592252
test = test.replace(".", r"\.") # mask dots
22602253
test = test.replace("*", r".*") # change glob sequence
22612254
test = test.replace("?", r".") # change glob char

0 commit comments

Comments
 (0)