summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Nelson <unixabg@gmail.com>2013-05-23 08:07:35 -0500
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-27 17:13:56 +0200
commit3c59c82e1dcaa19302eaf478a59a5c9ebc94cc52 (patch)
tree31cf32362f13928df2d3b50dc18808276b694634
parent9008de3f0be6d9fd778b345d8e40c2fd676ba3e8 (diff)
downloadvyos-live-build-3c59c82e1dcaa19302eaf478a59a5c9ebc94cc52.tar.gz
vyos-live-build-3c59c82e1dcaa19302eaf478a59a5c9ebc94cc52.zip
Improve reading of post data on l-b-cgi frontend.
-rwxr-xr-xfrontends/cgi/live-build-cgi10
1 files changed, 8 insertions, 2 deletions
diff --git a/frontends/cgi/live-build-cgi b/frontends/cgi/live-build-cgi
index 5a65bce89..dbc1ef53b 100755
--- a/frontends/cgi/live-build-cgi
+++ b/frontends/cgi/live-build-cgi
@@ -33,9 +33,15 @@ echo "Content-type: text/html"
echo
#QUERY_STRING=`cat /dev/stdin`
-QUERY_STRING=$(cat /dev/stdin)
+#QUERY_STRING=$(cat /dev/stdin)
+# If we are passed something then read it in.
+if [[ "$REQUEST_METHOD" = "POST" ]] && [[ "$CONTENT_LENGTH" -gt 0 ]]
+then
+ read -n $CONTENT_LENGTH POST_DATA <&0
+fi
+
# Translate parameters
-QUERY_STRING=$(echo "${QUERY_STRING}" | sed -e 's/%2F/\//g' -e 's/+/ /g' -e 's/%3B/;/g' -e 's/%7E/~/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%3D/=/g' -e 's/%2B/+/g')
+QUERY_STRING=$(echo "${POST_DATA}" | sed -e 's/%2F/\//g' -e 's/+/ /g' -e 's/%3B/;/g' -e 's/%7E/~/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%3D/=/g' -e 's/%2B/+/g')
# Debug the filtering string
# echo ${QUERY_STRING}