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.

content_type (defaults to "text/html")
content_length (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 ad_progress_bar_begin ad_progress_bar_begin (public) util_return_headers util_return_headers ad_progress_bar_begin->util_return_headers ad_return_top_of_page ad_return_top_of_page (public) ad_return_top_of_page->util_return_headers cr_write_content-lob cr_write_content-lob (private) cr_write_content-lob->util_return_headers packages/acs-subsite/www/shared/1pixel.tcl packages/acs-subsite/ www/shared/1pixel.tcl packages/acs-subsite/www/shared/1pixel.tcl->util_return_headers util_WriteWithExtraOutputHeaders util_WriteWithExtraOutputHeaders (private) util_return_headers->util_WriteWithExtraOutputHeaders

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]"

    if {[ns_info name] eq "NaviServer"} {
        set binary [expr {$text_p ? "" : "-binary"}]
        ns_headers {*}$binary 200 $content_type {*}$content_length
    } else {
        if {$content_length ne ""} {
            ns_set put [ns_conn outputheaders] "Content-Length" $content_length
        set all_the_headers "HTTP/1.0 200 OK
MIME-Version: 1.0
Content-Type: $content_type\r\n"
        util_WriteWithExtraOutputHeaders $all_the_headers
        if {[string match "text/*" $content_type]} {
            ns_startcontent -type $content_type
        } else {
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:

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