Live data from Hacker News

Shinatra – A simple bash web server

github.com

31–37 of 37 posts

Re: Shinatra – A simple bash web server

#31

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 ?

It was my understanding that you cannot change the host or port when invoking SimpleHTTPServer that way.

Re: Shinatra – A simple bash web server

#32

Many 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…

ngrep port 80 works

Re: Shinatra – A simple bash web server

#33

I 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

#34

I 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?

I didn't know about netcat before, so I'd draw the line exactly here :)

Re: Shinatra – A simple bash web server

#35
post #2

not 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

#36
post #2

not 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/ .

Thank you! I've been searching for something like that.

Re: Shinatra – A simple bash web server

#37

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 ?

[deleted]
Post reply on HN