Move HTTP from cowboy to livery - #17
Open
benoitc wants to merge 1 commit into
Open
Conversation
Serve HTTP through livery 0.7.0 instead of cowboy, and drive the test
suites with livery_client instead of hackney.
- The listener is owned by a new supervised hornbeam_listener;
hornbeam:info/0 and hornbeam:is_running/0 replace ranch introspection.
- hornbeam_handler is a livery handler. WSGI and ASGI responses resolve
through livery_resp:stream_deferred/1 in the per-request process, so
request-body chunks and Python events share one mailbox.
- WebSocket runs on the ws_handler behaviour (new hornbeam_ws_handler);
hornbeam_websocket keeps the upgrade entry point, scope building, and
the session registry.
- Duplicate request headers are preserved in the ASGI scope and joined
with ", " in WSGI HTTP_* keys.
- New max_body option (default infinity) caps the request body.
Breaking: routes are livery router entries
{Method | '_', Pattern, HandlerFun | {Mod, Fun}} rather than cowboy
{Path, HandlerModule, Opts} tuples; cowboy handler modules are rejected.
max_request_line_size, max_header_size and max_headers are accepted but
inactive. The dead hornbeam_wsgi build_environ path is removed.
TLS still serves HTTP/1.1 only; wiring livery's h2 listener is a
follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Serves HTTP through livery 0.7.0 instead of cowboy, and drives the test suites with
livery_clientinstead of hackney.What changes
hornbeam_listener;hornbeam:info/0andhornbeam:is_running/0replace ranch introspection.hornbeam_handleris a livery handler. WSGI and ASGI responses resolve throughlivery_resp:stream_deferred/1in the per-request process, so request-body chunks and Python events share one mailbox.ws_handlerbehaviour (newhornbeam_ws_handler);hornbeam_websocketkeeps the upgrade entry point, scope building, and the session registry.", "in WSGIHTTP_*keys.max_bodyoption (defaultinfinity) caps the request body at the listener.Breaking
{Method | '_', Pattern, HandlerFun | {Mod, Fun}}instead of cowboy{Path, HandlerModule, Opts}tuples. Cowboy handler modules are rejected with{error, {invalid_route, _}}.max_request_line_size,max_header_sizeandmax_headersare still accepted but do nothing (not exposed by livery).hornbeam_wsgiremoved: the classicbuild_environ/1,2path was dead code; the live path ishornbeam_request:build_wsgi_tuple/2.Requires livery 0.7.0
Five behaviours depend on the 0.7.0 release:
livery_req:inform/3for 103 Early Hints, the peer on plain HTTP/1.1 requests (WSGIREMOTE_ADDR, ASGIclient), synchronous connection teardown inlivery:stop_service/1,max_frame_size/compressonlivery_ws:upgrade/3, and{remote, Code, Reason}in the ws handler'sterminate/2.Also fixes the
/early-hintsroute in the ASGI test app, which sent status 103 throughhttp.response.start(treated as the final head) rather thanhttp.response.informational, so it had never worked.Known limitations
start_tlsnegotiated HTTP/2 via ALPN. Wiring livery'shttps(h2) listener is a follow-up.http.response.early_hintsASGI extension is advertised accordingly.