]> git.plutz.net Git - cgilite/blobdiff - cgi.sh
Bugfix: keep last post element without appending empty element
[cgilite] / cgi.sh
diff --git a/cgi.sh b/cgi.sh
index 7fa54166eb29c6ac9441290225486c33010f5246..206f32266029a35276852c4d68916fb526470eaa 100755 (executable)
--- a/cgi.sh
+++ b/cgi.sh
@@ -38,7 +38,7 @@ 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 's;&;\n;g; p; q' \
   | 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:')"