Re:Sherver: Bash lightweight web server
by prussian on Wednesday December 22, 2021 @07:26AM
(#29648326)
Someone 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/uti...
Re:Sherver: Bash lightweight web server
by bluetomcat on Wednesday December 22, 2021 @07:38AM
(#29648435)
Jokingly, "sudo service apache2 start" may also be considered pure Bash :-)
Re:Sherver: Bash lightweight web server
by fragbait65 on Wednesday December 22, 2021 @07:41AM
(#29648478)
Exactly!
Re:Sherver: Bash lightweight web server
by fragbait65 on Wednesday December 22, 2021 @07:35AM
(#29648404)
I 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.
Re:Sherver: Bash lightweight web server
by prussian on Wednesday December 22, 2021 @07:41AM
(#29648473)
Here: 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.
Re:Sherver: Bash lightweight web server
by tyingq on Wednesday December 22, 2021 @09:08AM
(#29649450)
Bash 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
Re:Sherver: Bash lightweight web server
by junon on Wednesday December 22, 2021 @07:51AM
(#29648583)
~~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.
Re:Sherver: Bash lightweight web server
by rzzzt on Wednesday December 22, 2021 @08:02AM
(#29648737)
/dev/tcp is a Bash construct (mentioned as "pseudo-device file" in the manual): https://tldp.org/LDP/abs/html/devref1.html
Re:Sherver: Bash lightweight web server
by junon on Wednesday December 22, 2021 @08:07AM
(#29648784)
Oh 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 :)
There’s always https://github.com/cemeyer/httpd.sh .
Definitely not “pure”.