]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
functional._make_request: go back to simple version of httplib.request.
authorRobin H. Johnson <robin.johnson@dreamhost.com>
Sun, 27 Mar 2016 02:36:46 +0000 (02:36 +0000)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Wed, 20 Apr 2016 23:08:57 +0000 (16:08 -0700)
The httplib.request function automatically constructs the following
headers:
content-length, host, accept-encoding

Until such time as we need to override those values in incompatible
ways, simply use it.

Fixes: https://github.com/ceph/s3-tests/pull/92#issuecomment-185970260
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.com>
s3tests/functional/__init__.py

index 4bfc580d4258cd3b49bfaff02fbb51366f209c59..8fb4845c2c705106fbd9d733fb9bcca801907de5 100644 (file)
@@ -408,11 +408,10 @@ def _make_request(method, bucket, key, body=None, authenticated=False, response_
     return the response (status, reason).
 
     If key is None, then this will be treated as a bucket-level request.
+
+    If the request or response headers are None, then default values will be
+    provided by later methods.
     """
-    if response_headers is None:
-        response_headers = {}
-    if request_headers is None:
-        request_headers = {}
     if not path_style:
         conn = bucket.connection
         request_headers['Host'] = conn.calling_format.build_host(conn.server_name(), bucket.name)
@@ -468,17 +467,11 @@ def _make_raw_request(host, port, method, path, body=None, request_headers=None,
     if request_headers is None:
         request_headers = {}
 
-    skip_host=('Host' in request_headers)
-    skip_accept_encoding = False
     c = class_(host, port, strict=True, timeout=timeout)
 
-    # We do the request manually, so we can muck with headers
-    #c.request(method, path, body=body, headers=request_headers)
-    c.connect()
-    c.putrequest(method, path, skip_host, skip_accept_encoding)
-    for k,v in request_headers.items():
-        c.putheader(k,v)
-    c.endheaders(message_body=body)
+    # TODO: We might have to modify this in future if we need to interact with
+    # how httplib.request handles Accept-Encoding and Host.
+    c.request(method, path, body=body, headers=request_headers)
 
     res = c.getresponse()
     #c.close()