From 1d320ebf613b182ed4e763275f5b24204b2f8b86 Mon Sep 17 00:00:00 2001 From: Uriel Date: Fri, 29 May 2009 10:07:01 +0000 Subject: [PATCH] Move setup of main handler for 404 to a setup_404_handler function that can be more easily overriden, for example from config files! --- bin/corehandlers.rc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc index c0b8584..e72b20f 100644 --- a/bin/corehandlers.rc +++ b/bin/corehandlers.rc @@ -117,11 +117,15 @@ fn setup_handlers { 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 }