Created
July 29, 2016 11:49
-
-
Save stretchkennedy/7c594eb167971c9f7e9886b5568801b1 to your computer and use it in GitHub Desktop.
http server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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