@@ -7,10 +7,14 @@ urlencode() {
77 echo " $1 " | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- " " | cut -c 3-
88}
99
10- # ---------------------------------------------------------------------------
10+ countBytes () {
11+ echo " $1 " | wc -c | xargs
12+ }
13+
1114fixLinks () {
1215 sed -i ' ' -e " s@/webman/3rdparty/synoedit/@../@" $1
1316}
17+ # ---------------------------------------------------------------------------
1418
1519if [ ! -d test ]; then
1620 echo " Preparing test folder.."
@@ -46,18 +50,18 @@ fixLinks test/file2.html
4650
4751export REQUEST_METHOD=POST
4852export CONTENT_TYPE=" application/x-www-form-urlencoded"
49- # echo "jax=true&app=dnscrypt-proxy&file=domains-whitelist.txt&fileContent=google.com%0A" | wc -c
50- export CONTENT_LENGTH=81
51- # data="$(urlencode "$(cat test/dnscrypt-proxy/target/var/domains-whitelist.txt)")"
52- data=" $( urlencode " google.com" ) "
53+ data=" ajax=true&app=dnscrypt-proxy&file=domains-whitelist.txt&fileContent=$( urlencode ' google.com' ) "
54+ numOfBytes=$( countBytes " $data " )
55+ export CONTENT_LENGTH=$numOfBytes
5356# echo "$data" > post.txt
5457
5558# echo "ListenAddresses=0.0.0.0%3A1053+&ServerNames=cloudflare+google+ " | ./index.cgi --dev
56- echo " ajax=true&app=dnscrypt-proxy&file=domains-whitelist.txt&fileContent= $data " | ./index.cgi --dev | tail -n +5 > test/post.html
59+ echo " $data " | ./index.cgi --dev | tail -n +5 > test/post.html
5760fixLinks test/post.html
5861
5962export REQUEST_METHOD=POST
6063export CONTENT_TYPE=" application/x-www-form-urlencoded"
61- # echo "ajax=true&action=true&app=dnscrypt-proxy" | wc -c
62- export CONTENT_LENGTH=41
63- echo " ajax=true&action=true&app=dnscrypt-proxy" | ./index.cgi --dev | tail -n +5 > test/action.html
64+ data=" ajax=true&action=true&app=dnscrypt-proxy"
65+ numOfBytes=$( countBytes " $data " )
66+ export CONTENT_LENGTH=$numOfBytes
67+ echo " $data " | ./index.cgi --dev | tail -n +5 > test/action.html
0 commit comments