X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=cgilite.sh;h=76c91b2c05dd98c4b1bc5410c0eec250f5eb7a4c;hb=c4ba9cc2baf2fb79323279203b4e1694100ecabe;hp=2193e29ff90069b181db9475c439c89f34e5f529;hpb=5038774f89b33ecd03e407898e9d57d38245b5bb;p=cgilite diff --git a/cgilite.sh b/cgilite.sh index 2193e29..76c91b2 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -85,6 +85,12 @@ HEX_DECODE(){ # will be copied to the output literally while [ "$in" ]; do + [ "$pfx" ] || case $in in + [0-9a-fA-F][0-9a-fA-F]*):;; + ?*) out="${out}${in%%"${in#?}"}" + in="${in#?}"; continue;; + esac + case $in in "$pfx"[0-9a-fA-F][0-9a-fA-F]*) in="${in#${pfx}}";; \\*) in="${in#?}"; out="${out}\\\\"; continue;; @@ -264,7 +270,7 @@ HEADER(){ str="${str#*${BR}${1}: }" printf %s "${str%%${BR}*}" else - local var="HTTP_$(printf %s "$1" |tr a-z- A-Z-)" + local var="HTTP_$(printf %s "$1" |tr a-z- A-Z_)" eval "[ \"\$$var\" ] && printf %s \"\$$var\" || return 1" # eval "printf %s \"\$HTTP_$(printf %s "${1}" |tr a-z A-Z |tr -c A-Z _)\"" fi @@ -307,6 +313,7 @@ URL(){ \&*) out="${out}%26"; str="${str#?}";; \"*) out="${out}%22"; str="${str#?}";; \'*) out="${out}%27"; str="${str#?}";; + \`*) out="${out}%60"; str="${str#?}";; \?*) out="${out}%3F"; str="${str#?}";; \#*) out="${out}%23"; str="${str#?}";; \[*) out="${out}%5B"; str="${str#?}";;