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
de0eb249
Commit
de0eb249
authored
Aug 01, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue8123 - TypeError in urllib when trying to use HTTP authentication
parent
c881f159
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+11
-0
Lib/urllib/request.py
Lib/urllib/request.py
+2
-2
No files found.
Lib/test/test_urllib.py
View file @
de0eb249
...
...
@@ -190,6 +190,17 @@ Content-Type: text/html; charset=iso-8859-1
finally
:
self
.
unfakehttp
()
def
test_userpass_inurl
(
self
):
self
.
fakehttp
(
b"Hello!"
)
try
:
fp
=
urlopen
(
"http://user:pass@python.org/"
)
self
.
assertEqual
(
fp
.
readline
(),
b"Hello!"
)
self
.
assertEqual
(
fp
.
readline
(),
b""
)
self
.
assertEqual
(
fp
.
geturl
(),
'http://user:pass@python.org/'
)
self
.
assertEqual
(
fp
.
getcode
(),
200
)
finally
:
self
.
unfakehttp
()
class
urlretrieve_FileTests
(
unittest
.
TestCase
):
"""Test urllib.urlretrieve() on local files"""
...
...
Lib/urllib/request.py
View file @
de0eb249
...
...
@@ -1591,13 +1591,13 @@ class URLopener:
if
proxy_passwd
:
import
base64
proxy_auth
=
base64
.
b64encode
(
proxy_passwd
).
strip
()
proxy_auth
=
base64
.
b64encode
(
proxy_passwd
.
encode
()
).
strip
()
else
:
proxy_auth
=
None
if
user_passwd
:
import
base64
auth
=
base64
.
b64encode
(
user_passwd
).
strip
()
auth
=
base64
.
b64encode
(
user_passwd
.
encode
()
).
strip
()
else
:
auth
=
None
http_conn
=
connection_factory
(
host
)
...
...
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