S3BotoStorage: set Content-Type header, ACL fixed, use HTTP and disable query auth by default
This patch has been created as part of my bachelor thesis  – as part of the daemon I wrote. I'm using django-storages to send files to FTP, Amazon S3 and Amazon CloudFront.
This patch is for S3BotoStorage and it does four things:
- The Content-Type header is set automatically via guessing based on the extension, this is done through mimetypes.guesstype. Right now, no Content-Type is set, and therefor the default binary mimetype is set: application/octet- stream. This causes browsers to download files instead of displaying them.
- The ACL now actually gets applied properly to the bucket and to each file that is saved to the bucket.
- Currently, URLs are generated with query-based authentication (meaning you'll get ridiculously long URLs) and HTTPS is used instead of HTTP, thereby preventing browsers from caching files. I've disabled query authentication and HTTPS, as this is the most common use case for serving files. This probably should be configurable, but that can be done in a revised patch or a follow-up patch.
- It allows you to set custom headers through the constructor (which I really needed for my daemon).
This greatly improves the usability of the S3BotoStorage custom storage system in its most common use case: as a CDN for publicly accessible files.