Commits

zbyte64  committed a53b5c9

bad commit

  • Participants
  • Parent commits ab1a2c3

Comments (0)

Files changed (1)

 
         is_secure = self.is_secure
         host = "%s:%d" % (server, self.port)
-        try:
-            #cast as a bytearray to work with python 2.7's httplib
-            data = bytearray(data)
-        except NameError:
-            pass
+        data = unicode(data)
         while True:
             if (is_secure):
                 connection = httplib.HTTPSConnection(host)
             final_headers = merge_meta(headers, metadata);
             # add auth header
             self._add_aws_auth_header(final_headers, method, bucket, key, query_args)
+            if isinstance(final_headers, str):
+                final_headers = unicode(final_headers)
+            if isinstance(final_headers, dict):
+                for key, value in final_headers.items():
+                    final_headers[unicode(key)] = unicode(value)
             connection.request(method, path, data, final_headers)
             resp = connection.getresponse()
             if resp.status < 300 or resp.status >= 400: