Move setup of main handler for 404 to a setup_404_handler function that can be more easily overriden, for example from config files!
This commit is contained in:
parent
9d7ac1c517
commit
1d320ebf61
1 changed files with 9 additions and 5 deletions
|
|
@ -117,11 +117,15 @@ fn setup_handlers {
|
||||||
if not if(~ $req_path /pub/* && test -f .$req_path)
|
if not if(~ $req_path /pub/* && test -f .$req_path)
|
||||||
static_file .$req_path
|
static_file .$req_path
|
||||||
# File not found
|
# File not found
|
||||||
if not {
|
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})
|
handler_body_main=(tpl_handler `{get_lib_file 404.tpl})
|
||||||
echo 'Status: 404 Not Found'
|
echo 'Status: 404 Not Found'
|
||||||
dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT
|
dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_handlers { for(h in $*) run_handler $$h }
|
fn run_handlers { for(h in $*) run_handler $$h }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue