Bash HTTP server
15 Jan 20195 lines code make a HTTP server 1
#!/usr/bin/env bash
RESPONSE="HTTP/1.1 200 OK\r\nConnection: keep-alive\r\n\r\n${2:-"OK"}\r\n"
while { echo -en "$RESPONSE"; } | nc -l "${1:-8080}"; do
echo "================================================"
done
also like
RESPONSE="HTTP/1.1 200 OK\r\nConnection: keep-alive\r\n\r\n${2:-"conned"}\r\n"
while true ; do
echo -en "$RESPONSE" | nc -l "${1:-8111}";
done
Other one avleen/bashttpd, it is using netcat
2 .