class

Hwaro::Services::DevHTTPServer

Inherits HTTP::Server < Reference < Object

The dev server's HTTP::Server, hardened against requests the stdlib refuses to parse.

HTTP::Request.from_io runs at the very top of HTTP::Server::RequestProcessor#process — outside that method's rescue IO::Error and outside the per-handler 500 rescue — and it parses Content-Length eagerly and strictly. So Content-Length: abc, 0x5, a value past UInt64, or two Content-Length headers that disagree raise ArgumentError straight out of the fiber HTTP::Server#dispatch spawned: the client received zero bytes (not even a status line) and the developer's terminal was repainted with an "Unhandled exception in spawn" backtrace for every such request. No handler in hwaro's chain runs early enough to catch it — the request object does not exist yet — so the only place to intervene is around the processor itself.

Constants

BAD_REQUEST_BODY = "400 Bad Request\n"