Exit after doing a perm redirect, and some small style fixes

This commit is contained in:
Uriel 2008-07-08 00:23:00 +02:00
parent a010ba25eb
commit 64dc191a6d

View file

@ -125,7 +125,7 @@ fn genbody {
if not if(~ $#blogDirs 0) { if not if(~ $#blogDirs 0) {
#echo 'Status: 404 Not Found\n\n' # should go before starting to print body #echo 'Status: 404 Not Found\n\n' # should go before starting to print body
template.awk inc/404.tpl | rc $rcargs template.awk inc/404.tpl | rc $rcargs
dprint 'NOT FOUND: '$SERVER_NAME^$REQUEST_URI^' - '^$"HTTP_REFERER dprint 'NOT FOUND: '$SERVER_NAME^$REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$HTTP_USER_AGENT
} }
if(! ~ $#blogDirs 0) { if(! ~ $#blogDirs 0) {
@ -147,11 +147,11 @@ fn genbody {
. etc/initrc . etc/initrc
fn dprint { fn dprint {
echo $* >[1=2] echo $* >[1=2]
} }
if(! ~ $#debug 0) { if(! ~ $#debug 0) {
echo $SERVER_NAME^'/'^$REQUEST_URI - >[1=2] echo $SERVER_NAME^'/'^$REQUEST_URI - >[1=2]
} }
if (! ~ $args '') { if (! ~ $args '') {
@ -178,15 +178,16 @@ for (i in ('' $args)) {
} }
fn perm_redirect { fn perm_redirect {
echo 'Status: 301 Moved Permanantly echo 'Status: 301 Moved Permanantly
Location: '^$1^' Location: '^$1^'
' '
exit
} }
# Redirections and other preprocessing # Redirections and other preprocessing
if (~ $#redirectPermanent 1) if (~ $#redirectPermanent 1)
perm_redirect $"redirectPermanent perm_redirect $"redirectPermanent
if not if (~ $#redirectPermanent 2) { if not if (~ $#redirectPermanent 2) {
# Experimental regexp sub-based redirect, probably should find a nicer interface # Experimental regexp sub-based redirect, probably should find a nicer interface