Got it..... you were close....

ns_adp_return set the status to return, but still caused the next adp to fail, 
so taking your code I altered it a bit...

proc decode_url { why } {
  set page [ns_adp_parse -file /www/spells/template2.adp]
  ns_return 200 "text/html" "$page"
  ns_adp_exception state
  ns_log notice "adp exception state is $state"
  if {$state=="abort"} {
    catch {ns_adp_return}
    set page [ns_adp_parse "Hello"]
    ns_adp_exception state
    ns_log notice "adp exception state is $state"
  }
  return filter_return
}


I added a ns_adp_parse on the case an abort was called, this then fails the 
parse, but the ns_adp_exception gets set to ok, and future connections work.

Now that this is fixed I will have to find something else to do with my spare 
time.

Thanks for everyone's help on this,

_Peter



> Date: Tue, 7 Jul 2009 11:54:52 -0700
> From: dv...@diphi.com
> Subject: Re: [AOLSERVER] ns_adp_parse issue
> To: AOLSERVER@LISTSERV.AOL.COM
> 
> Francesco Petrarch wrote:
> > Ok, I got this, this time I really do, and it should be easily 
> > replicated by anyone.
> > 
> > I have this filter:
> > 
> > ns_register_filter preauth GET /*.html decode_url
> > ns_register_filter preauth POST /*.html decode_url
> > ns_register_filter preauth HEAD /*.html decode_url
> > proc decode_url { why } {
> >     set page [ns_adp_parse -file /www/website/template.adp]
> >     ns_return 200 "text/html" "$page"
> >     return filter_return
> > }
> 
> Your problem has nothing to do with ns_httpget.
> 
> The problem is that the ADP execution context (which is tied to the tcl 
> interpreter executing the request) does not get reset until the adp 
> request completes, which normally happens when the output is flushed at 
> the end of an adp page.  Since you are calling the adp page within a 
> filter, the full adp page handler is never executed, so the cleanup 
> never happens, and the adp interpreter is in the "aborted" state, which 
> means that it never executes any code.
> 
> You can use "ns_adp_exception state" to get the current exception state 
> of the adp interpreter.  And you can call "ns_adp_return" to set the 
> exception state to "return" which I believe will get turned into "ok" 
> the next time through.  For example:
> 
> proc decode_url { why } {
>       set page [ns_adp_parse -file /www/website/template.adp]
>       ns_return 200 "text/html" "$page"
>       ns_adp_exception state
>       ns_log notice "adp exception state is $state"
>       catch {ns_adp_return}
>       return filter_return
> }
> 
> It appears that adp code is only expected to be run from a handler, not 
> from a filter.  Perhaps a "reset" subcommand should be added to 
> ns_adp_ctl to expose NsAdpReset at the tcl level for cases like this.
> 
> -J
> 
> 
> --
> AOLserver - http://www.aolserver.com/
> 
> To Remove yourself from this list, simply send an email to 
> <lists...@listserv.aol.com> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
> field of your email blank.

_________________________________________________________________
We are your photos. Share us now with Windows Live Photos.
http://go.microsoft.com/?linkid=9666047

--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to