URLs to glance need to be absolute.

Otherwise the apache SSL frontend that many users deploy will get
confused and return a HTTP error.

Change-Id: Ie8ae560810a5e5419e4d4aacae17e1e301ed4126
This commit is contained in:
Michael Still 2012-08-02 10:32:58 +10:00
parent 5aec05ca81
commit ac50784397
2 changed files with 9 additions and 6 deletions

View File

@ -85,7 +85,7 @@ class ImageService(object):
if self.auth_token:
headers.setdefault('x-auth-token', self.auth_token)
logging.debug(_('Request: %(method)s http://%(server)s:%(port)s/'
logging.debug(_('Request: %(method)s http://%(server)s:%(port)s'
'%(url)s with headers %(headers)s')
% {'method': method,
'server': self.conn.host,
@ -122,7 +122,7 @@ class ImageService(object):
params = {'is_public': None}
while True:
url = 'v1/images/detail'
url = '/v1/images/detail'
query = urllib.urlencode(params)
if query:
url += '?%s' % query
@ -143,7 +143,7 @@ class ImageService(object):
Returns: a httplib Response object where the body is the image.
"""
url = 'v1/images/%s' % image_uuid
url = '/v1/images/%s' % image_uuid
return self._http_request('GET', url, {}, '')
@staticmethod
@ -171,7 +171,7 @@ class ImageService(object):
Returns: image metadata as a dictionary
"""
url = 'v1/images/%s' % image_uuid
url = '/v1/images/%s' % image_uuid
response = self._http_request('HEAD', url, {}, '',
ignore_result_body=True)
return self._header_list_to_dict(response.getheaders())
@ -203,7 +203,7 @@ class ImageService(object):
Returns: a tuple of (http response headers, http response body)
"""
url = 'v1/images'
url = '/v1/images'
headers = self._dict_to_headers(image_meta)
headers['Content-Type'] = 'application/octet-stream'
headers['Content-Length'] = int(image_meta['size'])
@ -223,7 +223,7 @@ class ImageService(object):
Returns: a tuple of (http response headers, http response body)
"""
url = 'v1/images/%s' % image_meta['id']
url = '/v1/images/%s' % image_meta['id']
headers = self._dict_to_headers(image_meta)
headers['Content-Type'] = 'application/octet-stream'

View File

@ -85,6 +85,9 @@ class FakeHTTPConnection(object):
def prime_request(self, method, url, in_body, in_headers,
out_body, out_headers):
if not url.startswith('/'):
url = '/' + url
hkeys = in_headers.keys()
hkeys.sort()
hashable = (method, url, in_body, ' '.join(hkeys))