Browse code

Added a --disable-content-encoding to disable adding the content-encoding header to the pushed objects

George Melika authored on 2013/08/16 04:19:07
Showing 3 changed files
... ...
@@ -417,7 +417,7 @@ class S3(object):
417 417
             content_type = content_type + "; charset=" + self.config.encoding.upper()
418 418
 
419 419
         headers["content-type"] = content_type
420
-        if content_encoding is not None:
420
+        if content_encoding is not None and self.config.add_content_encoding:
421 421
             headers["content-encoding"] = content_encoding
422 422
 
423 423
         ## Other Amazon S3 attributes
... ...
@@ -1868,6 +1868,7 @@ def main():
1868 1868
     optparser.add_option(      "--add-header", dest="add_header", action="append", metavar="NAME:VALUE", help="Add a given HTTP header to the upload request. Can be used multiple times. For instance set 'Expires' or 'Cache-Control' headers (or both) using this options if you like.")
1869 1869
 
1870 1870
     optparser.add_option(      "--encoding", dest="encoding", metavar="ENCODING", help="Override autodetected terminal and filesystem encoding (character set). Autodetected: %s" % preferred_encoding)
1871
+    optparser.add_option(      "--disable-content-encoding", dest="add_content_encoding", action="store_false", help="Don't include a Content-encoding header to the the uploaded objects")
1871 1872
     optparser.add_option(      "--add-encoding-exts", dest="add_encoding_exts", metavar="EXTENSIONs", help="Add encoding to these comma delimited extensions i.e. (css,js,html) when uploading to S3 )")
1872 1873
     optparser.add_option(      "--verbatim", dest="urlencoding_mode", action="store_const", const="verbatim", help="Use the S3 name as given on the command line. No pre-processing, encoding, etc. Use with caution!")
1873 1874
 
... ...
@@ -262,6 +262,9 @@ Add a given HTTP header to the upload request. Can be used multiple times. For i
262 262
 \fB\-\-encoding\fR=ENCODING
263 263
 Override autodetected terminal and filesystem encoding (character set). Autodetected: UTF-8
264 264
 .TP
265
+\fB\-\-disable\-content\-encoding\fR
266
+Don't include a Content-encoding header to the the uploaded objects. Default: False
267
+.TP
265 268
 \fB\-\-add\-encoding\-exts\fR=EXTENSIONs
266 269
 Add encoding to these comma delimited extensions i.e. (css,js,html) when uploading to S3 )
267 270
 .TP