gob: Fix double slash in GoB URLs

BUG=chromium:736427
TEST=None

Change-Id: Iee31fd33cb5c78cb3d25da04e9ad16d0cd897d2c
Reviewed-on: https://chromium-review.googlesource.com/547002
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
(cherry picked from commit 7580576717627b3e28e62da3ede6435abff6d086)
Reviewed-on: https://chromium-review.googlesource.com/552861
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/lib/gob_util.py b/lib/gob_util.py
index adac0b2..471d5f0 100644
--- a/lib/gob_util.py
+++ b/lib/gob_util.py
@@ -114,6 +114,7 @@
 
 def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
   """Opens an https connection to a gerrit service, and sends a request."""
+  path = '/a/' + path.lstrip('/')
   headers = headers or {}
   bare_host = host.partition(':')[0]
   auth = NETRC.authenticators(bare_host)
@@ -124,7 +125,7 @@
     logging.debug('No netrc file found')
 
   if 'Cookie' not in headers:
-    cookies = GetCookies(host, '/a/%s' % path)
+    cookies = GetCookies(host, path)
     headers['Cookie'] = '; '.join('%s=%s' % (n, v) for n, v in cookies.items())
 
   if 'User-Agent' not in headers:
@@ -138,7 +139,7 @@
     body = json.JSONEncoder().encode(body)
     headers.setdefault('Content-Type', 'application/json')
   if logging.getLogger().isEnabledFor(logging.DEBUG):
-    logging.debug('%s https://%s/a/%s', reqtype, host, path)
+    logging.debug('%s https://%s%s', reqtype, host, path)
     for key, val in headers.iteritems():
       if key.lower() in ('authorization', 'cookie'):
         val = 'HIDDEN'
@@ -148,7 +149,7 @@
   conn = httplib.HTTPSConnection(host)
   conn.req_host = host
   conn.req_params = {
-      'url': '/a/%s' % path,
+      'url': path,
       'method': reqtype,
       'headers': headers,
       'body': body,