summaryrefslogtreecommitdiff
path: root/glance_store/_drivers
diff options
context:
space:
mode:
authorPavlo Shchelokovskyy <shchelokovskyy@gmail.com>2021-02-23 14:16:37 +0000
committerCyril Roelandt <cyril@redhat.com>2022-08-04 17:33:15 +0000
commit951a9f535e18571d82f1dbe30e94740601f84ffe (patch)
treebf21baea78876457df6b8002bacdc67a6637d0b3 /glance_store/_drivers
parent6851cab51a3d5dbf018f755efee8e0e640ac12ab (diff)
downloadglance_store-951a9f535e18571d82f1dbe30e94740601f84ffe.tar.gz
Do not loose url queries on redirects
when fetching images with http driver, the redirect URL can have mandatory query in it, which must be kept intact to successfully fetch the image. Change-Id: I2a9d4d026b935ea6c5e5a3a46c86f70ce1e39ae7 Closes-Bug: #1633860
Diffstat (limited to 'glance_store/_drivers')
-rw-r--r--glance_store/_drivers/http.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/glance_store/_drivers/http.py b/glance_store/_drivers/http.py
index 79d3ab7..0d55e4b 100644
--- a/glance_store/_drivers/http.py
+++ b/glance_store/_drivers/http.py
@@ -105,18 +105,26 @@ class StoreLocation(glance_store.location.StoreLocation):
self.user = self.specs.get('user')
self.password = self.specs.get('password')
self.path = self.specs.get('path')
+ self.query = self.spec.get('query')
def _get_credstring(self):
if self.user:
return '%s:%s@' % (self.user, self.password)
return ''
+ def _get_query_string(self):
+ if self.query:
+ return "?%s" % self.query
+ return ""
+
def get_uri(self):
- return "%s://%s%s%s" % (
+ return "%s://%s%s%s%s" % (
self.scheme,
self._get_credstring(),
self.netloc,
- self.path)
+ self.path,
+ self._get_query_string()
+ )
def parse_uri(self, uri):
"""
@@ -164,6 +172,7 @@ class StoreLocation(glance_store.location.StoreLocation):
self.netloc = netloc
self.path = path
+ self.query = pieces.query
def http_response_iterator(conn, response, size):