]> granicus.if.org Git - python/commitdiff
Merged revisions 66262 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Sat, 6 Sep 2008 19:37:35 +0000 (19:37 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 6 Sep 2008 19:37:35 +0000 (19:37 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66262 | benjamin.peterson | 2008-09-06 14:28:11 -0500 (Sat, 06 Sep 2008) | 4 lines

  #1638033: add support for httponly on Cookie.Morsel

  Reviewer: Benjamin
........

Doc/library/http.cookies.rst
Lib/http/cookies.py
Misc/ACKS

index 9bffa40ab3f5ac709ed9f125d999922960cc6860..0b6607287b89903e06f8ba56ccecf29c6c7f8307 100644 (file)
@@ -109,7 +109,7 @@ Morsel Objects
 --------------
 
 
-.. class:: Morsel()
+.. class:: Morsel
 
    Abstract a key/value pair, which has some :rfc:`2109` attributes.
 
@@ -123,9 +123,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
 
index 3242d8374ad77a7dc5af78b6450c15a5113cb40a..03d1627de9ca13837501eb24cb4b1c17d336a973 100644 (file)
@@ -325,6 +325,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.
@@ -334,6 +337,7 @@ class Morsel(dict):
                    "domain"      : "Domain",
                    "max-age" : "Max-Age",
                    "secure"      : "secure",
+                   "httponly"  : "httponly",
                    "version" : "Version",
                    }
 
@@ -413,6 +417,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))
 
index dd658c76812af10cf29c921040cd996103ccd34c..0cc5adea1ed7274ff940a08c87ca3117d632ae87 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -121,6 +121,7 @@ Nicolas Chauvat
 Michael Chermside
 Albert Chin-A-Young
 Adal Chiriliuc
+Matt Chisholm
 Tom Christiansen
 Vadim Chugunov
 David Cinege