Skip to content

Commit bd34162

Browse files
committed
capitialize "HttpOnly" and "Secure" as they appear in the standard and other impls (closes #23250)
Patch by Jon Dufresne.
1 parent f716d8b commit bd34162

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Lib/http/cookies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ class Morsel(dict):
330330
"comment" : "Comment",
331331
"domain" : "Domain",
332332
"max-age" : "Max-Age",
333-
"secure" : "secure",
334-
"httponly" : "httponly",
333+
"secure" : "Secure",
334+
"httponly" : "HttpOnly",
335335
"version" : "Version",
336336
}
337337

Lib/test/test_http_cookies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_set_secure_httponly_attrs(self):
114114
C['Customer']['secure'] = True
115115
C['Customer']['httponly'] = True
116116
self.assertEqual(C.output(),
117-
'Set-Cookie: Customer="WILE_E_COYOTE"; httponly; secure')
117+
'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Secure')
118118

119119
def test_secure_httponly_false_if_not_present(self):
120120
C = cookies.SimpleCookie()
@@ -152,7 +152,7 @@ def test_extra_spaces(self):
152152
C = cookies.SimpleCookie()
153153
C.load('eggs = scrambled ; secure ; path = bar ; foo=foo ')
154154
self.assertEqual(C.output(),
155-
'Set-Cookie: eggs=scrambled; Path=bar; secure\r\nSet-Cookie: foo=foo')
155+
'Set-Cookie: eggs=scrambled; Path=bar; Secure\r\nSet-Cookie: foo=foo')
156156

157157
def test_quoted_meta(self):
158158
# Try cookie with quoted meta-data

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Core and Builtins
4444
Library
4545
-------
4646

47+
- Issue #23250: In the http.cookies module, capitalize "HttpOnly" and "Secure"
48+
as they are written in the standard.
49+
4750
- Issue #23063: In the disutils' check command, fix parsing of reST with code or
4851
code-block directives.
4952

0 commit comments

Comments
 (0)