From b899b80ca9201b08fafc19ff72350b13e10f8af4 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Fri, 2 Aug 2013 21:07:59 -0700 Subject: [PATCH] Send auth header with GET requests too. Change-Id: I14d5e5655f5b3137a0ad0d121504993df7f0ed9f --- lib/python/camli/op.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/python/camli/op.py b/lib/python/camli/op.py index bd11856bc..74026b880 100755 --- a/lib/python/camli/op.py +++ b/lib/python/camli/op.py @@ -103,7 +103,7 @@ class CamliOp(object): self.basepath = "" if auth: if len(auth.split(':')) != 2: - # Default to dummy username; current server doesn't care + # Default to dummy username; current server doesn't care # TODO(jrabbit): care when necessary auth = "username:" + auth #If username not given use the implicit default, 'username' self._authorization = ('Basic ' + base64.encodestring(auth).strip()) @@ -258,7 +258,8 @@ class CamliOp(object): new_relative_url = urlparse.urlunparse(pieces) logging.debug('Redirect %s -> %s', relative_url, new_relative_url) relative_url = new_relative_url - self.connection.request('GET', relative_url) + self.connection.request('GET', relative_url, headers={ + 'Authorization': self._authorization}) response = self.connection.getresponse() if response.status != 200: @@ -353,7 +354,8 @@ class CamliOp(object): fullpath = self.basepath + '/camli/' else: fullpath = '/camli/' - self.connection.request('GET', fullpath + blobref) + self.connection.request('GET', fullpath + blobref, + headers={'Authorization': self._authorization}) response = self.connection.getresponse() if response.status == 404: logging.debug('Server does not have blobref=%s', blobref)