Project

General

Profile

LigHTTPd $POST_DATA like $QUERY_STRING for Bash

Added by ChaBra about 5 years ago

It'd be cool to support a variable pushed to Bash CGI (without perl/php etc) called $POST_DATA representing all the POST DATA in a request.


Replies (3)

RE: LigHTTPd $POST_DATA like $QUERY_STRING for Bash - Added by ChaBra about 5 years ago

Can't seem to, not sure how either. I've tried cat $1, catting /dev/stdin (missing) but it just blegh, doesn't work.

RE: LigHTTPd $POST_DATA like $QUERY_STRING for Bash - Added by ChaBra about 5 years ago

I got it working with the following:

if [ "${REQUEST_METHOD}" = "POST" ] && [ ! -z "${CONTENT_LENGTH}" ]; then
read -n ${CONTENT_LENGTH} POST_DATA
fi

    (1-3/3)