Skip to content

Run Client::call on the direct path and let the client implement the shared request interface. - #81

Merged
ioquatix merged 2 commits into
mainfrom
client-handler
Nov 20, 2026
Merged

ioquatix merged 2 commits into
mainfrom
client-handler

Conversation

@ioquatix

Copy link
Copy Markdown
Contributor

Replace the buffered Client::call with one on the direct path, as design/middleware.md decides: it opens the request with the body's known length, writes the body from the calling future while waiting for the response head, and returns the direct path's StreamingResponseBody; an upload unfinished at the head moves to the driver as one work item, whose waiting reads stop when the exchange is cancelled. Client implements Handler<'scope, ClientContext<I>>, relaying interim responses to the context's observer through an InterimRelay, and call_with_interim is removed. The driver's queue of operations, the boxed request-body producer, ResponseBody and Options::response_buffer_bytes and response_buffer_frames are removed, and connection sessions only wait to be stopped. Behaviour changes: call makes progress only while polled, as open does; response bodies stream from the connection and cannot outlive the client's scope; protocol errors on response bodies are no longer wrapped as body failures; closing a response body with an error makes later reads report it; a streaming body known to be empty is ready; and a connection under construction when the driver shuts down is cancelled rather than retired late, so a failure closing it reports the cancellation. Waiting calls still report Closed when the driver is dropped and Cancelled when its lifetime is cancelled. Twelve client tests that assumed the driver sends a request after one poll now drive the call until the peer reaches the intended point, using a new drive_until helper, and new tests cover a failed upload write, a rejected call through the interface and acquiring from a closed pool. The client benchmark measured the new call at the direct writer's cost, 7 allocations and about 600 bytes per request against 17 to 18 and over 5 KB before, with 24 to 29 percent more requests per second; the full suite passes on Rust 1.92 and 1.99, region coverage is complete, and both client examples run over HTTP and HTTPS.

@ioquatix
ioquatix merged commit 44aa080 into main Nov 20, 2026
8 checks passed
@ioquatix
ioquatix deleted the client-handler branch November 20, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant