connmgr: add ability to send large outbound request headers#48368
Merged
Conversation
clintjedwards
approved these changes
Jun 16, 2026
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.
Following #48365, this PR implements support for large outbound request headers.
Currently,
http1::client::Request::prepare_headerserializes its inputs (method, URI, headers) to a buffer and returns aRequestHeaderinstance. Then the async methodRequestHeader::sendwrites the buffer to the socket. This PR reworks things such thatprepare_headerborrows its inputs without doing any serialization, keeping them in theRequestHeaderinstance, and then thesendmethod writes the inputs directly to the socket, with resumption for partial writes.The resulting API is essentially the same except callers have to ensure the inputs live until
sendcompletes, so some variables are moved around near call sites to achieve this.Note: moving variables around in order to extend their lifetimes caused the async task sizes to increase beyond our latest thresholds. I'll see about optimizing the sizes afterwards, but if nothing can be done I think it's fine.
The underlying
http1::protocol::ClientRequest::send_headerfunction, like many of our low level I/O functions, is synchronous and operates on aWriteimplementation. In order to operate on anAsyncWriteimplementation from within an async function, we use a pattern involving two convenience wrappers,StdWriteWrapperandAsyncOperation.StdWriteWrapperimplementsWriteon anything that implementsAsyncWrite. With it, an async socket object can be passed tosend_header.AsyncOperationis then used to wrap the call and present it as a future that can be awaited.Below is a manual test of ~20kb headers proxied from pushpin to nginx, using an 8kb block size in pushpin.
Before:
Logs:
After: