Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1bf197eb
Commit
1bf197eb
authored
Jun 07, 2016
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #27251: corrected string/bytes handling in credentials.
parent
8bff8f69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
Lib/logging/handlers.py
Lib/logging/handlers.py
+2
-2
Lib/test/test_logging.py
Lib/test/test_logging.py
+2
-1
No files found.
Lib/logging/handlers.py
View file @
1bf197eb
...
...
@@ -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"
:
...
...
Lib/test/test_logging.py
View file @
1bf197eb
...
...
@@ -1672,7 +1672,8 @@ class HTTPHandlerTest(BaseTest):
secure_client = secure and sslctx
self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
secure=secure_client,
context=context)
context=context,
credentials=('foo', 'bar'))
self.log_data = None
root_logger.addHandler(self.h_hdlr)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment