swerc

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

commit 542b470ba728aa2f62928fb45370f4b1130d7cb5
parent b4893e7578ab376a8ae3d68eaf227952b39956e4
Author: uriel@vm41.cat-v.org <unknown>
Date:   Wed, 10 Jun 2009 02:58:36 +0200

Urldecode '_' (ie., %5F) in request paths to make stackoverflow.com links happy.
Diffstat:
Mbin/werc.rc | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/werc.rc b/bin/werc.rc @@ -41,7 +41,9 @@ fn werc_exec_request { current_date_time=`{date} # Note: $REQUEST_URI is not officially in CGI 1.1, but seems to be de-facto - req_path=`{echo -n $REQUEST_URI | sed 's/\?.*//; s!//+!/!g; s/'^$forbidden_uri_chars^'//g; s/\.\.*/./g; 1q'} + # 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 ifs='/' { args=`{echo -n $req_path} }