Forum OpenACS Q&A: Response to Changing http headers

Collapse
Posted by Michael A. Cleverly on
The request processor doesn't have anything magical in this regard, and if it did, it'd just be a short cut for what you typed above. Perhaps a short wrapper proc (to make things read more cleanly?) along the lines of:
    ad_proc append_outputheader {-overwrite:boolean key value} {
        Add an output header that will get written to the client
        connection.  Use -overwrite to update a key that already
        exists (without -overwrite a duplicate key results in 
        multiple headers being sent to the client which may very
        well be OK depending on the header).
    } {
        if {$overwrite_p} {
            ns_set update [ad_conn outputheaders] $key $value
        } else {
            ns_set put [ad_conn outputheaders] $key $value
        }
    }