+ SERVER_PROTOCOL="${SERVER_PROTOCOL%${CR}}"
+ PATH_INFO="$(HEX_DECODE "${REQUEST_URI%\?*}" |PATH)"
+ [ "${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
+ 'Content-Length: '*) CONTENT_LENGTH="${hl#*: }";;
+ 'Content-Type: '*) CONTENT_TYPE="${hl#*: }";;
+ esac
+ cgilite_headers="${cgilite_headers}${hl}${BR}"
+ done
+
+ export REMOTE_ADDR SERVER_NAME SERVER_PORT REQUEST_METHOD REQUEST_URI SERVER_PROTOCOL \
+ PATH_INFO QUERY_STRING CONTENT_TYPE CONTENT_LENGTH
+
+ # Try to serve multiple requests, provided that script serves a
+ # Content-Length header.
+ # Without Content-Length header, connection will terminate after
+ # script.
+
+ cgilite_status='200 OK'; cgilite_response=''; cgilite_cl="Connection: close${CR}${BR}";
+ . "$0" | while read -r l; do case $l in
+ Status:*)
+ cgilite_status="${l#Status: }";;
+ Content-Length:*)
+ cgilite_cl=""
+ cgilite_response="${cgilite_response:+${cgilite_response}${BR}}${l}";;
+ Connection:*)
+ cgilite_cl="${l}${BR}";;
+ $CR) printf '%s %s\r\n%s%s\r\n' \
+ 'HTTP/1.1' "${cgilite_status%${CR}}" \
+ "${cgilite_response}${cgilite_response:+${BR}}" "${cgilite_cl}"
+ cat || kill $$
+ [ "${cgilite_cl#Connection}" = "${cgilite_cl}" ]; exit;;
+ *) cgilite_response="${cgilite_response:+${cgilite_response}${BR}}${l}";;
+ esac; done || exit 0;
+ (sleep $cgilite_timeout && kill $$) & cgilite_watchdog=$!
+ done
+ kill $cgilite_watchdog
+ exit 0