swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 0eeef698dd1788465c09ba9c6989cb6096483ae5
parent 768a1f8706905d6d2a78bf120ea0771e7e4ad8b5
Author: uriel@soma <unknown>
Date:   Mon, 23 Feb 2009 05:25:08 +0000

Allow : and , in urls, but strip them and redirect them if they are last char. This fixes some autogenerated links in other sites that will include . and , if they follow an url in an email for example.
Diffstat:
Mbin/werc.rc | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/werc.rc b/bin/werc.rc @@ -6,7 +6,7 @@ . ./fltr_cache.rc cd .. -forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.]' +forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.,:]' # Expected input: ls -F style, $sitedir/path/to/files/ # <ls -F+x><symlink hack><Useless?><hiden files > @@ -58,8 +58,10 @@ fn werc_exec_request { if not # XXX: This redir might step on apps with synthetic dirs. perm_redirect `{echo $req_path|sed 's,/+$,,'} } + if not if(~ $req_path *'.' *',' *';' *':') + perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'} if not if(test -d $local_path) - perm_redirect $base_url^$req_path^'/' + perm_redirect $req_path^'/' if(! ~ $#args 0) pageTitle=`{ echo $args|sed -e 's/ / - /g' -e 's/_/ /g' }