cmdlib: Remove acquired_locks attribute from LUs
[ganeti-local] / lib / http / client.py
index 8658aed..8cc4744 100644 (file)
@@ -28,6 +28,7 @@ from cStringIO import StringIO
 
 from ganeti import http
 from ganeti import compat
+from ganeti import netutils
 
 
 class HttpClientRequest(object):
@@ -104,8 +105,12 @@ class HttpClientRequest(object):
     """Returns the full URL for this requests.
 
     """
+    if netutils.IPAddress.IsValid(self.host):
+      address = netutils.FormatAddress((self.host, self.port))
+    else:
+      address = "%s:%s" % (self.host, self.port)
     # TODO: Support for non-SSL requests
-    return "https://%s:%s%s" % (self.host, self.port, self.path)
+    return "https://%s%s" % (address, self.path)
 
   @property
   def identity(self):
@@ -143,6 +148,10 @@ class _HttpClient(object):
     curl.setopt(pycurl.USERAGENT, http.HTTP_GANETI_VERSION)
     curl.setopt(pycurl.PROXY, "")
 
+    # Disable SSL session ID caching (pycurl >= 7.16.0)
+    if hasattr(pycurl, "SSL_SESSIONID_CACHE"):
+      curl.setopt(pycurl.SSL_SESSIONID_CACHE, False)
+
     # Pass cURL object to external config function
     if curl_config_fn:
       curl_config_fn(curl)