Skip to content

Instantly share code, notes, and snippets.

@p120ph37
Created October 14, 2014 16:31
Show Gist options
  • Save p120ph37/49bf890ee37087d37114 to your computer and use it in GitHub Desktop.
Save p120ph37/49bf890ee37087d37114 to your computer and use it in GitHub Desktop.
Minimal webserver in Perl.
socket$s,2,1,6;bind$s,pack+snN3,2,8080;listen$s,1;while(accept$c,$s){<$c>=~/\/(\S+)/;open$f,$1;print$c(<$f>);close$c}
@p120ph37
Copy link
Author

run using perl -e'...'

Don't expect it to be efficient or secure - for example directory traversal is allowed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment