Fixes bug on Windows related to a wrong API url

Fixes Bug #1079323

python-glanceclient (latest repository code) fails on Windows due to a
malformed API url. This error is due to the usage of os.path.normpath(),
which should not be used for URLs as it swaps "/" with "\" on Windows.

The fix consists in using posixpath.normpath().
Please see also https://bugs.launchpad.net/nova/+bug/1077125 and related
commit.

Change-Id: Iaa643bd579963ad9ffbf10674973cbca75d435ac
This commit is contained in:
Alessandro Pilotti
2012-11-15 20:25:26 +02:00
parent 16aafa728e
commit 6c201e63ea

View File

@@ -16,7 +16,7 @@
import copy
import httplib
import logging
import os
import posixpath
import socket
import StringIO
import struct
@@ -142,7 +142,7 @@ class HTTPClient(object):
conn = self.get_connection()
try:
conn_url = os.path.normpath('%s/%s' % (self.endpoint_path, url))
conn_url = posixpath.normpath('%s/%s' % (self.endpoint_path, url))
if kwargs['headers'].get('Transfer-Encoding') == 'chunked':
conn.putrequest(method, conn_url)
for header, value in kwargs['headers'].items():