Added double-quotes on echo commands and LN node connect string

This commit is contained in:
kexkey
2019-01-15 09:49:22 -05:00
committed by kexkey
parent 6bbe5ac69b
commit 0c86522fdf
20 changed files with 119 additions and 85 deletions

View File

@@ -49,7 +49,7 @@ main()
fi
# line=content-length: 406
case "${line}" in *[cC][oO][nN][tT][eE][nN][tT]-[lL][eE][nN][gG][tT][hH]*)
content_length=$(echo ${line} | cut -d ':' -f2)
content_length=$(echo "${line}" | cut -d ':' -f2)
trace "[main] content_length=${content_length}";
;;
esac

View File

@@ -8,11 +8,12 @@ response_to_client()
local response=${1}
local returncode=${2}
local length=$(echo -n "${response}" | wc -c)
([ -z "${returncode}" ] || [ "${returncode}" -eq "0" ]) && echo -ne "HTTP/1.1 200 OK\r\n"
[ -n "${returncode}" ] && [ "${returncode}" -ne "0" ] && echo -ne "HTTP/1.1 400 Bad Request\r\n"
echo -en "Content-Type: application/json\r\nContent-Length: ${#response}\r\n\r\n${response}"
echo -en "Content-Type: application/json\r\nContent-Length: ${length}\r\n\r\n${response}"
# Small delay needed for the data to be processed correctly by peer
sleep 0.2s