Repository navigation
Sherver speaks HTTP/1.1 now, and behaves like it: the request line and the Host header are
validated, OPTIONS is answered, and a file can be served by byte range — which is what makes
<video> seeking work. Nothing was removed from the scripting API.
- answers in HTTP/1.1, to a 1.0 client as well (RFC 9112 §2.3)
REQUEST_HTTP_VERSIONis validated instead of merely parsed: anything that is notHTTP/1.xis a
400, another major version a505Hostis mandatory on an HTTP/1.1 request, missing it is a400. OK for HTTP/1.0 request- header lines are validated: sends
400for bad requests (RFC 9112 §5, §5.1, §5.2, §3.2 and
§6.3, RFC 9110 §5.5). - Repeated header reaches
REQUEST_HEADERSas thev1, v2list it stands for (RFC 9110 §5.2)
exceptCookie, whose pairs recombine on;(RFC 9113 §8.2.3) - byte ranges: advertise
Accept-Ranges: bytes, and GET carrying a singleRange: bytes=…
gets a206with itsContent-Range. A range we can't use falls back to the full200;
only one that selects nothing — starting at or past the end — is a416 OPTIONS, answered by the dispatcher for any target,*included, withAllowand an empty
body.PUT,DELETE,PATCH,TRACEandCONNECTstill get a405.
Do the same before your ownsend_error 405.- absolute-form request target:
GET http://host/path HTTP/1.1is accepted, as RFC 9112 §3.2.2 - an error is never stored:
send_erroranswersCache-Control: no-storeand drops anyETagand
Last-Modifiedalready set - no more
Expires:Cache-Controlis the only freshness field now. - a chunked request body is a
411, where it was silently read as no body at all: chunked
framing is still not decoded, but it is refused loudly, on any method. Expect: 100-continueis answered (RFC 9110 §10.1.1) withHTTP/1.1 100 Continue- an
Expectnaming anything but100-continueis a417 Expectation Failed - a request has 10 s to arrive whole, body included, or it is a
408 Request Timeout:socat -T
only ever dropped a client gone silent, and one dripping a byte every 9 s held a dispatcher for
hours.MAX_REQUEST_TIMEis the knob, next toMAX_BODY_SIZEandMAX_HEADERS_SIZE HTTP_RESPONSEgains the codes that go with all this:
100,206,301,302,303,307,308,408,411,416,417,501,505tailandheadjoin the external commands, for range answers only — busybox's are enough- add support for redirections 30X
- add support for
Last-Modifiedheader - add IP in logs
- command line flags replace editing
sherver.sh:--port N,--ipv4,--tls,
--certs DIR,--debug,--version, and--help - bash 4.4 is the floor, checked at startup by
sherver.sh,dispatcher.shand
tests/lint.sh
Deliberately left out, and worth knowing about:
- no keep alive, and none planned:
Connection: closeon every response is a compliant opt-out
(RFC 9112 §9.6), and one process per connection is the whole architecture - a chunked request body is refused with a
411rather than decoded. No common client
sends one unprompted - a header value is taken as it comes: past the stray-CR refusal of RFC 9110 §5.5, only the
field name is validated, and a value is checked where it is read (Content-Length,Range)
or not at all
Special thanks for this release:
- https://github.com/vaibhav8a @vaibhav8a for his typo fix