URL-encode http headers
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 24 Feb 2014 14:10:48 +0000 (16:10 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 24 Feb 2014 14:10:48 +0000 (16:10 +0200)
Refs: #5150

kamaki/cli/commands/pithos.py
kamaki/clients/__init__.py

index 7b41b4f..23155ca 100644 (file)
@@ -378,11 +378,6 @@ class file_modify(_pithos_container):
 
     def main(self, path_or_url):
         super(self.__class__, self)._run(path_or_url)
-        if self['publish'] and self['unpublish']:
-            raise CLIInvalidArgument(
-                'Arguments %s and %s cannot be used together' % (
-                    self.arguments['publish'].lvalue,
-                    self.arguments['publish'].lvalue))
         if self['no_permissions'] and (
                 self['uuid_for_read_permission'] or self[
                     'uuid_for_write_permission']):
index 35b76ca..b4fbb8f 100644 (file)
@@ -161,6 +161,12 @@ class RequestManager(Logged):
         else:
             sendlog.info('data size: 0%s' % plog)
 
+    def _encode_headers(self):
+        headers = self.headers
+        for k, v in self.headers.items():
+            headers[k] = quote(v)
+        self.headers = headers
+
     def perform(self, conn):
         """
         :param conn: (httplib connection object)
@@ -168,6 +174,7 @@ class RequestManager(Logged):
         :returns: (HTTPResponse)
         """
         self.dump_log()
+        self._encode_headers()
         conn.request(
             method=str(self.method.upper()),
             url=str(self.path),