hpost: fix multipart/form variable name mangeling when field value contains newlines

com='MH3U
pic unrelated
' hpost -u ... -m post com:$com

resulted in wrong field name like:

--HJBOUNDARY
 Content-Disposition: form-data; name="com pic unrelated"

 MH3U
 pic unrelated
This commit is contained in:
cinap_lenrek 2014-11-15 23:51:01 +01:00
parent 62f5818481
commit 4cd03abefe

View file

@ -58,7 +58,7 @@ fn menc {
f=$1
cr=`{echo x | tr x \015}
for(i in $at){
k=`{sed 's!:.*$!!' /env/i}
k=`{sed 's!:.*$!!; q' /env/i}
echo '--'$"f$"cr
echo 'Content-Disposition: form-data; name="'$"k'"'$"cr
echo $"cr
@ -66,7 +66,7 @@ fn menc {
sed 's!^[^:]+:!!' /env/i
}
for(i in $af){
k=`{sed 's!@.*$!!' /env/i}
k=`{sed 's!@.*$!!; q' /env/i}
v=`{sed 's!^[^@]+@!!' /env/i}
t=`{file -m $v}
n=`{basename $v}