##// END OF EJS Templates
Work around urllib2 digest auth bug with Python < 2.5...
Alexis S. L. Carvalho -
r4678:a814a5b1 default
parent child Browse files
Show More
@@ -121,6 +121,20 b' else:'
121 class httphandler(basehttphandler):
121 class httphandler(basehttphandler):
122 pass
122 pass
123
123
124 # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if
125 # it doesn't know about the auth type requested. This can happen if
126 # somebody is using BasicAuth and types a bad password.
127 class httpdigestauthhandler(urllib2.HTTPDigestAuthHandler):
128 def http_error_auth_reqed(self, auth_header, host, req, headers):
129 try:
130 return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed(
131 self, auth_header, host, req, headers)
132 except ValueError, inst:
133 arg = inst.args[0]
134 if arg.startswith("AbstractDigestAuthHandler doesn't know "):
135 return
136 raise
137
124 def zgenerator(f):
138 def zgenerator(f):
125 zd = zlib.decompressobj()
139 zd = zlib.decompressobj()
126 try:
140 try:
@@ -202,7 +216,7 b' class httprepository(remoterepository):'
202 passmgr.add_password(None, host, user, passwd or '')
216 passmgr.add_password(None, host, user, passwd or '')
203
217
204 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
218 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
205 urllib2.HTTPDigestAuthHandler(passmgr)))
219 httpdigestauthhandler(passmgr)))
206 opener = urllib2.build_opener(*handlers)
220 opener = urllib2.build_opener(*handlers)
207
221
208 # 1.0 here is the _protocol_ version
222 # 1.0 here is the _protocol_ version
General Comments 0
You need to be logged in to leave comments. Login now