From 259aafb6f0cee4659f1685d31d89505a82460832 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Thu, 15 Nov 2012 21:57:06 -0500 Subject: [PATCH] Refactor http_connect() to use http_connect_raw() Change-Id: I889c5eecf860cc947763c5d79148419f9741a2c2 Signed-off-by: Peter Portante --- swift/common/bufferedhttp.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/swift/common/bufferedhttp.py b/swift/common/bufferedhttp.py index 58670a4860..00e58da756 100644 --- a/swift/common/bufferedhttp.py +++ b/swift/common/bufferedhttp.py @@ -126,27 +126,14 @@ def http_connect(ipaddr, port, device, partition, method, path, :param ssl: set True if SSL should be used (default: False) :returns: HTTPConnection object """ - if not port: - port = 443 if ssl else 80 - if ssl: - conn = HTTPSConnection('%s:%s' % (ipaddr, port)) - else: - conn = BufferedHTTPConnection('%s:%s' % (ipaddr, port)) if isinstance(path, unicode): try: path = path.encode("utf-8") except UnicodeError: pass # what should I do? path = quote('/' + device + '/' + str(partition) + path) - if query_string: - path += '?' + query_string - conn.path = path - conn.putrequest(method, path, skip_host=(headers and 'Host' in headers)) - if headers: - for header, value in headers.iteritems(): - conn.putheader(header, str(value)) - conn.endheaders() - return conn + return http_connect_raw( + ipaddr, port, method, path, headers, query_string, ssl) def http_connect_raw(ipaddr, port, method, path, headers=None,