summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-01-14 11:09:04 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-01-14 11:09:04 (GMT)
commitc5c5a14577f1188125630dcbf31c5c2cd258b541 (patch)
tree9a9c8efbaa2c774caa11d4c70d6483d6c8651bbf /Lib/urllib/request.py
parent9bbcb254dbeafcbfb09b3ca7a53bd69083ecabbb (diff)
downloadcpython-c5c5a14577f1188125630dcbf31c5c2cd258b541.zip
cpython-c5c5a14577f1188125630dcbf31c5c2cd258b541.tar.gz
cpython-c5c5a14577f1188125630dcbf31c5c2cd258b541.tar.bz2
Fix Issue #13642: Unquote before b64encoding user:password during Basic Authentication.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 77b7c7f..cf065715 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1661,13 +1661,13 @@ class URLopener:
if not host: raise IOError('http error', 'no host given')
if proxy_passwd:
- import base64
+ proxy_passwd = unquote(proxy_passwd)
proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii')
else:
proxy_auth = None
if user_passwd:
- import base64
+ user_passwd = unquote(user_passwd)
auth = base64.b64encode(user_passwd.encode()).decode('ascii')
else:
auth = None
@@ -1871,7 +1871,6 @@ class URLopener:
time.gmtime(time.time())))
msg.append('Content-type: %s' % type)
if encoding == 'base64':
- import base64
# XXX is this encoding/decoding ok?
data = base64.decodebytes(data.encode('ascii')).decode('latin1')
else: