Date created: Tuesday, March 17, 2020 2:54:25 PM. Last modified: Monday, October 14, 2024 2:35:02 PM

HTTP Servers

Bash:

#!/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

 

Python 3:

python -m http.server
python -m http.server 8080
python -m http.server 8080 --bind 192.168.0.123

 

Python 2:

python -m SimpleHTTPServer

 


Previous page: Get IP on CLI
Next page: 'iperf' - Notes