From 889e844d7389ac5073737565cd6ca6f879c4c987 Mon Sep 17 00:00:00 2001 From: Uriel Date: Sun, 11 Jan 2009 04:40:40 +0100 Subject: [PATCH] Fix blah to work with new handler interfaces. Remove outdated app-framework code. Clanup some of the fallback handler setting code. --- apps/blagh/app.rc | 2 +- bin/cgilib.rc | 11 +---------- bin/werc.rc | 14 ++++++++------ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc index 5fe8eaa..f3eb0fc 100644 --- a/apps/blagh/app.rc +++ b/apps/blagh/app.rc @@ -13,7 +13,7 @@ fn blagh_init { status='Use default handler' if not if(~ $req_path */index */) { - app_body_handler='blagh_body' + handler_body_main=blagh_body u=$blagh_uri'index' extraHeaders=$"extraHeaders ^ \ ' diff --git a/bin/cgilib.rc b/bin/cgilib.rc index 1561d62..f69d282 100644 --- a/bin/cgilib.rc +++ b/bin/cgilib.rc @@ -279,19 +279,10 @@ fn make_blog_post { # App framework fn init_apps { - found=() for(a in $enabled_apps) { . ./apps/$a/app.rc - if($a^'_init') - found=yes + $a^'_init' } - - ~ $#found 1 # Set status -} - -fn app_handler { - if(! ~ $#app_body_handler 0) - $app_body_handler } diff --git a/bin/werc.rc b/bin/werc.rc index 7ecc2ba..c621de4 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -103,17 +103,19 @@ fn setup_handlers { init_apps # Dir listing - if(~ $#handler_body_main 0 && ~ $local_path */index) - set_handler dir_listing_handler $local_path + if(! ~ $#handler_body_main 0) + { } # Pass + if not if(~ $local_path */index) + handler_body_main=(dir_listing_handler $local_path) # Explicit .html urls, the web server might handle this first! - if not if(~ $#handler_body_main 0 && ~ $local_path *.html && test -f $local_path) + if not if(~ $local_path *.html && test -f $local_path) perm_redirect `{ echo $req_path|sed 's/.html$//' } # Fallback static file handler - if not if(~ $#handler_body_main 0 && test -f $local_path) + if not if(test -f $local_path) static_file $local_path # File not found - if not if(~ $#handler_body_main 0) { - set_handler tpl_handler `{get_lib_file 404.tpl} + if not { + handler_body_main=(tpl_handler `{get_lib_file 404.tpl}) dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT echo 'Status: 404 Not Found' }