Apple's Calendar Server uses HTTP digest auth, but doesn't set qop in the
WWW-Authenticate
header, and specifies algorithm=md5 in lowercase. This prevents httplib2 0.4.0
from
authenticating successfully.
This patch to httplib2/__init__.py fixes the problem:
Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
challenge = _parse_www_authenticate(response, 'www-authenticate')
self.challenge = challenge['digest']
- qop = self.challenge.get('qop')
+ qop = self.challenge.get('qop', 'auth')
self.challenge['qop'] = ('auth' in [x.strip() for x in qop.split()]) and 'auth' or None
if self.challenge['qop'] is None:
raise UnimplementedDigestAuthOptionError( _("Unsupported value for qop: %s." % qop))
- self.challenge['algorithm'] = self.challenge.get('algorithm', 'MD5')
+ self.challenge['algorithm'] = self.challenge.get('algorithm',
'MD5').upper()
if self.challenge['algorithm'] != 'MD5':
raise UnimplementedDigestAuthOptionError( _("Unsupported value for algorithm: %s." %
self.challenge['algorithm']))
self.A1 = "".join([self.credentials[0], ":", self.challenge['realm'], ":", self.credentials[1]])
Original issue reported on code.google.com by salma...@gmail.com on 23 Mar 2008 at 7:39
Original issue reported on code.google.com by
salma...@gmail.com
on 23 Mar 2008 at 7:39