[Toybox] httpd: How is this supposed to be _used_?
Rob Landley
rob at landley.net
Sun Apr 14 06:53:33 PDT 2024
On 4/13/24 14:09, Oliver Webb via Toybox wrote:
> The first thing I ran into is that httpd doesn't do that by default,
> running "toybox httpd dist/" won't actually host those pages
> on localhost.
It's an inetd client:
https://en.wikipedia.org/wiki/Inetd
toybox netcat -s 127.0.0.1 -p 88888 -L httpd .
I've been meaning to come up with an actual inetd, and possibly lib/*.c plumbing
to do standalone servers, but nommu support and rate limiting incoming
connections and so on all go in a layer I haven't implemented yet and am not
interested in reproducing in multiple commands.
Genericizing the plumbing I've already got in netcat, but making it available
from individual commands, implies having a standard set of command line
utilities that get exposed in commands to specify address to bind to and port to
listen on and max simultaneous connections (including max per source IP) and
output inactivity timeout.... Possibly some sort of IPSERVER macro flung into
the option string, with a corresponding structure in TT and then a function I
call? Or maybe just stick with inetd so it's somebody else's problem...
I explain this here periodically, by the way:
http://lists.landley.net/pipermail/toybox-landley.net/2024-January/030000.html
In theory a tcpsvd was contributed to pending long ago, which kind of has the
od/hexdump/xxd problem of multiple implementations not sharing code (as I
periodically mention here, ala
http://lists.landley.net/pipermail/toybox-landley.net/2023-January/029410.html).
It's in the todo heap...
> "Why?": Looking at the source code and typing
> input into httpd, it wants input from stdin and seemingly outputs to
> stdout like a normal unix tool (which httpd is usually not).
As all inetd clients do, yes: nbd_server.c is another one. Lots of other things
(like the tftpd in pending, or dropbear) can work in inetd mode.
> Forgive me, but I'm going to compare this to busybox httpd.
You do you.
Rob
More information about the Toybox
mailing list