httpd::cookie(n) 1.0 "Tcl Web Server"

NAME

httpd::cookie - Cookie management

SYNOPSIS

package require httpd::cookie ?1.0?

Cookie_Set (option value)...
Cookie_Save sock ?interp?
Cookie_Make (option value)...
Cookie_Get cookie

DESCRIPTION

The package httpd::cookie provides a number of convenient commands for the setup and use of cookies.

See http://wp.netscape.com/newsref/std/cookie_spec.html for the specification of what cookies are and how they work.

Public API

Cookie_Set (option value)...
Creates new cookie using the specified options and stores it internally. See section Cookie options for the allowed options and their meaning.

Cookie_Save sock ?interp?
Takes all the cookies which were created in the specified interpreter (via Cookie_Set) and instructs the Http protocol engine (see package httpd) to return them to the browser. If no interpreter is specified the current interpreter is used as data source.

Cookie_Make (option value)...
Low-level command to encode the specified options into a cookie. The generated cookie is not stored internally but returned as the result of the command. See section Cookie options for the allowed options and their meaning.

Cookie_Get cookie
Looks in the environment created by the Http protocol engine (see package httpd) for cookies sent by the browser and return a list of cookie values which match the specified key (cookie).

Danger: This command prefers the data in the environment variables (HTTP_COOKIE) over the data in the request status array. This means that at certain points in the processing of a request the data returned by this command is out of sync with the actual data in the request status array. A concrete example of this are access control hooks (See Url_AccessUnInstall). When they are called the CGI environment has not yet been (re)initialized, meaning that this command will return the cookie data for the last request, and not of the current one.

Cookie options

name
Name of the cookie

value
Cookie value

path
Path restriction

domain
Domain restriction

expires
Time restriction. Required format is "%A, %d-%b-%Y %H:%M:%S GMT" If it is not in GMT it has to acceptable to clock scan for conversion.

SEE ALSO

httpd

KEYWORDS

cookies, web server

COPYRIGHT

Copyright © 2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>