TIL: You can make HTTP requests without curl using Bash /dev/TCP(mareksuppa.com)
511 points by mrshu 1 day ago | 222 comments
tl;dr: Bash can open raw TCP sockets via `/dev/tcp/host/port`, letting you make basic HTTP requests with just `exec 3<>/dev/tcp/...` and `printf` — useful when you're stuck in a stripped-down container with no curl or wget. Caveats: it's not a real HTTP client (no TLS, redirects, chunked encoding, etc.), requires `Connection: close` to avoid hangs, is bash-only (not POSIX), and depends on bash being compiled with `--enable-net-redirections`.
HN Discussion:
  • Nostalgic recollection of manually speaking protocols like HTTP/SMTP via telnet
  • Plan 9 offered this network-as-filesystem concept more elegantly and broadly
  • Confirms the technique works with practical demonstration against example.com
  • Article overstates the case; bash doesn't speak HTTP, and this shouldn't be used in production
  • Shares real-world use cases (container health checks, initramfs) validating the technique's usefulness