Proper 404 for dirs too - swerc - anselm's simpler werc fork | |
git clone git://git.suckless.org/swerc | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit c60b22c95c6fcd35a5c13c37012b7d40bac8c0ad | |
parent 546b5f55efd1116a6e01df5e1f4d53d51cc70dc0 | |
Author: [email protected] <unknown> | |
Date: Fri, 16 Jan 2009 01:24:58 +0100 | |
Proper 404 for dirs too | |
Diffstat: | |
M bin/werc.rc | 8 ++++++-- | |
1 file changed, 6 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/bin/werc.rc b/bin/werc.rc | |
@@ -170,8 +170,12 @@ if(! ~ $#args 0) | |
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^'/' | |