Skip to content

Instantly share code, notes, and snippets.

Created May 8, 2022
What would you like to do?
CGI script to echo a request

Put the script into /www/cgi-bin/ and make executable:

chmod +x /www/cgi-bin/

Then you can start a webserver e.g.:

busybox httpd -f -vv -p 8080 -h /www

Now you can send requests e.g. with curl or wget:

wget -O - -S -q  http://localhost:8080/cgi-bin/
CONTENT=$(cat -)
printf "Content-Length: ${#CONTENT}\r\n"
printf "Content-Type: text/html\r\n"
printf "\r\n"
printf "$CONTENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment