swerc

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

commit 8d55905164b9c77a820b281ca85e4af8e437c4b2
parent 4410cbb48b47ebedb129095fa42342a1a3fcc3e8
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Sun,  4 Jan 2009 23:21:55 +0100

Simplify and optimize some of the canonical-url-redirections.
Diffstat:
Mbin/werc.rc | 23++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/bin/werc.rc b/bin/werc.rc @@ -192,12 +192,16 @@ if(~ $REQUEST_METHOD POST) { login_user } -if(! ~ $args '') { - if(~ $args($#args) 'index') - perm_redirect `{echo $req_path | sed 's,/index$,/,'} - - pageTitle=`{echo $args | sed -e 's/ / - /g' -e 's/_/ /g'} -} +if(! ~ $#args 0) + pageTitle=`{ echo $args|sed -e 's/ / - /g' -e 's/_/ /g' } + +if(~ $req_path '/index') + perm_redirect `{echo $req_path | sed 's,/index$,/,'} + +if(~ $local_path */) + local_path=$local_path^'index' +if not if(test -d $local_path) + perm_redirect $req_path^'/' p=() cd $sitedir @@ -231,13 +235,6 @@ if(~ $pageTitle '') if not pageTitle=$"pageTitle^' | '^$"siteTitle^' '^$"siteSubTitle - -if(test -d $local_path) { - if(! ~ $local_path */) - perm_redirect $req_path^'/' - local_path=$local_path^'index' -} - select_handler if(! ~ $#debug 0)