Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24a72ca

Browse files
committed
Fixed #27251: merged fix from 3.5.
2 parents ea938ba + 1bf197e commit 24a72ca

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/logging/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,8 @@ def emit(self, record):
11651165
h.putheader("Content-length", str(len(data)))
11661166
if self.credentials:
11671167
import base64
1168-
s = ('u%s:%s' % self.credentials).encode('utf-8')
1169-
s = 'Basic ' + base64.b64encode(s).strip()
1168+
s = ('%s:%s' % self.credentials).encode('utf-8')
1169+
s = 'Basic ' + base64.b64encode(s).strip().decode('ascii')
11701170
h.putheader('Authorization', s)
11711171
h.endheaders()
11721172
if self.method == "POST":

Lib/test/test_logging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,8 @@ def test_output(self):
16721672
secure_client = secure and sslctx
16731673
self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
16741674
secure=secure_client,
1675-
context=context)
1675+
context=context,
1676+
credentials=('foo', 'bar'))
16761677
self.log_data = None
16771678
root_logger.addHandler(self.h_hdlr)
16781679

0 commit comments

Comments
 (0)