0001-add-support-for-Basic-HTTP-authentication-to-_http_r.patch
wcs/qommon/misc.py | ||
---|---|---|
241 | 241 |
else: |
242 | 242 |
hostname, query = urllib.splithost(url[6:]) |
243 | 243 | |
244 |
if '@' in hostname: |
|
245 |
authenticator, hostname = hostname.split('@') |
|
246 |
if ':' in authenticator: |
|
247 |
username, password = authenticator.split(':', 1) |
|
248 |
else: |
|
249 |
username = authenticator |
|
250 |
password = '' |
|
251 |
headers['Authorization'] = 'Basic %s' % base64.b64encode('%s:%s' % (username, password)) |
|
252 | ||
244 | 253 |
if url.startswith('http://'): |
245 | 254 |
if timeout is None: |
246 | 255 |
conn = httplib.HTTPConnection(hostname) |
247 |
- |