Projet

Général

Profil

0001-add-support-for-Basic-HTTP-authentication-to-_http_r.patch

Benjamin Dauvergne, 28 mars 2016 03:42

Télécharger (1,07 ko)

Voir les différences:

Subject: [PATCH 1/2] add support for Basic HTTP authentication to
 _http_request

 wcs/qommon/misc.py | 9 +++++++++
 1 file changed, 9 insertions(+)
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
-