Commit 00c2ec28 authored by Senthil Kumaran's avatar Senthil Kumaran

Issue #14426: Correct the Date format in Expires attribute of Set-Cookie....

 Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
parent 079bfc96
...@@ -301,7 +301,7 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname): ...@@ -301,7 +301,7 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
from time import gmtime, time from time import gmtime, time
now = time() now = time()
year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future) 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) (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
......
...@@ -86,13 +86,13 @@ class CookieTests(unittest.TestCase): ...@@ -86,13 +86,13 @@ class CookieTests(unittest.TestCase):
# loading 'expires' # loading 'expires'
C = cookies.SimpleCookie() 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'], 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 = 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'], self.assertEqual(C['Customer']['expires'],
'Wed, 01-Jan-98 00:00:00 GMT') 'Wed, 01 Jan 98 00:00:00 GMT')
# 'max-age' # 'max-age'
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"') C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment