Repository navigation
Move Handler into base-http as the shared request interface, called with a server or client context. - #80
Merged
Conversation
… server and client contexts.
… keeping source headers intact.
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.
Move the server's
Handlerintobase-httpasHandler<'scope, C: HandlerContext>, called ascall(request, &mut context, &cancellation), whichbase-http-serverre-exports, asdesign/middleware.mddecides, withHandlerContextgiving middleware generic over the context the exchange's interim hook. Servers pass aServerContext, which carries the connection's newPeer(peer and local addresses, whether the connection is encrypted and its negotiated application protocol, and early data, always false until HTTP/3) and anInterimSender: instead of borrowing the connection's writer, which would make a handler's response type depend on that borrow, the sender hands each interim response to the connection'sInterimRelay, and the server writes it while it continues to poll the handler, so the context has no type or lifetime parameter and a send allocates nothing. Applications calling a client pass aClientContext<I>with their observer andRequestOptions, which has no options yet; the client implements the interface in the next change.call_sendmoves tobase-http. The server's entry points, and the fixtures' scheduler alias, now requireSocketPeerAddressandSocketLocalAddress, which every Base backend provides; the fixtures'ServerContextandClientContextbecomeServerFixtureandClientFixture. Tests cover a middleware generic over the context wrapping a server handler and a client handler alike, layers applying in order, a layer answering without its delegate, a narrower cancellation, a borrowed body passing through without copying, interim responses through either context, a server middleware reading thePeer, a compile-fail test placing a server-only middleware on the client side,Peerover plain TCP and TLS, the relay itself, and a handler returning while its interim response is being written; region coverage is complete, and the suite passes on Rust 1.92 and 1.99. The TLS server name is not reported yet, becausebase-endpoint0.3 does not expose it.