Skip to content

Commit 00c2ec2

Browse files
committed
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
1 parent 079bfc9 commit 00c2ec2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Lib/http/cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
301301
from time import gmtime, time
302302
now = time()
303303
year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
304-
return "%s, %02d-%3s-%4d %02d:%02d:%02d GMT" % \
304+
return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
305305
(weekdayname[wd], day, monthname[month], year, hh, mm, ss)
306306

307307

Lib/test/test_http_cookies.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ def test_special_attrs(self):
8686

8787
# loading 'expires'
8888
C = cookies.SimpleCookie()
89-
C.load('Customer="W"; expires=Wed, 01-Jan-2010 00:00:00 GMT')
89+
C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
9090
self.assertEqual(C['Customer']['expires'],
91-
'Wed, 01-Jan-2010 00:00:00 GMT')
91+
'Wed, 01 Jan 2010 00:00:00 GMT')
9292
C = cookies.SimpleCookie()
93-
C.load('Customer="W"; expires=Wed, 01-Jan-98 00:00:00 GMT')
93+
C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
9494
self.assertEqual(C['Customer']['expires'],
95-
'Wed, 01-Jan-98 00:00:00 GMT')
95+
'Wed, 01 Jan 98 00:00:00 GMT')
9696

9797
# 'max-age'
9898
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')

0 commit comments

Comments
 (0)