werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

commit 02a3930d9d0d63393415f21d9fcd1f94c73ad8da
parent 35eda0ff53038d604db8ca39bedfaf95b45bb5e5
Author: Nuno Sempere <nuno.semperelh@protonmail.com>
Date:   Sat,  5 Nov 2022 18:45:20 +0000

tweak: move variable definitions before headers

so that headers can have access to the relative request
path

Diffstat:
Mbin/werc.rc | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/bin/werc.rc b/bin/werc.rc @@ -40,6 +40,12 @@ fn werc_exec_request { # could be useful for debugging, but # otherwise not worth it sitedir=$sitesdir/$site + req_path=`{echo -n $REQUEST_URI | sed 's/\?.*//; s!//+!/!g; s/%5[Ff]/_/g; s/'^$forbidden_uri_chars^'//g; s/\.\.*/./g; 1q'} + req_url=$base_url^$req_path + local_path=$sitedir$req_path + local_file='' + ifs='/' { args=`{echo -n $req_path} } + headers=`{get_lib_file headers.tpl} master_template=`{get_lib_file default_master.tpl} current_date_time=`{date} @@ -47,12 +53,7 @@ fn werc_exec_request { # Note: $REQUEST_URI is not officially in CGI 1.1, but seems to be de-facto # Note: We only urldecode %5F->'_' because some sites (stackoverflow.com?) urlencode it in their links, # perhaps we should completel urldecode the whole url. - req_path=`{echo -n $REQUEST_URI | sed 's/\?.*//; s!//+!/!g; s/%5[Ff]/_/g; s/'^$forbidden_uri_chars^'//g; s/\.\.*/./g; 1q'} - req_url=$base_url^$req_path - local_path=$sitedir$req_path - local_file='' - ifs='/' { args=`{echo -n $req_path} } - + # Preload post args for templates where cgi's stdin is not accessible if(~ $REQUEST_METHOD POST) { load_post_args