Forum OpenACS Q&A: Response to broken ns_returnnotfound and templated error return pages

Jeff, 3.x 404's do in fact work "correctly" for both *.tcl files and *.html/adp files -- just differently. The neato page you can specify with ns_param NotFoundResponse displays in the latter but not the former case.

In /tcl/ad-html.tcl, ad_serve_html_pages is ns_register_proc'd to run for all *.html/adp pages. If it can't find the requested url, it returns

ns_returnfile 404 text/html $full_path
Whereas in /tcl/ad-aolserver-3.tcl, ns_sourceproc is ns_register_proc'd to run for all *.tcl pages. If it can't find the requested url, it returns
ns_returnnotfound $conn

As you point out, the difference is that the latter returns the conn arg to the user's connection. I don't understand the underlying plumbing of http to know whether this is important. Looks to me as if it would be a trivial thing to modify ns_sourceproc to send back an ns_returnfile 404 instead.

Can anyone think of a reason not to do this and unify file-not-found behavior across all page types in a site?