| Index: gerrit_util.py
|
| diff --git a/gerrit_util.py b/gerrit_util.py
|
| index 7c44f03107468de934940bd1bf7646630818c53f..effd2a7ede32ad6c609cd457e517348df480fc65 100755
|
| --- a/gerrit_util.py
|
| +++ b/gerrit_util.py
|
| @@ -65,11 +65,19 @@ def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
|
| headers = headers or {}
|
| bare_host = host.partition(':')[0]
|
| auth = NETRC.authenticators(bare_host)
|
| + review_auth = NETRC.authenticators(bare_host.replace('-review', ''))
|
| +
|
| if auth:
|
| headers.setdefault('Authorization', 'Basic %s' % (
|
| base64.b64encode('%s:%s' % (auth[0], auth[2]))))
|
| + url = '/a/%s' % path
|
| + elif review_auth:
|
| + headers.setdefault('Authorization', 'Basic %s' % (
|
| + base64.b64encode('%s:%s' % (review_auth[0], review_auth[2]))))
|
| + url = '/a/%s' % path
|
| else:
|
| LOGGER.debug('No authorization found')
|
| + url = '/%s' % path
|
| if body:
|
| body = json.JSONEncoder().encode(body)
|
| headers.setdefault('Content-Type', 'application/json')
|
| @@ -84,7 +92,7 @@ def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
|
| conn = GetConnectionClass()(host)
|
| conn.req_host = host
|
| conn.req_params = {
|
| - 'url': '/a/%s' % path,
|
| + 'url': url,
|
| 'method': reqtype,
|
| 'headers': headers,
|
| 'body': body,
|
|
|