mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Fix Issue #13642: Unquote before b64encoding user:password during Basic Authentication.
This commit is contained in:
parent
9bbcb254db
commit
c5c5a14577
3 changed files with 36 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue