Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b761e3ae
Commit
b761e3ae
authored
Sep 13, 2019
by
Zackery Spytz
Committed by
Stéphane Wirtel
Sep 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-25068: urllib.request.ProxyHandler now lowercases the dict keys (GH-13489)
parent
693aa80a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
15 deletions
+19
-15
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+16
-15
Lib/urllib/request.py
Lib/urllib/request.py
+1
-0
Misc/NEWS.d/next/Library/2019-05-22-04-52-35.bpo-25068.vR_rC-.rst
...S.d/next/Library/2019-05-22-04-52-35.bpo-25068.vR_rC-.rst
+2
-0
No files found.
Lib/test/test_urllib2.py
View file @
b761e3ae
...
...
@@ -1342,8 +1342,10 @@ class HandlerTests(unittest.TestCase):
self
.
assertTrue
(
request
.
startswith
(
expected
),
repr
(
request
))
def
test_proxy
(
self
):
u
=
"proxy.example.com:3128"
for
d
in
dict
(
http
=
u
),
dict
(
HTTP
=
u
):
o
=
OpenerDirector
()
ph
=
urllib
.
request
.
ProxyHandler
(
dict
(
http
=
"proxy.example.com:3128"
)
)
ph
=
urllib
.
request
.
ProxyHandler
(
d
)
o
.
add_handler
(
ph
)
meth_spec
=
[
[(
"http_open"
,
"return response"
)]
...
...
@@ -1353,8 +1355,7 @@ class HandlerTests(unittest.TestCase):
req
=
Request
(
"http://acme.example.com/"
)
self
.
assertEqual
(
req
.
host
,
"acme.example.com"
)
o
.
open
(
req
)
self
.
assertEqual
(
req
.
host
,
"proxy.example.com:3128"
)
self
.
assertEqual
(
req
.
host
,
u
)
self
.
assertEqual
([(
handlers
[
0
],
"http_open"
)],
[
tup
[
0
:
2
]
for
tup
in
o
.
calls
])
...
...
Lib/urllib/request.py
View file @
b761e3ae
...
...
@@ -792,6 +792,7 @@ class ProxyHandler(BaseHandler):
assert hasattr(proxies, 'keys'), "
proxies
must
be
a
mapping
"
self.proxies = proxies
for type, url in proxies.items():
type = type.lower()
setattr(self, '%s_open' % type,
lambda r, proxy=url, type=type, meth=self.proxy_open:
meth(r, proxy, type))
...
...
Misc/NEWS.d/next/Library/2019-05-22-04-52-35.bpo-25068.vR_rC-.rst
0 → 100644
View file @
b761e3ae
:class:`urllib.request.ProxyHandler` now lowercases the keys of the passed
dictionary.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment