summaryrefslogtreecommitdiff
path: root/ceilometerclient
diff options
context:
space:
mode:
authoryolanda.robla <yolanda.robla@canonical.com>2013-03-05 15:06:39 +0100
committerDoug Hellmann <doug.hellmann@dreamhost.com>2013-03-08 14:29:04 -0500
commit152f764042bbbb1ad4b1afb6afbcd0283d8283cb (patch)
tree9c235c4cf582ba0b9359e6c603d64c9a42a807a6 /ceilometerclient
parente001aaae1c5a88fc82ce7e81511ce0888614894d (diff)
downloadpython-ceilometerclient-152f764042bbbb1ad4b1afb6afbcd0283d8283cb.tar.gz
Properly removing start and ending slashes
Fixes: bug #1146690 Change-Id: I4258948f749128edeafb6ef3e64bda4ff35dbb58 Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Diffstat (limited to 'ceilometerclient')
-rw-r--r--ceilometerclient/common/http.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ceilometerclient/common/http.py b/ceilometerclient/common/http.py
index 2c61536..ea4d64f 100644
--- a/ceilometerclient/common/http.py
+++ b/ceilometerclient/common/http.py
@@ -118,6 +118,11 @@ class HTTPClient(object):
dump.extend([body, ''])
LOG.debug('\n'.join(dump))
+ def _make_connection_url(self, url):
+ (_class, _args, _kwargs) = self.connection_params
+ base_url = _args[2]
+ return '%s/%s' % (base_url.rstrip('/'), url.lstrip('/'))
+
def _http_request(self, url, method, **kwargs):
""" Send an http request with the specified characteristics.
@@ -134,8 +139,7 @@ class HTTPClient(object):
conn = self.get_connection()
try:
- conn_params = self.connection_params[1][2]
- conn_url = os.path.normpath('%s/%s' % (conn_params, url))
+ conn_url = self._make_connection_url(url)
conn.request(method, conn_url, **kwargs)
resp = conn.getresponse()
except socket.gaierror as e: