summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libcookie.tex
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-08-24 22:34:21 (GMT)
committerGeorg Brandl <georg@python.org>2005-08-24 22:34:21 (GMT)
commit532efabf1dcae183c586b78007baaaf59e4d61ca (patch)
treed840a3112bafdcec8b4a969b08fbaa18b08d72cf /Doc/lib/libcookie.tex
parente1b13d20199f79ffd3407bbb14cc09b1b8fd70d2 (diff)
downloadcpython-532efabf1dcae183c586b78007baaaf59e4d61ca.zip
cpython-532efabf1dcae183c586b78007baaaf59e4d61ca.tar.gz
cpython-532efabf1dcae183c586b78007baaaf59e4d61ca.tar.bz2
patch #848017: make Cookie more RFC-compliant.
Diffstat (limited to 'Doc/lib/libcookie.tex')
-rw-r--r--Doc/lib/libcookie.tex36
1 files changed, 19 insertions, 17 deletions
diff --git a/Doc/lib/libcookie.tex b/Doc/lib/libcookie.tex
index bba9c79..39b9cb4 100644
--- a/Doc/lib/libcookie.tex
+++ b/Doc/lib/libcookie.tex
@@ -98,7 +98,9 @@ In general, it should be the case that \method{value_encode()} and
Return a string representation suitable to be sent as HTTP headers.
\var{attrs} and \var{header} are sent to each \class{Morsel}'s
\method{output()} method. \var{sep} is used to join the headers
-together, and is by default a newline.
+together, and is by default the combination '\r\n' (CRLF).
+\versionchanged[The default separator has been changed from '\n' to match the cookie
+specification]{2.5}
\end{methoddesc}
\begin{methoddesc}[BaseCookie]{js_output}{\optional{attrs}}
@@ -195,32 +197,32 @@ The following example demonstrates how to use the \module{Cookie} module.
>>> C["fig"] = "newton"
>>> C["sugar"] = "wafer"
>>> print C # generate HTTP headers
-Set-Cookie: sugar=wafer;
-Set-Cookie: fig=newton;
+Set-Cookie: sugar=wafer
+Set-Cookie: fig=newton
>>> print C.output() # same thing
-Set-Cookie: sugar=wafer;
-Set-Cookie: fig=newton;
+Set-Cookie: sugar=wafer
+Set-Cookie: fig=newton
>>> C = Cookie.SmartCookie()
>>> C["rocky"] = "road"
>>> C["rocky"]["path"] = "/cookie"
>>> print C.output(header="Cookie:")
-Cookie: rocky=road; Path=/cookie;
+Cookie: rocky=road; Path=/cookie
>>> print C.output(attrs=[], header="Cookie:")
-Cookie: rocky=road;
+Cookie: rocky=road
>>> C = Cookie.SmartCookie()
>>> C.load("chips=ahoy; vienna=finger") # load from a string (HTTP header)
>>> print C
-Set-Cookie: vienna=finger;
-Set-Cookie: chips=ahoy;
+Set-Cookie: vienna=finger
+Set-Cookie: chips=ahoy
>>> C = Cookie.SmartCookie()
>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
>>> print C
-Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;";
+Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"
>>> C = Cookie.SmartCookie()
>>> C["oreo"] = "doublestuff"
>>> C["oreo"]["path"] = "/"
>>> print C
-Set-Cookie: oreo=doublestuff; Path=/;
+Set-Cookie: oreo=doublestuff; Path=/
>>> C = Cookie.SmartCookie()
>>> C["twix"] = "none for you"
>>> C["twix"].value
@@ -233,8 +235,8 @@ Set-Cookie: oreo=doublestuff; Path=/;
>>> C["string"].value
'seven'
>>> print C
-Set-Cookie: number=7;
-Set-Cookie: string=seven;
+Set-Cookie: number=7
+Set-Cookie: string=seven
>>> C = Cookie.SerialCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
@@ -243,8 +245,8 @@ Set-Cookie: string=seven;
>>> C["string"].value
'seven'
>>> print C
-Set-Cookie: number="I7\012.";
-Set-Cookie: string="S'seven'\012p1\012.";
+Set-Cookie: number="I7\012."
+Set-Cookie: string="S'seven'\012p1\012."
>>> C = Cookie.SmartCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
@@ -253,6 +255,6 @@ Set-Cookie: string="S'seven'\012p1\012.";
>>> C["string"].value
'seven'
>>> print C
-Set-Cookie: number="I7\012.";
-Set-Cookie: string=seven;
+Set-Cookie: number="I7\012."
+Set-Cookie: string=seven
\end{verbatim}