diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-09-06 19:28:11 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-09-06 19:28:11 (GMT) |
commit | 6ac7d7c80b366033d36de6e0d84ee2b872b8b9a7 (patch) | |
tree | ddede4e77d2a1a7a5d5f346399738daa4361b00b | |
parent | 810f807b1bc66c1179879911179be0df9a2462f8 (diff) | |
download | cpython-6ac7d7c80b366033d36de6e0d84ee2b872b8b9a7.zip cpython-6ac7d7c80b366033d36de6e0d84ee2b872b8b9a7.tar.gz cpython-6ac7d7c80b366033d36de6e0d84ee2b872b8b9a7.tar.bz2 |
#1638033: add support for httponly on Cookie.Morsel
Reviewer: Benjamin
-rw-r--r-- | Doc/library/cookie.rst | 10 | ||||
-rw-r--r-- | Lib/Cookie.py | 6 | ||||
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/Doc/library/cookie.rst b/Doc/library/cookie.rst index 346da5a..b6a85f5 100644 --- a/Doc/library/cookie.rst +++ b/Doc/library/cookie.rst @@ -148,7 +148,7 @@ Morsel Objects -------------- -.. class:: Morsel() +.. class:: Morsel Abstract a key/value pair, which has some :rfc:`2109` attributes. @@ -162,9 +162,17 @@ Morsel Objects * ``max-age`` * ``secure`` * ``version`` + * ``httponly`` + + The attribute :attr:`httponly` specifies that the cookie is only transfered + in HTTP requests, and is not accessible through JavaScript. This is intended + to mitigate some forms of cross-site scripting. The keys are case-insensitive. + .. versionadded:: 2.6 + The :attr:`httponly` attribute was added. + .. attribute:: Morsel.value diff --git a/Lib/Cookie.py b/Lib/Cookie.py index e1eb734..b2f7427 100644 --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -408,6 +408,9 @@ class Morsel(dict): # For historical reasons, these attributes are also reserved: # expires # + # This is an extension from Microsoft: + # httponly + # # This dictionary provides a mapping from the lowercase # variant on the left to the appropriate traditional # formatting on the right. @@ -417,6 +420,7 @@ class Morsel(dict): "domain" : "Domain", "max-age" : "Max-Age", "secure" : "secure", + "httponly" : "httponly", "version" : "Version", } @@ -499,6 +503,8 @@ class Morsel(dict): RA("%s=%d" % (self._reserved[K], V)) elif K == "secure": RA(str(self._reserved[K])) + elif K == "httponly": + RA(str(self._reserved[K])) else: RA("%s=%s" % (self._reserved[K], V)) @@ -122,6 +122,7 @@ Nicolas Chauvat Michael Chermside Albert Chin-A-Young Adal Chiriliuc +Matt Chisholm Tom Christiansen Vadim Chugunov David Cinege @@ -56,6 +56,8 @@ C-API Library ------- +- Issue #1638033: Cookie.Morsel gained the httponly attribute. + - Issue #3535: zipfile couldn't read some zip files larger than 2GB. - Issue #3776: Deprecate the bsddb package for removal in 3.0. |