mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fixed #27251: corrected string/bytes handling in credentials.
This commit is contained in:
parent
8bff8f6953
commit
1bf197eb14
2 changed files with 4 additions and 3 deletions
|
@ -1156,8 +1156,8 @@ class HTTPHandler(logging.Handler):
|
|||
h.putheader("Content-length", str(len(data)))
|
||||
if self.credentials:
|
||||
import base64
|
||||
s = ('u%s:%s' % self.credentials).encode('utf-8')
|
||||
s = 'Basic ' + base64.b64encode(s).strip()
|
||||
s = ('%s:%s' % self.credentials).encode('utf-8')
|
||||
s = 'Basic ' + base64.b64encode(s).strip().decode('ascii')
|
||||
h.putheader('Authorization', s)
|
||||
h.endheaders()
|
||||
if self.method == "POST":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue