Commits

David Larlet  committed d1e1d83

S3: Added Content-Length header for put requests to s3 storage, propagates the change from @mgunneras' fork, thanks

  • Participants
  • Parent commits 85416f4

Comments (0)

Files changed (2)

 testdb.sqlite
 django
 local_settings.py
+dist/*
+django_storages.*
+setuptools*

File backends/s3.py

 
     def _put_file(self, name, content):
         content_type = mimetypes.guess_type(name)[0] or "application/x-octet-stream"
-        self.headers.update({'x-amz-acl': self.acl, 'Content-Type': content_type})
+        self.headers.update({
+            'x-amz-acl': self.acl, 
+            'Content-Type': content_type,
+            'Content-Length' : len(content),
+        })
         response = self.connection.put(self.bucket, name, content, self.headers)
         if response.http_response.status not in (200, 206):
             raise IOError("S3StorageError: %s" % response.message)