mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fixed #27251: merged fix from 3.5.
This commit is contained in:
commit
24a72ca239
2 changed files with 4 additions and 3 deletions
|
@ -1165,8 +1165,8 @@ class HTTPHandler(logging.Handler):
|
||||||
h.putheader("Content-length", str(len(data)))
|
h.putheader("Content-length", str(len(data)))
|
||||||
if self.credentials:
|
if self.credentials:
|
||||||
import base64
|
import base64
|
||||||
s = ('u%s:%s' % self.credentials).encode('utf-8')
|
s = ('%s:%s' % self.credentials).encode('utf-8')
|
||||||
s = 'Basic ' + base64.b64encode(s).strip()
|
s = 'Basic ' + base64.b64encode(s).strip().decode('ascii')
|
||||||
h.putheader('Authorization', s)
|
h.putheader('Authorization', s)
|
||||||
h.endheaders()
|
h.endheaders()
|
||||||
if self.method == "POST":
|
if self.method == "POST":
|
||||||
|
|
|
@ -1672,7 +1672,8 @@ class HTTPHandlerTest(BaseTest):
|
||||||
secure_client = secure and sslctx
|
secure_client = secure and sslctx
|
||||||
self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
|
self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
|
||||||
secure=secure_client,
|
secure=secure_client,
|
||||||
context=context)
|
context=context,
|
||||||
|
credentials=('foo', 'bar'))
|
||||||
self.log_data = None
|
self.log_data = None
|
||||||
root_logger.addHandler(self.h_hdlr)
|
root_logger.addHandler(self.h_hdlr)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue