From 1f1b81d3613914df56b3502aa79896ca2d9ca551 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 2 Aug 2018 13:51:17 +0200 Subject: [PATCH] independence from GNU `sed`, set CR and BR without forking subshell --- cgilite.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cgilite.sh b/cgilite.sh index 996fe9d..e0d4b93 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -22,8 +22,9 @@ # set -o posix # ksh, not portable setopt -o OCTAL_ZEROES 2>&- -BR="$(printf '\n')" -CR="$(printf '\r')" +CR=" " +BR=' +' cgilite_timeout=2 HEADER(){ @@ -70,7 +71,7 @@ if [ -z "$REQUEST_METHOD" ]; then 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]+')" -- 2.39.2