Friday, November 5, 2010

Mini one page web server by using netcat (nc)

It will be helpful for debugging requests. You need bash and nc.
For some reasons debian and ubuntu have different net cat's version with different syntax:
- debian:
while echo -e "HTTP/1.0 200 OK\nContent-Type: text/html\n\n" | netcat -v -v -q 1 -lp 60000; do echo ""; done

- ubuntu:
while echo -e "HTTP/1.0 200 OK\nContent-Type: text/html\n\n" | netcat -lv 60000; do echo ""; done

To test it use command: netcat localhost 60000

No comments:

Post a Comment