Kaydet (Commit) e99bd17e authored tarafından Moshe Zadka's avatar Moshe Zadka

Fixing bug #227562 by calling URLopener.http_error_default when

an invalid 401 request is being handled.
üst be77cf7d
......@@ -560,13 +560,19 @@ class FancyURLopener(URLopener):
"""Error 401 -- authentication required.
See this URL for a description of the basic authentication scheme:
http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt"""
if headers.has_key('www-authenticate'):
if not headers.has_key('www-authenticate'):
URLopener.http_error_default(self, url, fp,
errmsg, headers)
stuff = headers['www-authenticate']
import re
match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff)
if match:
if not match:
URLopener.http_error_default(self, url, fp,
errcode, errmsg, headers)
scheme, realm = match.groups()
if scheme.lower() == 'basic':
if scheme.lower() != 'basic':
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment