Repository navigation
Conversation
dd2dacf to
4d1c173
Compare
4d1c173 to
d268b2c
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Some points from a first read. Source review only, I have not run it.
- The rebase needs care. The conflict is in the
if (useIndexing)block ofEncoder.encodeHeaderthat #1552 rewrote. This PR's side has no Latin-1 guard, so taking it would bring back the encoder/peer table mismatch for chars above 0xFF. The merged condition needs both: the Latin-1 check from #1552 and the policy check. Please also make sure the #1552 tests inHpackEncoderSpecstill run against the new 5-argument overload. - The policy lives in the
internalSettingsslot.HpackPolicyOptionsextends the internal-settings marker traits andwithHpackIndexingPolicycallswithInternalSettings, which replaces the whole value. Nothing else uses the slot today, but a laterwithInternalSettingscall drops the user's policy and vice versa. For a public feature I would prefer a real field on theprivate[http]impls with MiMa filters. (#981 does something similar for its flag, so it would be good to settle both the same way.) - A wrong
hpack-indexing-policy-classfails per connection, not at startup. The class is resolved inHeaderCompression.preStart, so a typo lets the server bind and then fails every HTTP/2 connection, with a reflective instantiation per connection. Could the class and its constructor be validated when the settings are read? - Java API shape. The server method is on javadsl
Http2ServerSettingsbut the client one is on javadslClientConnectionSettingsrather thanHttp2ClientSettings, where the otherwith*methods are. - Tests.
ClientConnectionSettingsTest.testConfigureHpackIndexingPolicyonly asserts non-null, so it shows the API compiles from Java but not that the policy is kept or applied. The two end-to-end tests exercise only the name list; the programmatic policy and the configured class are tested at theHeaderCompressionstage only. Could one test show a policy set throughwithHpackIndexingPolicyreaching a real client and server connection? - Pseudo-headers cannot be listed in
hpack-no-index-headersbecause names are validated as tokens.:pathis the usual source of table churn, so needing a custom class for it is a notable limit. It is documented; is it intended? - Nit:
HpackPolicyOptionsis a case class holding aConfigand a function, so the settingstoStringprints the http2 config section when a class is configured, and equality is by identity for explicit policies.
Motivation: High-cardinality outgoing fields can churn the dynamic table. The opt-in needs to preserve the encoder's existing indexing invariants and coexist with internal HTTP/2 settings. Modification: Provide independent client and server options with a case-insensitive name list or Java/Scala policy. Keep the policy outside internalSettings and validate a configured class and constructor when loading settings; create one instance per materialized connection. Expose the policy on both Java HTTP/2 settings types. Keep existing indexes, sensitive representation and Latin-1 insertion eligibility. Cover positive endpoint, settings and encoder behavior. Result: Outbound insertion can skip selected eligible fields, including standard pseudo-header names, without changing defaults or wire grammar. Risks: A policy can trade a larger header block for reduced table churn. The two MiMa exclusions are limited to the package-private server settings implementation's previous generated copy and constructor. References: Netty #18501; RFC 7541 section 6.2.2; RFC 9113 section 8.3; Pekko HTTP apache#1556 review.
d268b2c to
5b9bbea
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks for this. I did not find a correctness problem: the policy is only consulted when an entry would be inserted, exact matches and never-indexed fields are untouched, and the default path stays allocation-free when nothing is configured.
Two design questions before I approve:
- How the configured class is loaded (inline).
- Scope: this adds three ways to express the same thing (name list, config class, programmatic policy). The name list plus
withHpackIndexingPolicywould cover the use cases I can think of. Is there a concrete need forhpack-indexing-policy-classas well? Dropping it would remove the reflection, the per-connection construction and its failure mode.
Motivation: High-cardinality outgoing fields can churn the dynamic table. The opt-in needs to preserve the encoder's existing indexing invariants and coexist with internal HTTP/2 settings. Modification: Provide independent client and server options with a case-insensitive name list or Java/Scala policy. Keep the policy outside internalSettings and resolve the configured class through the actor system's class loader at connection startup and construct one policy per materialized connection. Expose the policy on both Java HTTP/2 settings types. Keep existing indexes, sensitive representation and Latin-1 insertion eligibility. Cover positive endpoint, settings and encoder behavior. Result: Outbound insertion can skip selected eligible fields, including standard pseudo-header names, without changing defaults or wire grammar. Risks: A policy can trade a larger header block for reduced table churn. The two MiMa exclusions are limited to the package-private server settings implementation's previous generated copy and constructor. References: Netty #18501; RFC 7541 section 6.2.2; RFC 9113 section 8.3; Pekko HTTP apache#1556 review.
5b9bbea to
9b921f9
Compare
Motivation: High-cardinality outgoing fields can churn the dynamic table. The opt-in needs to preserve the encoder's existing indexing invariants and coexist with internal HTTP/2 settings. Modification: Provide independent client and server options with a case-insensitive name list or Java/Scala policy. Keep the policy outside internalSettings and resolve the configured class through the actor system's class loader at connection startup and construct one policy per materialized connection. Expose the policy on both Java HTTP/2 settings types. Keep existing indexes, sensitive representation and Latin-1 insertion eligibility. Cover positive endpoint, settings and encoder behavior. Result: Outbound insertion can skip selected eligible fields, including standard pseudo-header names, without changing defaults or wire grammar. Risks: A policy can trade a larger header block for reduced table churn. The two MiMa exclusions are limited to the package-private server settings implementation's previous generated copy and constructor. References: Netty #18501; RFC 7541 section 6.2.2; RFC 9113 section 8.3; Pekko HTTP apache#1556 review.
9b921f9 to
d930c5e
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks for the update. I read the current head (source review only, I have not run it). The points from my earlier reviews are addressed: the Latin-1 guard from #1552 is kept next to the policy check, the policy is a field of its own rather than living in the internal settings slot, the configured class goes through dynamicAccess at connection start, the Java setter is on Http2ClientSettings, pseudo-header names can be listed, and the client and server specs now cover both the name list and a programmatic policy end to end. I did not find a correctness problem.
Two things left:
hpack-indexing-policy-class. My earlier question is still open: is there a concrete use case that the name list pluswithHpackIndexingPolicydoes not cover? As it stands there are three ways to configure the same thing, and the class option is the one that brings reflection, one instance per connection and a failure that only shows when a connection starts. If there is a need for it, could the PR description say what it is? Otherwise I would prefer to leave it out for now; it can be added later without breaking anything.- Nit:
ClientConnectionSettingsTest.testConfigureHpackIndexingPolicyonly checks that the settings object surviveswithHttp2Settings/getHttp2Settings. It shows the API is usable from Java, but not that the policy is kept. Not blocking, since the Scala specs cover the behaviour.
d930c5e to
916fa4a
Compare
There was a problem hiding this comment.
Thanks for the update, and for the added test that the Java-configured policy is kept and applied.
I would prefer to see the hpack-indexing-policy-class option removed from this PR.
The name list (hpack-no-index-headers) plus withHpackIndexingPolicy cover the use cases I can think of, and the class option is the part that brings the reflection, the per-connection construction and a failure that only shows when a connection starts. It can be added later without breaking anything if a concrete need comes up.
Roughly what that would mean:
Http2CommonSettings: removeConfiguredPolicy, and reduceHpackPolicyOptionsto the name set plus the optional explicit policy (soresolveno longer needs the actor system)reference.conf: removehpack-indexing-policy-classfrom the client and serverhttp2sections- docs: remove the paragraph on the configured class
- tests: remove the configured-class cases in
HeaderCompressionSpec(and any inHttp2CommonSettingsSpec); the name-list and programmatic-policy tests stay as they are - PR description: update Modification and Result to match
With that done I am happy to approve.
Edited: an earlier version of this comment said the head had gone back to loading the class with the thread context class loader. That was wrong (I was looking at a stale local copy of the branch); the head resolves it through dynamicAccess as the description says.
916fa4a to
bfec0cf
Compare
bfec0cf to
e933045
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks for removing hpack-indexing-policy-class; that resolves my main point, and the description now matches the code. One thing changed in the other direction: the policy is stored in the internalSettings slot again (ServerHpackSettings / ClientHpackSettings), which was the second point of my first review. Comment inline; it applies to two other open PRs as well. Source review only, I have not run it.
e933045 to
28d248e
Compare
28d248e to
0940618
Compare
Motivation: Allow direct HTTP/2 clients to announce that they have stopped sending requests before closing an otherwise healthy connection. Modification: Queue a single GOAWAY(NO_ERROR) on a normal request-source completion when the option is enabled. Keep the existing response drain and do not change managed cancellation or application-failure behavior. Store the opt-in in an independent immutable settings field; preserve released constructor, factory and copy descriptors. Result: Existing applications keep the default and error behavior. A caller can opt into graceful close without replacing the internal settings, and an older settings copy preserves the active opt-in. Tests: JDK 17 on Scala 2.13.18 and 3.3.9: ten focused settings, direct and managed lifecycle cases per axis, an actual Java settings caller, released 2.0.0 Scala linkage probes and zero scoped MiMa findings. Scoped Scala formatting and whitespace checks passed. References: RFC 9113 Section 6.8. Addresses PJ's review on apache#1665; related apache#1556.
Motivation: Keep the explicit server-side CONNECT opt-in composable with other HTTP/2 settings while preserving released JVM constructor and copy linkage. Modification: Retain the existing application-owned draft on current main. Replace the settings subclass with a default-off field; keep the released constructor and copy bridges and keep internal settings independent. Result: The draft's default behavior and tunnel API are unchanged. Existing copies preserve the new setting. Tunnel lifecycle design remains open. Tests: - Focused settings: 4 passed on each of Scala 2.13.18 and 3.3.9. - Java wither smoke, linked 2.0.0 consumers, and scoped MiMa passed on both. - Compatibility-guide checker: 2 passed on Scala 2.13.18. - Cached overlays; no full CI, native sbt test graph, or tunnel tests. References: Refs apache#1588, apache#1589, apache#981, apache#1556. https://www.rfc-editor.org/rfc/rfc9113.html#section-8.5
Motivation: Applications with a ready companion representation can offer it on the same established HTTP/2 connection without affecting applications that leave the feature off or peers that disallow push. Modification: Add a default-off native server setting and typed Scala and Java plans for a rooted same-origin GET with a complete strict 200 representation. Only hand off a push when the peer allows it, its original request is still eligible and the outgoing path has demand. Keep separately owned pushed streams on the existing data scheduler and use the same connection HPACK encoder as ordinary responses. Result: A push is best effort and is neither queued nor acknowledged to the application. Skipped pushes leave the primary response on its ordinary path. The HTTP/1.1 fallback, upgrade path, client behavior and Pekko Core requirements are unchanged. Tests: JDK 17 with Scala 2.13.18 and 3.3.9: three native-stack in-memory tests, two settings tests and one named Java Jupiter test passed per axis. The earlier transport-level fixture separately passed three tests per axis. Checked settings constructor, copy and default descriptors against main and the stacked V2 artifact. No real sockets or TLS handshake, full CI, h2spec or full MiMa. References: Pekko HTTP apache#1556 (stacked shared HPACK policy). RFC 9113 sections 6.5.2, 6.6 and 8.4.
Motivation: Applications with a ready companion representation can offer it on the same established HTTP/2 connection without affecting applications that leave the feature off or peers that disallow push. Modification: Add a default-off native server setting and typed Scala and Java plans for a rooted same-origin GET with a complete strict 200 representation. Only hand off a push when the peer allows it, its original request is still eligible and the outgoing path has demand. Keep separately owned pushed streams on the existing data scheduler and use the same connection HPACK encoder as ordinary responses. Result: A push is best effort and is neither queued nor acknowledged to the application. Skipped pushes leave the primary response on its ordinary path. The HTTP/1.1 fallback, upgrade path, client behavior and Pekko Core requirements are unchanged. Tests: On JDK 17, Scala 2.13.18 and 3.3.9 each passed the producer fixture followed by three native-stack cases in one JVM. Previous unchanged settings and named Java Jupiter unit cases passed on both axes; settings constructor/copy/default descriptors were compared with main. No local sockets, real TLS/ALPN peer, full CI, h2spec or full MiMa. References: Pekko HTTP apache#1556 (stacked shared HPACK policy). RFC 9113 sections 6.5.2, 6.6 and 8.4.
pjfanning
left a comment
There was a problem hiding this comment.
Thanks, this resolves my point about the internalSettings slot: the policy is a field of its own and the 2.0.0 constructor and copy signatures are kept. Source review only, I have not run it.
- Needs a rebase:
docs/src/main/paradox/client-side/http2.mdconflicts with the paragraph added by #1682. Both should be kept. - The earlier test of the compatibility bridges was removed, and the new specs only reach the
copywith defaults. Could you add one that calls the 2.0.0-shaped constructor and positionalcopy(server and client) and checks that the policy is kept? - There is
withHpackIndexingPolicyin the Java settings but no getter. The other settings there have a getter next to thewithmethod. Not blocking. - #981 and #1589 now use the same field-plus-bridge pattern in the same constructor/
copyblocks. Whichever merges second should keep only the 2.0.0 bridge and extend the fullcopy, not add a second bridge.
Happy to approve once 1 and 2 are done.
0940618 to
242a67d
Compare
Motivation: High-cardinality outbound values can displace useful dynamic HPACK table entries. Applications need an opt-in compression policy. Modification: Add role-specific configured names and an optional typed Scala/Java policy. Use ordinary settings fields, independent of internalSettings; preserve the released JVM constructors and copy descriptors. Keep the Latin-1 guard, exact index reuse, and never-index behavior. Rebase on current main and keep both imports required by the HTTP/2 server spec. Result: Unconfigured applications keep their existing behavior. A configured policy can decline eligible new entries without changing index reuse. Tests: JDK 17 on Scala 2.13.18 and 3.3.9: 14 focused ordinary settings, HPACK, and client/server tests per axis and a released 2.0.0 Scala copy caller. Scoped settings MiMa and Scala formatting passed. References: Netty #18501, RFC 7541 Section 6.2.2; related apache#981 and apache#1589.
242a67d to
68cf565
Compare
Motivation
Out-of-band values that rarely repeat can evict useful entries from the outbound HTTP/2 HPACK dynamic table. Applications and frameworks need a way to decline those insertions.
Modification
Provide separate opt-in header-name lists and a typed policy for the Java and Scala HTTP/2 client and server settings. The Java getters return the effective policy (configured list or explicit callback) so a framework can compose its own rule with the user's rule before installing it. The default is empty; an explicit policy replaces the list unless the caller composes them. No reflective configuration is added.
Store the policy in dedicated settings fields. Retain the released JVM constructors, positional copy methods, and old copy defaults. Legacy copies preserve the receiver's policy. The generated private implementation companion, extractor and Product shape are not asserted compatible.
Result
Defaults and exact index reuse are unchanged. The policy declines only eligible new insertions and is not a Never Indexed or confidentiality control.
Validation: JDK 21 / Scala 2.13.18: 7 Java settings tests, 8 Scala settings tests, 3 codec tests, and 4 client/server HTTP/2 tests passed; scoped Java/Scala formatting, http-core MiMa, and Paradox generation passed. An unchanged Scala caller separately compiled against released Pekko HTTP 2.0.0 also called the old client/server constructors and positional copy methods against this build. This covers those four linkage paths, not all private case-class methods or a combined build of open PRs.
References
RFC 7541 §6.2.2 · Review feedback · Separate Never Indexed follow-up