This reminds me a lot of Certbot's use of the Python SimpleHTTPServer: $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler); s.serve_forever()"
Out of curiosity. What is wrong with: python -m SimpleHTTPServer ?
Shinatra – A simple bash web server
31–37 of 37 posts
Re: Shinatra – A simple bash web server
#32Many people here fail to realize, this is an excellent debugging server. I used to have a server to print out the body and headers of requests when building an api to make sure things were going (the right headers and request body) out as expected https://github.com/minhajuddin/httpdebug/blob/master/app.go . This is a much lighter and nicer version. This is going into my ~/bin/httpdebug :) You can try sending a few c…
Re: Shinatra – A simple bash web server
#33I think the point here is to demonstrate that one might think that web servers are mystical beasts (true) but after all, they "just" return a HTTP header and some content.
Re: Shinatra – A simple bash web server
#34I think the point here is to demonstrate that one might think that web servers are mystical beasts (true) but after all, they "just" return a HTTP header and some content.
It doesn't demonstrate that very well, then. This simply delegates all of the basic server responsibilities to netcat. Where do you draw the line between 'bash web server' and simply invoking another program?
Re: Shinatra – A simple bash web server
#35not to be that guy, but that's 1. hardly a web server 2. hardly pure bash of course writing a server of anything in pure bash is a tad bit difficult, as opposed to a client - bash can connect(), but can't bind() / listen() nor accept() unless, of course, you use something to expose these syscalls, but that opens a whole another can of worms...
Someone has actually went that far: http://ctypes.sh/.
Re: Shinatra – A simple bash web server
#36not to be that guy, but that's 1. hardly a web server 2. hardly pure bash of course writing a server of anything in pure bash is a tad bit difficult, as opposed to a client - bash can connect(), but can't bind() / listen() nor accept() unless, of course, you use something to expose these syscalls, but that opens a whole another can of worms...
> but that opens a whole can of worms Someone has actually went that far: http://ctypes.sh/ .
Re: Shinatra – A simple bash web server
#37This reminds me a lot of Certbot's use of the Python SimpleHTTPServer: $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler); s.serve_forever()"
Out of curiosity. What is wrong with: python -m SimpleHTTPServer ?