Forum OpenACS Q&A: passing session forward to ns_httpget

Collapse
Posted by Taber Smith on
I have a tcl script and I want to call one of my web pages on my server. However, if I do ns_httpget, the page I'm calling has a ad_maybe_return_registration and so it bounces to the login page and that is returned to my script.

So I want to forward the header information in the current page (tcl script) on to the page I'm calling. I have tried everything I can think of with ad_conn, ns_set, ns_httpget, and ns_geturl.

Can anyone please hlpe me? Thx.

Collapse
Posted by Taber Smith on
Actually, one of my co-workers got this to work finally.

This is comand works:
set result [ util_httpget $my_url [ns_conn headers] ]
but this command does not:
set result [ ns_geturl $my_url [ns_conn headers] ]

Could anyone explain the difference to me? Thx.

Collapse
Posted by Michael A. Cleverly on
What is the value of $my_url. Specifically, is it a relative or an absolute URL?

util_httpget is coded in Tcl. ns_geturl is written in C. IIRC, the C implementation of ns_geturl calls one of two different C functions depending on whether the URL is relative (/*) or absolute (http://*).

I'd be willing to bet that the relative url mechanism short-circuts some portion of the normal connection process and that the ns_set of headers is completely ignored. (Which seems like a rather silly policy to have coded into the C code, or, being charitable, a silly thing to go undocumented.)