Commits

zbyte64 committed ab1a2c3

use bytearray when possible

Comments (0)

Files changed (1)

 
         is_secure = self.is_secure
         host = "%s:%d" % (server, self.port)
-        data = unicode(data)
+        try:
+            #cast as a bytearray to work with python 2.7's httplib
+            data = bytearray(data)
+        except NameError:
+            pass
         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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.