Hi Eric,

I think you need ns_register_filter instead of ns_register_proc.

Brian


________________________________________
From: AOLserver Discussion [EMAIL PROTECTED] On Behalf Of Eric Lee [EMAIL 
PROTECTED]
Sent: 27 November 2008 15:53
To: AOLSERVER@LISTSERV.AOL.COM
Subject: Re: [AOLSERVER] 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.  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

At 01:51 AM 11/27/2008, Scott Goodwin wrote:
>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 host [ns_set get $headers Host]
>
>What you're getting with [ns_conn host] is not the HTTP Host header
>but rather the host portion of the URL that was requested, e.g. if the
>client requested
>
>         http://scottg.net/index.adp
>
>[ns_conn host] will return 'scottg.net'
>
>/s.
>
>On Nov 27, 2008, at 12:33 AM, Eric Lee wrote:
>
>>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 formerly-separate host.
>>
>>The docs at:
>>http://panoptic.com/wiki/aolserver/Ns_register_proc
>>say
>>"The conn argument will be filled automatically with the connection
>>information."
>>so I expected it to be an ns_set or array, but it does not seem to be.
>>It contains "cns0" on the first use after a server restart, then
>>"cns1", "cns2" on following uses.
>>
>>Can someone give me a hint how to use the conn argument in:
>>
>>ns_register_proc GET /* misaEast AAA BBB
>>proc misaEast { conn {arg1 one} {arg2 two} } {
>>...
>>}
>>
>>I've also tried using [ns_conn host] within the proc but it just
>>returns "". Other ns_conn options, including url and location,
>>return the expected values. Is there a way around this?
>>
>>Should what I am trying to do be done a different way?
>>
>>Thank you,
>>
>>Eric Lee
>>
>>
>>--
>>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.
>
>
>--
>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.


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


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