summaryrefslogtreecommitdiff
path: root/glance_store/_drivers/http.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-11-27 15:45:29 +0000
committerGerrit Code Review <review@openstack.org>2015-11-27 15:45:29 +0000
commite56962c2af7e2e944dc6a30959df8de8fdb922df (patch)
tree5f1b4b18875a6c9faf4d0518216435a9905bf9af /glance_store/_drivers/http.py
parent74df6a7be308076ed977f9c0f16a6de6e61e64c6 (diff)
parentdddb6f3357f1b9bbe52759b3bd1f3056aafcb168 (diff)
downloadglance_store-stable/kilo.tar.gz
Merge "Catch InvalidURL when requesting store size" into stable/kilokilo-eolstable/kilo
Diffstat (limited to 'glance_store/_drivers/http.py')
-rw-r--r--glance_store/_drivers/http.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/glance_store/_drivers/http.py b/glance_store/_drivers/http.py
index a2073de..754ed71 100644
--- a/glance_store/_drivers/http.py
+++ b/glance_store/_drivers/http.py
@@ -89,6 +89,15 @@ class StoreLocation(glance_store.location.StoreLocation):
if netloc == '':
LOG.info(_("No address specified in HTTP URL"))
raise exceptions.BadStoreUri(uri=uri)
+ else:
+ # IPv6 address has the following format [1223:0:0:..]:<some_port>
+ # we need to be sure that we are validating port in both IPv4,IPv6
+ delimiter = "]:" if netloc.count(":") > 1 else ":"
+ host, dlm, port = netloc.partition(delimiter)
+ # if port is present in location then validate port format
+ if port and not port.isdigit():
+ raise exceptions.BadStoreUri(uri=uri)
+
self.netloc = netloc
self.path = path