From 79c07a8d2338c25b56af844cf2b1e75acc5810b6 Mon Sep 17 00:00:00 2001 From: Uriel Date: Sat, 10 Jan 2009 05:23:44 +0100 Subject: [PATCH] Handle static files! (Should only be used as a fallback if static files are not handled by httpd) --- bin/werc.rc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bin/werc.rc b/bin/werc.rc index 54cf8c8..9da73af 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -116,6 +116,28 @@ fn select_handler { 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(test -f $local_path) { + m='text/plain' + if(~ $req_path *.css) + m='text/css' + if not if(~ $req_path *.ico) + m='image/x-icon' + if not if(~ $req_path *.png) + m='image/png' + if not if(~ $req_path *.jpg *.jpeg) + m='image/jpeg' + if not if(~ $req_path *.gif) + m='image/gif' + if not if(~ $req_path *.pdf) + m='application/pdf' + + echo 'Content-Type: '^$m + echo + cat $local_path + exit + } + # File not found if not { set_handler tpl_handler `{get_lib_file 404.tpl}