4 ms·
It is a socat server, not bash. Basically a bash script calling socat. Definitely not “pure”.
by medv 5y ago
It is a socat server, not bash. Basically a bash script calling socat.
Definitely not “pure”.
- prussian 5y agoSomeone beat me to it. When I think of pure bash, I don't really think of invoking anything that isn't a builtin or a grammatical feature of bash. If socat is fair-play, almost anything you can spawn on a shell should count then. edit: on top of that, I already found a perl script utility in the repo: https://github.com/remileduc/sherver/blob/master/scripts/utils/mimetype https://github.com/remileduc/sherver/blob/master/scripts/uti...
- fragbait65 5y agoI think I'll just write something similar and wrap Apache with a shell scrip, claim that it's a web server written in bash, post it here and see what reaction I get, just for shits and giggles.
- prussian 5y agoHere: https://github.com/remileduc/sherver/issues/1 https://github.com/remileduc/sherver/issues/1 that way you can have HTTP/1.1 support even with arbitrary output lengths. I was planning on sending this to the linked repo so the owner doesn't need to use HTTP/1.0. EDIT: changed link to the github issue I created with inlined utility.
- bluetomcat 5y agoJokingly, "sudo service apache2 start" may also be considered pure Bash :-)
- fragbait65 5y agoExactly!
- junon 5y ago~~Right. "Pure" bash would mean they somehow got sockets working in the scripting language itself, which is not possible unless you're on a system with `/dev/tcp` (which isn't many these days).~~ I am wrong! See response.
- rzzzt 5y ago/dev/tcp is a Bash construct (mentioned as "pseudo-device file" in the manual): https://tldp.org/LDP/abs/html/devref1.html https://tldp.org/LDP/abs/html/devref1.html
- junon 5y agoOh huh, TIL it's only a Bash thing. I stand corrected - I thought it was a Linux thing that was removed for security reasons. Thanks for correcting me :)
- tyingq 5y agoBash can't do listen sockets, so I don't think a pure bash web server is possible. You can make an "pure" gawk web server, though it works terribly https://gist.github.com/willurd/5720255#gistcomment-3143007 https://gist.github.com/willurd/5720255#gistcomment-3143007
- deleted 5y ago[deleted]
- dang 5y agoOk, we've impured the title above.
- loeg 5y agoThere’s always https://github.com/cemeyer/httpd.sh https://github.com/cemeyer/httpd.sh .