util_return_headers (public)

 util_return_headers [ content_type ] [ content_length ]

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

We use this when we want to send out just the headers and then do incremental writes with ns_write. This way the user doesn't have to wait for streamed output (useful when doing bulk uploads, installs, etc.). It returns status 200 and all headers including any added to outputheaders.

Parameters:
content_type (optional, defaults to "text/html")
content_length (optional)

Testcases:
No testcase defined.
Source code:
    set text_p [string match "text/*" $content_type]
    if {$text_p && ![string match "*charset=*" $content_type]} {
        append content_type "; charset=[ns_config ns/parameters OutputCharset utf-8]"
    }

    set binary [expr {$text_p ? "" : "-binary"}]
    ns_headers {*}$binary 200 $content_type {*}$content_length
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: