Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch...
authorSenthil Kumaran <senthil@uthcode.com>
Sun, 20 May 2012 04:02:44 +0000 (12:02 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Sun, 20 May 2012 04:02:44 +0000 (12:02 +0800)
Lib/Cookie.py
Lib/test/test_cookie.py
Misc/NEWS

index 323450b38ab7a0796f655e997e1d7429e8e9e0b4..616377cf736fd91b180bf7a97140e99f9f1ef5fb 100644 (file)
@@ -390,7 +390,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 d09398dca1f02772489d29a39800fa031872abc0..1fb9b7db9febc66d87da9c2fbf7e62beafa2dee9 100644 (file)
@@ -64,13 +64,13 @@ class CookieTests(unittest.TestCase):
 
         # loading 'expires'
         C = Cookie.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 = Cookie.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')
 
     def test_extended_encode(self):
         # Issue 9824: some browsers don't follow the standard; we now
index e8ce85d8f8c04441e063f494558eb2698b7ec2a2..3a75453acf545b51fa1cf01616218739426a9a83 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -64,6 +64,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #14426: Correct the Date format in Expires attribute of Set-Cookie
+  Header in Cookie.py.
+
 - Issue #14721: Send proper header, Content-length: 0 when the body is an empty
   string ''. Initial Patch contributed by Arve Knudsen.