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.

Reply via email to