')"
}
-if [ "$1" = '--inetd' -a -z "$REQUEST_METHOD" ]; then
+if [ -z "$REQUEST_METHOD" -a -z "$SERVER_PROTOCOL" ]; then
+ # no webserver variables means we are running via inetd / ncat
+ # so use builtin web server
REMOTE_ADDR="${TCPREMOTEIP:-$NCAT_REMOTE_ADDR}"
SERVER_NAME="${TCPLOCALIP:-$NCAT_LOCAL_ADDR}"
SERVER_PORT="${TCPLOCALPORT:-$NCAT_LOCAL_PORT}"
cgilite_headers="$(sed -u '/^\r\?$/q')"
HTTP_CONTENT_LENGTH="$(HEADER Content-Length |grep -xE '[0-9]+')"
- HTTP_COOKIE="$(HEADER Cookie)"
export REMOTE_ADDR SERVER_NAME SERVER_PORT REQUEST_METHOD REQUEST_URI SERVER_PROTOCOL \
- PATH_INFO QUERY_STRING HTTP_CONTENT_LENGTH HTTP_COOKIE
+ PATH_INFO QUERY_STRING HTTP_CONTENT_LENGTH
- . "$0" |sed '1{s;^Status: ;HTTP/1.0 ;; t; iHTTP/1.0 200 OK\r
- }'
+ . "$0" |sed '1{s;^Status: ;HTTP/1.0 ;; t; s;^;HTTP/1.0 200 OK\r\n;;}'
exit $?
fi