Skip to content

Commit 0b943a1

Browse files
committed
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
2 parents b20df95 + 00c2ec2 commit 0b943a1

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
@@ -95,13 +95,13 @@ def test_special_attrs(self):
9595

9696
# loading 'expires'
9797
C = cookies.SimpleCookie()
98-
C.load('Customer="W"; expires=Wed, 01-Jan-2010 00:00:00 GMT')
98+
C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
9999
self.assertEqual(C['Customer']['expires'],
100-
'Wed, 01-Jan-2010 00:00:00 GMT')
100+
'Wed, 01 Jan 2010 00:00:00 GMT')
101101
C = cookies.SimpleCookie()
102-
C.load('Customer="W"; expires=Wed, 01-Jan-98 00:00:00 GMT')
102+
C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
103103
self.assertEqual(C['Customer']['expires'],
104-
'Wed, 01-Jan-98 00:00:00 GMT')
104+
'Wed, 01 Jan 98 00:00:00 GMT')
105105

106106
# 'max-age'
107107
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')

0 commit comments

Comments
 (0)