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
80f1b059
Commit
80f1b059
authored
Jun 18, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue1368368 - prompt_user_passwd() in FancyURLopener masks 401 Unauthorized error page
parent
2cd12528
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
Lib/urllib/request.py
Lib/urllib/request.py
+10
-2
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/urllib/request.py
View file @
80f1b059
...
...
@@ -1866,7 +1866,8 @@ class FancyURLopener(URLopener):
else
:
return
self
.
http_error_default
(
url
,
fp
,
errcode
,
errmsg
,
headers
)
def
http_error_401
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
,
data
=
None
):
def
http_error_401
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
,
data
=
None
,
retry
=
False
):
"""Error 401 -- authentication required.
This function supports Basic authentication only."""
if
not
'www-authenticate'
in
headers
:
...
...
@@ -1882,13 +1883,17 @@ class FancyURLopener(URLopener):
if
scheme
.
lower
()
!=
'basic'
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
if
not
retry
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
name
=
'retry_'
+
self
.
type
+
'_basic_auth'
if
data
is
None
:
return
getattr
(
self
,
name
)(
url
,
realm
)
else
:
return
getattr
(
self
,
name
)(
url
,
realm
,
data
)
def
http_error_407
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
,
data
=
None
):
def
http_error_407
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
,
data
=
None
,
retry
=
False
):
"""Error 407 -- proxy authentication required.
This function supports Basic authentication only."""
if
not
'proxy-authenticate'
in
headers
:
...
...
@@ -1904,6 +1909,9 @@ class FancyURLopener(URLopener):
if
scheme
.
lower
()
!=
'basic'
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
if
not
retry
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
name
=
'retry_proxy_'
+
self
.
type
+
'_basic_auth'
if
data
is
None
:
return
getattr
(
self
,
name
)(
url
,
realm
)
...
...
Misc/NEWS
View file @
80f1b059
...
...
@@ -446,6 +446,10 @@ C-API
Library
-------
- Issue #1368368: FancyURLOpener class changed to throw an Exception on wrong
password instead of presenting an interactive prompt. Older behavior can be
obtained by passing retry=True to http_error_xxx methods of FancyURLOpener.
- Issue #8720: fix regression caused by fix for #4050 by making getsourcefile
smart enough to find source files in the linecache.
...
...
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