Skip to content

Commit

Permalink
Revert "signurl should honor Config.use_https"
Browse files Browse the repository at this point in the history
This reverts commit 8788fe5.

The above patch overloads the use of the use_https meaning, which
isn't desirable.  S3's wildcard certs don't work well for https.  So
if a caller cares that it's https and not http, they're welcome to
make that change themselves.
  • Loading branch information
mdomsch committed Feb 11, 2015
1 parent 9d392fa commit e73bee0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions S3/Crypto.py
Expand Up @@ -55,19 +55,15 @@ def sign_url_v2(url_to_sign, expiry):

def sign_url_base_v2(**parms):
"""Shared implementation of sign_url methods. Takes a hash of 'bucket', 'object' and 'expiry' as args."""
cfg = Config.Config()
parms['expiry']=Utils.time_to_epoch(parms['expiry'])
parms['access_key']=cfg.access_key
parms['host_base']=cfg.host_base
parms['access_key']=Config.Config().access_key
parms['host_base']=Config.Config().host_base
debug("Expiry interpreted as epoch time %s", parms['expiry'])
signtext = 'GET\n\n\n%(expiry)d\n/%(bucket)s/%(object)s' % parms
debug("Signing plaintext: %r", signtext)
parms['sig'] = urllib.quote_plus(sign_string_v2(signtext))
debug("Urlencoded signature: %s", parms['sig'])
parms['protocol'] = 'http'
if cfg.use_https:
parms['protocol'] = 'https'
return "%(protocol)s://%(bucket)s.%(host_base)s/%(object)s?AWSAccessKeyId=%(access_key)s&Expires=%(expiry)d&Signature=%(sig)s" % parms
return "http://%(bucket)s.%(host_base)s/%(object)s?AWSAccessKeyId=%(access_key)s&Expires=%(expiry)d&Signature=%(sig)s" % parms

def sign(key, msg):
return hmac.new(key, msg.encode('utf-8'), sha256).digest()
Expand Down

0 comments on commit e73bee0

Please sign in to comment.