Re: [AOLSERVER] Problem with in a web page
Thanks a lot Russell for your quick answer :) It seems like the server can't understand that the close brace is located at the end of the loop! As I would like the entire loop to be interpreted I would like to now if somebody has encounter this problem? This is a school project and this problem is quite misunderstandable for me ... Thanks a lot in advance :) Thibault -- 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.
Re: [AOLSERVER] Use of the conn argument in a registered proc
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.
Re: [AOLSERVER] Problem with in a web page
Thibault Fouache wrote: Hello, I've currently encouter a problem in one of my web pages (fire_blacklist.adp). You can find in this package the page, its backend, its api and the error. That says that ther is a close brace bu this close brace is not missing. Can somebody help me? I would like to say that this page was working well on an other httpd (tcl) that I cannot use now :). I see: %foreach {bChoice bValueChoice bAdress bValueAdress bProtocol bValueProtocol bPort bValuePort} $queryBlacklist {% Did you turn singlescript processing on? If not, this is an ADP script block that has an unclosed brace, the at the end. -- Dossy Shiobara | [EMAIL PROTECTED] | http://dossy.org/ Panoptic Computer Network | http://panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- 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.
Re: [AOLSERVER] Problem with in a web page
Something to be aware of is that the parser does not ignore braces that are in comments, so if you have: # if { $foo == abc } { change it to: # if { $foo == abc } {} to avoid complaints about unclosed braces. Eric At 06:49 AM 11/28/2008, you wrote: Thanks a lot Russell for your quick answer :) It seems like the server can't understand that the close brace is located at the end of the loop! As I would like the entire loop to be interpreted I would like to now if somebody has encounter this problem? This is a school project and this problem is quite misunderstandable for me ... Thanks a lot in advance :) Thibault -- 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.
Re: [AOLSERVER] Use of the conn argument in a registered proc
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 information or is it a key to something? Absence of it does not prevent ns_conn from being used within the proc. 2. Why does [ns_conn host] used within the filter procedure return while [ns_conn url] returns the proper value? Also, is there a reason this page of the new Tcl API docs is essentially empty? http://dev.aolserver.com/wiki/Ns_register_filter Information about ns_register_filter is still available at (old): http://aolserver.sourceforge.net/docs/devel/tcl/api/general.html#ns_register_filter http://www.aolserver.com/docs/devel/tcl/api/general.html#ns_register_filter Eric Lee At 11:54 AM 11/27/2008, you wrote: 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. -- 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.