bugfix: allow empty query string
authorPaul Hänsch <paul@plutz.net>
Wed, 3 Jun 2020 09:14:32 +0000 (11:14 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 3 Jun 2020 09:14:32 +0000 (11:14 +0200)
cgilite.sh

index bee93d8..86ad280 100755 (executable)
@@ -77,7 +77,9 @@ if [ -z "$REQUEST_METHOD" ]; then
 
     SERVER_PROTOCOL="${SERVER_PROTOCOL%${CR}}"
     PATH_INFO="$(HEX_DECODE "${REQUEST_URI%\?*}" |PATH)"
-    QUERY_STRING="${REQUEST_URI#*\?}"
+    [ "${REQUEST_URI}" = "${REQUEST_URI#*\?}" ] \
+    && QUERY_STRING='' \
+    || QUERY_STRING="${REQUEST_URI#*\?}"
     cgilite_headers=''; while read -r hl; do
       hl="${hl%${CR}}"; [ "$hl" ] || break
       case $hl in