ref: b167077706a38c4efcd2abb8c6a787ce5810ef16
parent: 389f063a915a26e08adab95461a17ab4338e0d55
author: uriel <uriel@engel.se.cat-v.org>
date: Sat Jan 10 23:40:40 EST 2009
Fix blah to work with new handler interfaces. Remove outdated app-framework code. Clanup some of the fallback handler setting code.
--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -13,7 +13,7 @@
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 ^ \
'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />
--- a/bin/cgilib.rc
+++ b/bin/cgilib.rc
@@ -279,19 +279,10 @@
# 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
}
--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -103,17 +103,19 @@
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'
}