ad_set_cookie

one of the documented procedures in this installation of the ACS
Usage:
ad_set_cookie { -replace f -secure f -expires "" -max_age "" -domain "" -path "/" } name value
What it does:
Sets a cookie.
Defined in: /web/philip/packages/acs-core/utilities-procs.tcl

Source code:

arg_parser_for_ad_set_cookie $args

    set headers [ns_conn outputheaders]
    if { $replace != "f" } {
	# Try to find an already-set cookie named $name.
	for { set i 0 } { $i < [ns_set size $headers] } { incr i } {
	    if { ![string compare [string tolower [ns_set key $headers $i]] "set-cookie"] &&  [regexp "^$name=" [ns_set value $headers $i]] } {
		ns_set delete $headers $i
		break
	    }
	}
    }

    set cookie "$name=$value"

    if { $path != "" } {
	append cookie "; Path=$path"
    }

    if { ![string compare [string tolower $expires] "never"] } {
	append cookie "; Expires=Tue, 01-Jan-2030 01:00:00 GMT"
    } elseif { $expires != "" } {
	append cookie "; Expires=$expires"
    }

    if { $max_age != "" } {
	append cookie "; Max-Age=$max_age"
    }

    if { $domain != "" } {
	append cookie "; Domain=$domain"
    }

    if { $secure != "f" } {
	append cookie "; Secure"
    }

    ns_set put $headers "Set-Cookie" $cookie


philg@mit.edu