Cookies
== Description ==
This page describes the facilities of the HOP library for retrieving,
modifying, and removing cookies.
== Synopsis ==
=== Server ===
(http-cookie-get request name [path] [domain])
=== Client ===
(cookie-get name)
(cookie-set! name val [path] [domain] [expires])
(cookie-remove! name)
== Examples ==
cookie
== Server Definitions ==
=== ++(http-cookie-get request name)++ ===
http-cookie-get
^ arguments ^ type ^ short description ^
| request | ::http-request | a request. |
| name | string | the name of the cookie. |
This function retrieves from the header of the ++request++ the cookie
information transmitted by the client.
== Client definitions ==
=== ++(cookie-get name)++ ===
cookie-get
^ arguments ^ type ^ short description ^
| name | string | the name of the cookie. |
This function retrieves the cookie information for ++name++ in the current
document.
=== ++(cookie-set! name value [path] [domain] [expires])++ ===
cookie-set!
^ arguments ^ type ^ short description ^
| name | string | the name of the cookie. |
| value | string | a cookie value. |
| path | string | a cookie path. |
| domain | string | a cookie domain. |
| expires | string | a cookie expiration period. |
This function associates a new string with the cookie ++name++ on the
current document.
~~ Cookies can automatically be stored on document at load time. If an
answer to a client request contains a Set-Cookie: field, this forces
the client to associate a cookie with the document it will build for
displaying the request. For instance, the following HOP response stores
a cookie named ++Foo++ with value ++"foo"++ and that will last one minute
one the client:
(instantiate::http-response-string
(body "Cookie \"Foo\" installed")
(header '((Set-Cookie: . "Foo=\"foo\"; Max-Age=60"))))
=== ++(cookie-remove! name path domain)++ ===
cookie-remove!
^ arguments ^ type ^ short description ^
| name | string | the name of the cookie. |
| path | string | the path of the cookie. |
| domain | string | the domain of the cookie. |
This function removes the cookie ++name++ from the current document.
cookie