summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-11-03 12:27:28 +0000
committerGerrit Code Review <review@openstack.org>2022-11-03 12:27:28 +0000
commit236be80331d6885fb5926d320fc670a863ac5ee6 (patch)
tree95d65db2e823d6eae213fec059c279027c697634
parent8474416555b670c098e55a4605abb0ca9a046ed8 (diff)
parent8d883f011c586f0e79c56f0f70f9455997d70012 (diff)
downloadkeystone-stable/train.tar.gz
Merge "Fix host:port handling" into stable/trainstable/train
-rw-r--r--keystone/api/ec2tokens.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/keystone/api/ec2tokens.py b/keystone/api/ec2tokens.py
index d10b429b9..60007f93f 100644
--- a/keystone/api/ec2tokens.py
+++ b/keystone/api/ec2tokens.py
@@ -12,6 +12,8 @@
# This file handles all flask-restful resources for /v3/ec2tokens
+from six.moves.urllib import parse as urllib_parse
+
import flask
from keystoneclient.contrib.ec2 import utils as ec2_utils
from oslo_serialization import jsonutils
@@ -42,8 +44,8 @@ class EC2TokensResource(EC2_S3_Resource.ResourceBase):
# NOTE(vish): Some client libraries don't use the port when
# signing requests, so try again without the port.
elif ':' in credentials['host']:
- hostname, _port = credentials.split(':')
- credentials['host'] = hostname
+ parsed = urllib_parse.urlsplit('//' + credentials['host'])
+ credentials['host'] = parsed.hostname
# NOTE(davechen): we need to reinitialize 'signer' to avoid
# contaminated status of signature, this is similar with
# other programming language libraries, JAVA for example.