From the documentation it looks like ns_conn outputheaders "Returns an
ns_set containing the headers that will be sent out when a result is
returned to the client."
I can't get it to return anything but an empty set. All the examples
I see are of people writing to the set to add or overwrite headers,
but not anyone looking at the "...Headers that will be sent out..."
I see lots of examples of homemade headers to be sent out in advance
of ns_write to stream data to clients. I was hoping to be able to use
ns_conn returnheaders to get a nice pre-built set of headers that
AOLServer would have used in the case of, say, ns_return, that I could
ns_write without having to cobble together my own homebrew headers.
Should this work?
ns_register_proc GET /foobar headers
proc headers {} {
set headers [ns_conn outputheaders]
set html "Output headers are:<br>"
for {set i 0} {$i < [ns_set size $headers]} {incr i} {
append html "[ns_set key $headers $i] is [ns_set value
$headers $i]<br>"
}
ns_return 200 text/html $html
}
It works for ns_conn headers, but not outputheaders. If this is by
design, I think the documentation should be made clear that this
ns_set is empty and that any data added to it will overwrite or append
to the output headers.
Or I'm just doing it wrong...
Thanks,
- Ian
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.