Hasty Briefsbeta

Bilingual

TIL: You can make HTTP requests without curl using Bash /dev/TCP

3 hours ago
  • #networking
  • #docker
  • #bash
  • Use bash's built-in /dev/tcp redirection to send HTTP requests without curl or wget.
  • Open a TCP socket with exec 3<>/dev/tcp/host/port and write the HTTP request manually.
  • Include Connection: close header to avoid hanging; add other headers as needed.
  • The /dev/tcp feature is bash-specific, not POSIX, and requires net redirections enabled at compile time.
  • It only works for plain HTTP, not HTTPS, and relies on DNS resolution and network reachability.