# set -o posix # ksh, not portable
setopt -o OCTAL_ZEROES 2>&-
-BR="$(printf '\n')"
-CR="$(printf '\r')"
+CR="\r"
+BR='
+'
cgilite_timeout=2
HEADER(){
kill $cgilite_watchdog
PATH_INFO="$(HEX_DECODE "${REQUEST_URI%\?*}")"
QUERY_STRING="${REQUEST_URI#*\?}"
- cgilite_headers="$(sed -u '/^\r\?$/q')"
+ cgilite_headers="$(while read -r hl; do [ "${hl%${CR}}" ] && printf '%s\n' "$hl" || break; done )"
HTTP_CONTENT_LENGTH="$(HEADER Content-Length |grep -xE '[0-9]+')"