This page will try to collect code examples to ease the beginners to fully exploit one of Tcl's pearls, TclHTTPD, a pure-Tcl HTTPD server.
To set a cookie, first use Doc_SetCookie. The following is an example of a function setting a cookie:
Direct_Url /login login proc login { {username none} {password none} } { set expire [clock format [expr {[clock seconds] + 3600}] \ -format "%A, %d-%b-%Y %H:%M:%S GMT" -gmt 1] Doc_SetCookie -name username -value $username -expire $expire # Just output parameters; for debugging set html [html::head "Login" ] append html "Username: $username <BR>\n" append html "Password: $password <BR>\n" return $html }
2002-01-29 Acacio