summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-06-18 15:12:48 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-06-18 15:12:48 (GMT)
commitb4d1c2c8619c08e37606b2593be4763e80f88dc7 (patch)
tree07dce593d991997498474a1cdd9e4421f5b95c5b /Lib/urllib/request.py
parent25bb0fdb67d03a47ee2193219fa0af2f191d4568 (diff)
downloadcpython-b4d1c2c8619c08e37606b2593be4763e80f88dc7.zip
cpython-b4d1c2c8619c08e37606b2593be4763e80f88dc7.tar.gz
cpython-b4d1c2c8619c08e37606b2593be4763e80f88dc7.tar.bz2
Merged revisions 82068 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82068 | senthil.kumaran | 2010-06-18 20:38:18 +0530 (Fri, 18 Jun 2010) | 3 lines Fix Issue1368368 - prompt_user_passwd() in FancyURLopener masks 401 Unauthorized error page ........
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 95e8e33..e85b65c 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1870,7 +1870,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:
@@ -1886,13 +1887,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:
@@ -1908,6 +1913,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)