Bugs item #1368312, was opened at 2005-11-28 10:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1368312&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Ben Boals (bboals)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix for scheme identification in urllib2?

Initial Comment:
I was looking at the following piece of code in urllib2

    def http_error_auth_reqed(self, auth_header, host,
req, headers):
        authreq = headers.get(auth_header, None)
        if self.retried > 5:
            # Don't fail endlessly - if we failed once,
we'll probably
            # fail a second time. Hm. Unless the
Password Manager is
            # prompting for the information. Crap. This
isn't great
            # but it's better than the current 'repeat
until recursion
            # depth exceeded' approach <wink>
            raise HTTPError(req.get_full_url(), 401,
"digest auth failed",
                            headers, None)
        else:
            self.retried += 1
        if authreq:
            scheme = authreq.split()[0]
            if scheme.lower() == 'digest':
                return self.retry_http_digest_auth(req,
authreq)
            else:
                raise
ValueError("AbstractDigestAuthHandler doesn't know "
                                 "about %s"%(scheme))

The particular thing that concerns me is scheme =     
       scheme = authreq.split()[0]
            if scheme.lower() == 'digest':
Quite frequently, when there are multiple auth schemes
allowed, digest is NOT the first one in the list.

I would suggest substituting

schemes = authreq.lower().split(',')##a list of schemes
allowed, all lowercase
    if('digest' in schemes):


and if needed, fixing the call to
retry_http_digest_auth so that the authreq passed is
valid  (assuming for some reason it assumes the digest
is first)


            



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1368312&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to