Thanks, Scott and Brian, for your help. The former procedure, now
filter, is working.
There are a couple things about this I'm still curious about:
1. What is the conn argument in ns_register_filter { conn what why }
for? It provides a value like "cns0". Is this the
extent of the "connection i
] Use of the conn argument in a registered proc
Thanks for the tip about ns_conn headers, which gets me over the
immediate problem.
My proc is now able to detect a host and ns_returnredirect successfully.
However if the test for that host fails the proc now returns nothing,
i.e. a page of 0 bytes
Eric,
You really should be using ns_register_filter instead of ns_return_proc.
ns_register_filter when method URLpattern myScript ?args?
proc myScript {?conn? args why} {
# Do stuff...
}
With ns_register_proc you intercept all matching URLs and *you* must
provide valid respons
Thanks for the tip about ns_conn headers, which gets me over the
immediate problem.
My proc is now able to detect a host and ns_returnredirect successfully.
However if the test for that host fails the proc now returns nothing,
i.e. a page of 0 bytes. What I want it do is just return the page
I should take my time and read through the entire message -- I guess
it's rather late.
The HTTP Host information will be located in the request headers which
you can grab and put into an ns_set like this:
set headers [ns_conn headers]
You can then get the HTTP Host header with:
set
You don't actually use the conn argument's value directly. Use ns_conn
to access the connection information. For example,
set url [ns_conn url]
gets you the URL of the HTTP request.
(a totally useless example, but you get the point).
/s.
On Nov 27, 2008, at 12:33 AM, Eric Lee wrote:
I'm tr
I'm trying to set up an ns_register_proc to redirect requests to what
used to be a separate website that now points to mine to a directory
on my site. (The client does not want to use a virtual server.)
My plan is to test the host of the connection and ns_returnredirect
if it matches the forme