ref: 41800d99d2e9d10e31a061c1bdb7794fcb448357
parent: 6a11fe86feaaf80529add6f1e54705237bbf054f
author: sl <uriel@engel.se.cat-v.org>
date: Fri May 29 06:07:01 EDT 2009
Move setup of main handler for 404 to a setup_404_handler function that can be more easily overriden, for example from config files!
--- a/bin/corehandlers.rc
+++ b/bin/corehandlers.rc
@@ -117,11 +117,15 @@
if not if(~ $req_path /pub/* && test -f .$req_path)
static_file .$req_path
# File not found
- if not {
- handler_body_main=(tpl_handler `{get_lib_file 404.tpl})
- echo 'Status: 404 Not Found'
- dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT
- }
+ if not
+ setup_404_handler
+}
+
+# This function allows config files to deffine their own 404 handlers.
+fn setup_404_handler {
+ handler_body_main=(tpl_handler `{get_lib_file 404.tpl})
+ echo 'Status: 404 Not Found'
+ dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT
}
fn run_handlers { for(h in $*) run_handler $$h }