Skip to content

feat: opt in to sending server-wide HTTP/2 OPTIONS - #1732

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:feat/http2-client-asterisk-options
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:feat/http2-client-asterisk-options

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Motivation

HTTP/2 distinguishes server-wide OPTIONS from OPTIONS on a resource. Applications need a way to choose the server-wide form for a connection without changing what existing clients send.

Modification

Add pekko.http.client.http2.send-asterisk-options, disabled by default, and expose it through the Scala and Java client connection settings. The direct and managed HTTP/2 clients honor the settings passed to their connection builders. When enabled, an absolute HTTP(S) OPTIONS URI with neither a path nor a query renders as *. A resource path, an explicit query (even an empty one), and an explicit raw request target keep their existing handling.

Result

Applications can opt in for individual peers. The default remains / for an authority-only OPTIONS URI, and HTTP/1.1 and inbound server handling are unchanged.

  • On the previously published revision, hosted validation passed eight in-memory cases on each of Scala 2.13.18, 3.3.9, and 3.9.0 with JDK 17. They exercise direct and managed clients with both configuration defaults and opposite per-connection overrides. The renderer and settings cases also passed.
  • This revision adds one Java test for the default, the HOCON opt-in, and the opposite per-connection overrides while leaving the original settings unchanged. The new test passed on JDK 17 and Scala 2.13.18 (1/1), and the scoped Java formatter checked the one file without changing it.

References

RFC 9113 §8.3.1 and erratum 9175, held for document update.

Refs #981 (separate inbound HTTP/2 OPTIONS support; not a prerequisite).

@He-Pin
He-Pin marked this pull request as ready for review November 27, 2026 16:42

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. pekko.http.client.http2.send-asterisk-options is read once from system.settings.config in Http2Ext and threaded through as a boolean, bypassing Http2ClientSettings. It lives in the config block that Http2ClientSettings parses but has no Scala/Java accessor or withXxx. A client passing its own ClientConnectionSettings cannot turn it on or off per connection, so an application talking to one peer that accepts * and one that does not cannot configure them differently - which is the compatibility concern that motivates making it opt-in.

  2. The existing clientStack(...) / httpLayerClient(...) overloads are kept and hard-code sendAsteriskOptions = false, so anything building the stack through them (several specs and the benchmark do) silently ignores the config. Deriving the flag from the settings object inside clientStack would fix both points.

He-Pin added a commit to He-Pin/incubator-pekko-http that referenced this pull request Nov 29, 2026
Motivation

A client may talk to peers with different support for the server-wide OPTIONS target. A system-wide setting cannot represent that difference.

Modification

Expose the default-off setting through the Scala and Java HTTP/2 client settings, use it in the existing client stack, and preserve resource paths, query targets and explicit target choices. Document both configuration and the per-connection override.

Result

Direct and managed connections honor their settings without changing the default request target or HTTP/1.1 behavior. The focused transport and rendering cases pass on Scala 2.13 and Scala 3.

References

Refs apache#1732.
@He-Pin
He-Pin force-pushed the feat/http2-client-asterisk-options branch from babc87e to 82d213b Compare November 29, 2026 03:08
@He-Pin
He-Pin requested a review from pjfanning November 29, 2026 04:14
@He-Pin
He-Pin force-pushed the feat/http2-client-asterisk-options branch from 82d213b to ac28218 Compare November 29, 2026 05:56
Motivation:
Allow a client to opt into sending the asterisk form without changing the default.

Modification:
Expose per-client settings in Scala and Java and preserve the existing renderer wiring. Add a Java test for both override directions.

Result:
The focused Java API test and official formatting passed on JDK 17.

References:
RFC 9113 §8.3.1; review feedback in apache#1732
@He-Pin
He-Pin force-pushed the feat/http2-client-asterisk-options branch from ac28218 to 3924b80 Compare November 29, 2026 08:47
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.

2 participants