Bugfix: last post element was omitted due to recent changes
authorpaul <paul@plutz.net>
Mon, 10 Oct 2016 12:48:41 +0000 (12:48 +0000)
committerpaul <paul@plutz.net>
Mon, 10 Oct 2016 12:48:41 +0000 (12:48 +0000)
svn path=/trunk/; revision=37

cgi.sh

diff --git a/cgi.sh b/cgi.sh
index 7fa5416..7b5651a 100755 (executable)
--- a/cgi.sh
+++ b/cgi.sh
@@ -38,7 +38,13 @@ if [ "$REQUEST_METHOD" = POST -a "$HTTP_CONTENT_LENGTH" -gt 0 ]; then
   # parse HTTP POST string
   debug "== CGI DATA: POST =="
   head -c "$HTTP_CONTENT_LENGTH" \
-  | sed -un '2q; 1{s;&;\n;g; p}' \
+  | sed -un '
+    2q
+    1{
+      s;&;\n;g;
+      a
+      p
+    }' \
   | while read query; do
     key="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\1:')"
     val="$(printf %s "$query" |sed -r 's:^([\.a-zA-Z0-9_-]+)=(.*)$:\2:')"