# parse HTTP GET string
debug "== CGI DATA: GET =="
printf '%s\n' "$QUERY_STRING" |tr '&' '\n' |while read query; do
- key="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\1:')"
- val="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\2:')"
+ key="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\1:')"
+ val="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\2:')"
_GET[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
debug "_GET[$key] => $val"
done
# parse HTTP POST string
debug "== CGI DATA: POST =="
sed -u 1q |tr '&' '\n' |while read query; do
- key="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\1:')"
- val="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\2:')"
+ key="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\1:')"
+ val="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\2:')"
value="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g;')")"
n=''
if [ -n "${_POST[$key$n]+x}" ]; then
cgi_refdata() { # Parse GET data from referer
debug "== CGI DATA: REFERER =="
printf '%s\n' "${HTTP_REFERER#*\?}" |tr '&' '\n' |while read query; do
- key="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\1:')"
- val="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\2:')"
+ key="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\1:')"
+ val="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\2:')"
_REF[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
debug "_REF[$key] => $val"
done
cgi_cookie() { # Parse GET data from referer
debug "== CGI DATA: COOKIE =="
printf '%s\n' "$HTTP_COOKIE" |tr ';' '\n' |while read query; do
- key="$(printf %s "$query" |sed -r 's:^ *([a-zA-Z0-9_-]+)=(.*)$:\1:')"
- val="$(printf %s "$query" |sed -r 's:^ *([a-zA-Z0-9_-]+)=(.*)$:\2:')"
+ key="$(printf %s "$query" |sed -r 's:^ *([\.a-zA-Z0-9_-]+)=(.*)$:\1:')"
+ val="$(printf %s "$query" |sed -r 's:^ *([\.a-zA-Z0-9_-]+)=(.*)$:\2:')"
_COOKIE[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
debug "_COOKIE[$key] => $val"
done