commit 27738e1cf12f2dbf4859b2aacbf0949a6fd778ad parent 10a639b215e35928156e18349e2da0b54223042a Author: uriel@engel.se.cat-v.org <unknown> Date: Sat, 10 Jan 2009 05:23:44 +0100 Handle static files! (Should only be used as a fallback if static files are not handled by httpd) Diffstat:
M | bin/werc.rc | | | 22 | ++++++++++++++++++++++ |
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git 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}