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]])
Comment #1
Posted on Sep 5, 2008 by Massive HippoChanges applied, some verification will be needed to see if this fixes the reported problem.
Status: Fixed
Labels:
Type-Defect
Priority-Medium