]> granicus.if.org Git - python/commitdiff
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch...
authorSenthil Kumaran <senthil@uthcode.com>
Sun, 20 May 2012 04:05:16 +0000 (12:05 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Sun, 20 May 2012 04:05:16 +0000 (12:05 +0800)
Lib/http/cookies.py
Lib/test/test_http_cookies.py

index 93da62791df4f3389e731cef910323fae565e417..2aeb8d320fb9b34201fcd56c64086a4ee5583859 100644 (file)
@@ -301,7 +301,7 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
     from time import gmtime, time
     now = time()
     year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
-    return "%s, %02d-%3s-%4d %02d:%02d:%02d GMT" % \
+    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
            (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
 
 
index f9a98c4ae1427107f4872a3b29a5b0a24ecb3637..1f1ca5852ef0989fa53149fdad9e0d21e70df22d 100644 (file)
@@ -86,13 +86,13 @@ class CookieTests(unittest.TestCase):
 
         # loading 'expires'
         C = cookies.SimpleCookie()
-        C.load('Customer="W"; expires=Wed, 01-Jan-2010 00:00:00 GMT')
+        C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
         self.assertEqual(C['Customer']['expires'],
-                         'Wed, 01-Jan-2010 00:00:00 GMT')
+                         'Wed, 01 Jan 2010 00:00:00 GMT')
         C = cookies.SimpleCookie()
-        C.load('Customer="W"; expires=Wed, 01-Jan-98 00:00:00 GMT')
+        C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
         self.assertEqual(C['Customer']['expires'],
-                         'Wed, 01-Jan-98 00:00:00 GMT')
+                         'Wed, 01 Jan 98 00:00:00 GMT')
 
         # 'max-age'
         C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')