]> git.plutz.net Git - shcgi/commitdiff
improved debugging output
authorpaul <paul@plutz.net>
Sun, 2 Aug 2015 23:49:14 +0000 (23:49 +0000)
committerpaul <paul@plutz.net>
Sun, 2 Aug 2015 23:49:14 +0000 (23:49 +0000)
svn path=/trunk/; revision=12

cgi.sh

diff --git a/cgi.sh b/cgi.sh
index e994daa99d2ff50d68eeaab5703c2ec8a01d611d..439773015f82e103c2459e32b5059faa8e401205 100755 (executable)
--- a/cgi.sh
+++ b/cgi.sh
@@ -40,14 +40,13 @@ cgi_post() {  # parse HTTP POST string
     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;')")"
-    if [ -n "${_POST[$key]}" ]; then
+    n=''
+    if [ -n "${_POST[$key$n]}" ]; then
       n=0
       while [ -n "${_POST[$key$n]}" ]; do n=$(($n + 1)); done
-      _POST[$key$n]="$value"
-    else
-      _POST[$key]="$value"
     fi
-    debug "_POST[$key] => $value"
+    _POST[$key$n]="$value"
+    debug "_POST[$key$n] => $value"
   done
 }