Add option to produce protocol-relative URLs with S3BotoStorage
Currently, S3BotoStorage returns either HTTP or HTTPS URLs from the url() method , depending on the value of secure_urls.
If you're using S3Boto and want to return protocol-relative URLs , there's currently no way to ask for this behavior. Protocol-relative URL's omit the protocol and use whatever the browser is currently using so as to avoid mixed-content warnings.
This sort of thing would be especially useful in conjunction with something like django-staticfiles, where I'd like my site's media to work regardless of whether the browser is accessing via HTTP or HTTPS.
My ghetto subclass hack to force this is ugly. More settings are always suspect, but in this case I think they make sense.
Two possible approaches:
=== Approach 1 - More Backwards Compatible ===
Add another setting, AWS_S3_PROTOCOL_RELATIVE_URLS. If it's true, short-circuit the existing AWS_S3_SECURE_URLS setting and always return protocol-relative URLs.
=== Approach 2: Cleaner ===
Get rid of AWS_S3_SECURE_URLS and instead use something like AWS_S3_URL_PROTOCOL. It can be a string like 'http' or 'https'. A blank string would result in a protocol-relative URL.
Side benefit: this would be future-compatible with SPDY :)