Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
http server
# bash one-liner to run a simple (and possibly non-compliant) http server
ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\n\r\n<html><body><h1>Test page</h1></body></html>"'
# more comprehensive version that sets Content-Type and Content-Length
CONTENT='<html><body><h1>Test page</h1></body></html>'; ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: '${#CONTENT}'\r\n\r\n'$CONTENT'"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.