What is httφ (httphi)?
mainhttφ is a heapless HTTP/1.1 router designed for environments where per-request allocations are unacceptable, such as microcontrollers. Unlike the standard net/http package which allocates a Request, header map, response buffer, and goroutine for every request, httφ performs these allocations once during the Router.Configure phase.
Key characteristics:
- Zero allocation during serving: Memory usage is fixed at configuration time and does not grow with load.
- Fixed resource limits: If no free exchanges are available, the
Handlemethod refuses the connection rather than allocating more memory. - Transport agnostic: The
Handlemethod accepts anio.ReadWriteCloser, allowing it to run over raw sockets,lnetoTCP stacks, or test pipes without requiring an OS listener or clock. - Parsing: Uses
httprawfor parsing.