svn path=/trunk/; revision=20
[ -z "$HTTP_REFERER" ] && HTTP_REFERER="./"
[ -z "$HTTP_REFERER" ] && HTTP_REFERER="./"
-cgi_get() { # 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:')"
- _GET[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
- debug "_GET[$key] => $val"
- done
-}
+# 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:')"
+ _GET[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
+ debug "_GET[$key] => $val"
+done
-cgi_post() { # parse HTTP POST string
+if [ "$REQUEST_METHOD" = POST ]; then
+ # 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:')"
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:')"
_POST[$key$n]="$value"
debug "_POST[$key$n] => $value"
done
_POST[$key$n]="$value"
debug "_POST[$key$n] => $value"
done
cgi_refdata() { # Parse GET data from referer
debug "== CGI DATA: REFERER =="
cgi_refdata() { # Parse GET data from referer
debug "== CGI DATA: REFERER =="
- printf '%s\n' "$HTTP_REFERER" |cut -d'?' -f2- |tr '&' '\n' |while read query; do
+ 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:')"
_REF[$key]="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")"
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')")"
[ -r "$_DATA/local.opts" ] && . "$_DATA/local.opts"
. "$_EXEC/shcgi/cgi.sh"
[ -r "$_DATA/local.opts" ] && . "$_DATA/local.opts"
. "$_EXEC/shcgi/cgi.sh"
[ -x "$_EXEC/globals.sh" ] && . "$_EXEC/globals.sh"
[ -x "$_EXEC/globals.sh" ] && . "$_EXEC/globals.sh"