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 responses.

With ns_register_filter you intercept all matching URLs (as with ns_register_proc), but if you don't want to handle the response yourself because the Host header doesn't match, you simply "return filter_ok" and the server continues to handle the response normally.

When the Host header does match, your proc would do the redirect or the ns_return or ns_write back to the client and then do a "return filter_return" so that the server doesn't continue to process the connection itself.

/s.

On Nov 27, 2008, at 10:53 AM, Eric Lee wrote:

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 requested, i.e. just treat the request in the normal way.

If I ns_returnredirect to the original location it gets into a loop (four requests in access.log) and the browser says: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

What is the correct way to handle this? Does the proc need to return the entire original page? Would that be [ns_conn content] or is there more to it than that? The result should be transparent, as though there were no registered proc involved.

Again, I wonder whether my approach to the initial problem is right.

I'm using AOLserver 4.0.10

Eric


--
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.

Reply via email to