Share HTTP accept properties - #13514
Open
bneradt wants to merge 1 commit into
Open
Conversation
Each HTTP protocol acceptor keeps a separate copy of proxy-port properties, so adding or consuming one requires protocol-specific plumbing and can leave newer protocols without configured defaults. Introduce a common HTTP acceptor base that shares one immutable property set per proxy port and retains the source HttpProxyPort. Sessions track that acceptor, while transactions copy mutable outbound settings when they start so per-transaction overrides remain isolated. Fixes: apache#3427
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors HTTP acceptor configuration so all protocol-specific acceptors (HTTP/1.1, HTTP/2, HTTP/3/QUIC) for a given proxy port share a single immutable HttpSessionAccept::Options instance, and sessions keep a pointer to the acceptor (retaining access to both the shared options and the originating HttpProxyPort). Transactions continue to get an isolated mutable copy of outbound-related settings when a transaction starts, preserving per-transaction override behavior.
Changes:
- Introduces
HttpSessionAcceptBase, which owns a shared, immutableOptionshandle and retainsproxyPort, and updates protocol acceptors to derive from it. - Replaces per-session stored
accept_optionspointer with a storedacceptorpointer (HttpSessionAcceptBase const *) and updates call sites accordingly. - Updates transaction initialization to copy outbound options from the session’s acceptor, and adds/updates unit tests validating the new sharing/inheritance behavior.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/proxy/ProxyTransaction.cc | Initializes upstream_outbound_options from the session acceptor (and refreshes on new_transaction). |
| src/proxy/http3/Http3SessionAccept.cc | Converts HTTP/3 acceptor to the shared-base pattern and passes acceptor through to apps/sessions. |
| src/proxy/http3/Http3App.cc | Stores acceptor pointer on the session instead of an options pointer. |
| src/proxy/http3/Http09App.cc | Stores acceptor pointer on the session instead of an options pointer. |
| src/proxy/http2/Http2Stream.cc | Removes per-stream copy from accept_options (now sourced via ProxyTransaction). |
| src/proxy/http2/Http2SessionAccept.cc | Converts HTTP/2 acceptor to the shared-base pattern and sets session acceptor. |
| src/proxy/http/unit_tests/test_HttpUserAgent.cc | Updates existing test to use acceptor and adds a test for shared acceptor property inheritance. |
| src/proxy/http/HttpSM.cc | Switches host resolution preference lookup from accept_options to acceptor->options(). |
| src/proxy/http/HttpSessionAccept.cc | Switches session initialization to store acceptor and reads transport type from shared options. |
| src/proxy/http/HttpProxyServerMain.cc | Builds a single shared Options instance per proxy port and supplies it to all protocol acceptors. |
| src/proxy/http/Http1ClientSession.cc | Removes per-connection copy of accept options into the transaction (now handled in ProxyTransaction). |
| include/proxy/ProxySession.h | Replaces accept_options with HttpSessionAcceptBase const *acceptor. |
| include/proxy/http3/Http3SessionAccept.h | Updates HTTP/3 acceptor to inherit from HttpSessionAcceptBase and removes embedded options copy. |
| include/proxy/http3/Http3App.h | Updates constructor to accept an acceptor pointer. |
| include/proxy/http3/Http09App.h | Updates constructor to accept an acceptor pointer. |
| include/proxy/http2/Http2SessionAccept.h | Updates HTTP/2 acceptor to inherit from HttpSessionAcceptBase and removes embedded options copy. |
| include/proxy/http/HttpSessionAccept.h | Adds HttpSessionAcceptBase and updates HttpSessionAccept constructors to use shared immutable options. |
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.
Each HTTP protocol acceptor keeps a separate copy of proxy-port
properties, so adding or consuming one requires protocol-specific
plumbing and can leave newer protocols without configured defaults.
Introduce a common HTTP acceptor base that shares one immutable
property set per proxy port and retains the source HttpProxyPort.
Sessions track that acceptor, while transactions copy mutable outbound
settings when they start so per-transaction overrides remain isolated.
Fixes: #3427