shithub: werc

Download patch

ref: 7078378dc5d96a41c432b4f8e2b009d067869e00
parent: c64f594c3b27b3def8dfb0b03296e9365728f41b
author: uriel <[email protected]>
date: Thu Jan 15 20:24:58 EST 2009

Proper 404 for dirs too

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -170,8 +170,12 @@
 if(~ $req_path */index)
     perm_redirect `{echo $req_path | sed 's,/index$,/,'}
 
-if(~ $local_path */)
-    local_path=$local_path^'index'
+if(~ $local_path */) {
+    if(test -d $local_path)
+        local_path=$local_path^'index'
+    if not
+        perm_redirect `{echo $req_path|sed 's,/+$,,'}
+}
 if not if(test -d $local_path)
     perm_redirect $req_path^'/'