Permalink
Browse files

Use email.utils.formatdate rather than strftime to create Date header…

… to avoid problems with LOCALE. Closes GH-261.
  • Loading branch information...
1 parent 033457f commit ec14d483481308d6fc5856245aa646bd33fada44 @garnaat garnaat committed Jul 17, 2011
Showing with 4 additions and 7 deletions.
  1. +4 −7 boto/auth.py
View
@@ -34,8 +34,8 @@
import boto.utils
import hmac
import sys
-import time
import urllib
+from email.utils import formatdate
from boto.auth_handler import AuthHandler
from boto.exception import BotoClientError
@@ -111,8 +111,7 @@ def add_auth(self, http_request, **kwargs):
method = http_request.method
auth_path = http_request.auth_path
if not headers.has_key('Date'):
- headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
- time.gmtime())
+ headers['Date'] = formatdate(usegmt=True)
c_string = boto.utils.canonical_string(method, auth_path, headers,
None, self._provider)
@@ -136,8 +135,7 @@ def __init__(self, host, config, provider):
def add_auth(self, http_request, **kwargs):
headers = http_request.headers
if not headers.has_key('Date'):
- headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
- time.gmtime())
+ headers['Date'] = formatdate(usegmt=True)
b64_hmac = self.sign_string(headers['Date'])
auth_hdr = self._provider.auth_header
@@ -157,8 +155,7 @@ def __init__(self, host, config, provider):
def add_auth(self, http_request, **kwargs):
headers = http_request.headers
if not headers.has_key('Date'):
- headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
- time.gmtime())
+ headers['Date'] = formatdate(usegmt=True)
b64_hmac = self.sign_string(headers['Date'])
s = "AWS3-HTTPS AWSAccessKeyId=%s," % self._provider.access_key

0 comments on commit ec14d48

Please sign in to comment.