wok-6.x diff busybox/stuff/httpd_helper.sh @ rev 10847
busybox/httpd_helper.sh: normalized variable names
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Jun 11 17:53:28 2011 +0200 (2011-06-11) |
parents | ba0a532b57c4 |
children | f564323fc5a4 |
line diff
1.1 --- a/busybox/stuff/httpd_helper.sh Wed Apr 13 13:39:37 2011 +0200 1.2 +++ b/busybox/stuff/httpd_helper.sh Sat Jun 11 17:53:28 2011 +0200 1.3 @@ -75,7 +75,7 @@ 1.4 names="" 1.5 IFS="&" 1.6 for i in $2 ; do 1.7 - var=${i%%=*} 1.8 + var=${i%%[^A-Za-z_0-9]*} 1.9 case " $names " in 1.10 *\ $var\ *) eval cnt=\$${1}_${var}_count ;; 1.11 *) cnt=0 1.12 @@ -140,6 +140,7 @@ 1.13 case "$line" in 1.14 *Content-Disposition*) 1.15 name=$(echo $line | sed 's/.* name="\([^"]*\)".*$/\1/') 1.16 + name=${name%%[^A-Za-z_0-9]*} 1.17 case "$line" in 1.18 *filename=*) filename=$(echo $line | sed 's/.* filename="\([^"]*\)".*$/\1/') ;; 1.19 esac ;; 1.20 @@ -156,13 +157,16 @@ 1.21 eval FILE_${name}_size=$(stat -c %s $tmp) 1.22 eval FILE_${name}_type=$type 1.23 elif [ -n "$name" ]; then 1.24 - eval var=\$POST_${name} 1.25 + eval cnt=\$POST_${name}_count 1.26 + cnt=$(($cnt + 1)) 1.27 + eval var=\$POST_${name}_$cnt 1.28 while read line; do 1.29 [ -n "$var" ] && var="$var 1.30 " 1.31 - var="$line" 1.32 + var="$var$line" 1.33 done 1.34 - eval POST_${name}="\$var" 1.35 + eval POST_${name}_$cnt="\$var" 1.36 + eval POST_${name}_count=$cnt 1.37 case " $POST__NAMES " in 1.38 *\ $name\ *) ;; 1.39 *) POST__NAMES="$POST__NAMES $name"