fixed HTTP Basic auth
This commit is contained in:
parent
4f3376aede
commit
4351887efd
1 changed files with 2 additions and 3 deletions
|
@ -17,9 +17,8 @@ class factotumbasic(urllib2.BaseHandler):
|
||||||
chal = urllib2.parse_keqv_list(urllib2.parse_http_list(authreq[1]))
|
chal = urllib2.parse_keqv_list(urllib2.parse_http_list(authreq[1]))
|
||||||
realm = chal['realm']
|
realm = chal['realm']
|
||||||
self.f.start(proto="pass", host=host, realm=realm, role="client")
|
self.f.start(proto="pass", host=host, realm=realm, role="client")
|
||||||
pw = self.f.read()
|
pw = self.f.read().replace(' ', ':', 1)
|
||||||
user = self.f.attr()["user"]
|
val = 'Basic %s' % base64.b64encode(pw).strip()
|
||||||
val = 'Basic %s' % base64.b64encode(user + ':' + pw).strip()
|
|
||||||
if req.headers.get('Authorization', None) == val: return None
|
if req.headers.get('Authorization', None) == val: return None
|
||||||
req.add_header('Authorization', val)
|
req.add_header('Authorization', val)
|
||||||
return self.parent.open(req)
|
return self.parent.open(req)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue