bash web server

Dev tools

web server

SHOW HN2022

224points
97comments
#237of 2,570 in 2022
Top 10%of 2022 by points

How HN took it

CuriousMostly questions and neutral comments

5 positive, 13 neutral or asking, 1 mixed, 7 critical, out of 26 comments about the project. Thread score -0.03.

Execution: 1 for, 3 againstIdea: 3 for, 0 againstDesign: 0 for, 1 againstDocs: 1 for, 0 againstPerformance: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clever use of bash builtins and techniques

    From 3 comments
    • Regarding the creation and removal of a tempfile (line 72 & 85): ``` local tmpFile="$ {TMPDIR:-/tmp/bash-web-server.$$}" # ... rm "$tmpFile" ``` To avoid collisions when the PID…
      pdkl95 on HN
    • Definitely scary, but I love things like this. Takes a lot of creativity! There was a post a bit ago that had a one liner for a basic web server using net cat: ``` while : ; do…
      spicybright on HN
    • I like those unorthodox, against-cargo-cult approaches. Thx!
      mro_name on HN

Objections

  • Bash is a poor language for projects like this and hard to maintain

    From 3 comments
    • I used to see value in scripts like this, but often these Bash scripts do quite the opposite. It may be readable for those that only know Bash, but you'll probably be happier if…
      encryptluks2 on HN
    • The other day I wrote this bash code after getting frustrated with the password generators available to me, just so I had something to use right in the shell:…
      pmarreck on HN
    • I get it. The challenging part is fun. You can learn all the corner cases, the clever bash-isms, and then show off. But the code you end up with is essentially unmaintainable,…
      pmarreck on HN
  • Single-process design is slow and scales poorly

    From 2 comments
    • I follow some projects from you on github. Keep up the work! Falling back to something like socat, would destroy the whole idea behind it. I think the best way is patching accept…
      dzove855 on HN
    • Well benchmarking it os currently not possible. I will try it in a few days and provide some benchmarks.
      dzove855 on HN

Requests

  • Benchmarks of performance

    From 1 comment
    • I wonder if it's faster than the same thing in javascript...
      nottorp on HN

Questions

  • How the accept builtin and fd handling work

    From 2 comments
    • This script taught me a few things! Since it's kind of impossible to google, what does this construct mean? ``` while :; do ``` It's clearly a while true loop, but why does an…
      sillysaurusx on HN
    • Well that's true. I took me two hours to get this done. Since accept was not clear at the beginning. But it will be cleaner in the future, i'm still not convinced how it works…
      dzove855 on HN

Alternatives named

  • python3 -m http.server

    From 1 comment
    • Ha, this is more like a puzzle than anything - trying to implement a protocol in a highly restrictive environment. For anyone looking for an easy way to spin up a command line…
      umvi on HN
  • darkhttpd

    From 1 comment
    • I use darkhttpd from time to time, it supports streaming: https://github.com/emikulic/darkhttpd
      pcranaway on HN
  • busybox httpd

    From 1 comment
    • If you have access to a busybox executable, it comes with a quite capable little httpd with /cgi-bin/ for CGI apps. If you have a wifi router, the web interface might be running…
      0xbadcafebee on HN
  • sthttpd

    From 1 comment

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/29794979)