From: Ovidiu Negrut Date: Mon, 11 Mar 2013 08:28:37 +0000 (+0200) Subject: Digest auth: case insensitive replacement of 'digest ' string with '' from WWW-Authen... X-Git-Tag: v1.2.1~13^2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e752455b6f1b5913305a9014f3c0b535ba054069;p=services%2Fpython-requests.git Digest auth: case insensitive replacement of 'digest ' string with '' from WWW-Authenticate --- diff --git a/requests/auth.py b/requests/auth.py index 805f240..16546f2 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -8,6 +8,7 @@ This module contains the authentication handlers for Requests. """ import os +import re import time import hashlib import logging @@ -151,7 +152,7 @@ class HTTPDigestAuth(AuthBase): if 'digest' in s_auth.lower() and num_401_calls < 2: setattr(self, 'num_401_calls', num_401_calls + 1) - self.chal = parse_dict_header(s_auth.replace('Digest ', '')) + self.chal = parse_dict_header(re.sub(r'digest ', '', s_auth, flags=re.IGNORECASE)) # Consume content and release the original connection # to allow our new request to reuse the same one.