Repository navigation
Conversation
| override def parse(name: String, value: String, parserSettings: ParserSettings): (Uri.Path, Option[String]) = | ||
| try { | ||
| if (value.isEmpty) { | ||
| protocolError("Pseudo-header ':path' must not be empty") |
There was a problem hiding this comment.
There was a problem hiding this comment.
The ":path" pseudo-header field includes the path and query parts
of the target URI (the "path-absolute" production and optionally a
'?' character followed by the "query" production (see Sections 3.3
and 3.4 of [RFC3986]). A request in asterisk form includes the
value '*' for the ":path" pseudo-header field.
This pseudo-header field MUST NOT be empty for "http" or "https"
URIs; "http" or "https" URIs that do not contain a path component
MUST include a value of '/'. The exception to this rule is an
OPTIONS request for an "http" or "https" URI that does not include
a path component; these MUST include a ":path" pseudo-header field
with a value of '*' (see [[RFC7230], Section 5.3.4](https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.4)).
Belshe, et al. Standards Track [Page 55]
RFC 7540 HTTP/2 May 2015
All HTTP/2 requests MUST include exactly one valid value for the
":method", ":scheme", and ":path" pseudo-header fields, unless it is
a CONNECT request (Section 8.3). An HTTP request that omits
mandatory pseudo-header fields is malformed (Section 8.1.2.6).
HTTP/2 does not define a way to carry the version identifier that is
included in the HTTP/1.1 request line.
|
There is also #961 |
c7ae010 to
a0f6379
Compare
53c8772 to
4696e75
Compare
|
Rebased and will update the comments too. |
4696e75 to
bad9ff0
Compare
|
based on #961 |
|
Isn't the main reason for this PR is to fix this test: "handle a ':path' with an asterisk" |
jrudolph
left a comment
There was a problem hiding this comment.
Not sure how important these changes are. CONNECT is not really supported (afair), so I'm somewhat reluctant changing behaviour and adding extra code for that.
The OPTIONS change seems like a thing that might be needed (though, it's somewhat weird that no one found it missing so far). It doesn't feel fully addressed, though, tests and demonstrations how to use it are missing.
In any case, these should be two separate PRs, but right now I'm not convinced any of these are changes we should do.
bad9ff0 to
7dea820
Compare
7dea820 to
b0edc50
Compare
Motivation: HTTP/2 applications need to distinguish a server-wide OPTIONS request from OPTIONS on the root resource. Modification: Preserve the scheme and authority and expose the asterisk using the existing Raw-Request-URI marker. Document how Scala and Java handlers can read it. Cover both targets in the same HTTP/2 server test. Result: Application handlers can recognize server-wide OPTIONS while OPTIONS / keeps its existing URI and does not gain the marker. Tests: One focused Http2ServerSpec case (two requests) and two focused RequestParsingSpec cases passed on Scala 2.13.18 / Temurin 17.0.21.1. The http2-tests/Test and http-core Scalafmt checks and git diff --check passed. References: RFC 9113 section 8.3.1; apache#981.
b0edc50 to
b9ef4ef
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks for picking up the asterisk-form TODO. Accepting OPTIONS * on HTTP/2 is right per RFC 9113 §8.3.1, and rejecting * for other methods is a good guard. My concerns are about how the request is then presented to existing handlers, see inline. The first two are the ones I'd like to settle before this goes in.
b9ef4ef to
5198420
Compare
5198420 to
3988aec
Compare
3988aec to
858c650
Compare
Motivation: With server-wide OPTIONS enabled, only the accepting cases and the "disabled by default" case were tested. The rejection paths added with the asterisk-form grammar had no coverage. Modification: Add RequestParsingSpec cases, all with accept-asterisk-options on: - ":path: *" with GET, HEAD, POST and DELETE is rejected and the error names ":path" - HEAD with transparent-head-requests on is rejected as well - "*?q", "*?", "*/x", "**" and "*/" are rejected by the path grammar - "/*" and "/a/../*" stay ordinary origin-form paths without the asterisk request target attribute Result: The rejection paths are pinned by tests. No production code changed. Tests: - sbt "http2-tests/testOnly org.apache.pekko.http.impl.engine.http2.RequestParsingSpec -- -z asterisk" - 6 passed - sbt http2-tests/Test/scalafmt - no changes References: Refs apache#981
5a60c19 to
1b47818
Compare
pjfanning
left a comment
There was a problem hiding this comment.
The latest revision moves accept-asterisk-options back into the internalSettings slot and drops the MiMa filter file, which undoes the change made after my earlier review. One comment inline; it applies to two other open PRs as well. The rejection-path tests are still in place and I have resolved that thread.
Motivation ---------- An HTTP/2 application needs to distinguish server-wide OPTIONS from OPTIONS on the root resource without changing default routing behavior. Modification ------------ Add a default-off server setting and a typed request attribute in Java and Scala. Store opt-in choices together in the existing settings slot, keeping its original constructor and copy signatures. A legacy settings update transfers only the legacy value, not another instance's opt-in. Result ------ Applications can handle OPTIONS * explicitly. Normal targets and outbound request rendering are unchanged. When disabled, the settings slot retains the old representation. Tests ----- Six focused settings tests each on Scala 2.13.18, 3.3.9 and 3.9.0; Scala format and license checks. Validate binary compatibility with MiMa and unchanged Pekko HTTP 2.0.0 Java and Scala consumers. References ---------- RFC 9113 section 8.3.1 and RFC 9110 section 9.3.7 apache#981 Co-authored-by: PJ Fanning <pjfanning@users.noreply.github.com>
1b47818 to
c8aa427
Compare
Motivation ---------- An HTTP/2 application needs to distinguish server-wide OPTIONS from OPTIONS on the root resource without changing default routing behavior. Modification ------------ Add a default-off server setting and a typed request attribute in Java and Scala. Store opt-in choices together in the existing settings slot, keeping its original constructor and copy signatures. A legacy settings update transfers only the legacy value, not another instance's opt-in. Result ------ Applications can handle OPTIONS * explicitly. Normal targets and outbound request rendering are unchanged. When disabled, the settings slot retains the old representation. Tests ----- Six focused settings tests each on Scala 2.13.18, 3.3.9 and 3.9.0; Scala format and license checks. Validate binary compatibility with MiMa and unchanged Pekko HTTP 2.0.0 Java and Scala consumers. References ---------- RFC 9113 section 8.3.1 and RFC 9110 section 9.3.7 apache#981 Co-authored-by: PJ Fanning <pjfanning@users.noreply.github.com>
c8aa427 to
45aa908
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks for the update; the public acceptAsteriskOptions / withAcceptAsteriskOptions API and @since tags look good. The open thread on internalSettings still stands. New points:
- Docs (should-fix): on HTTP/1.1,
OPTIONS *always reaches the application with no opt-in:HttpServerBluePrintturnsUri(authority = Host("*"))into the effective URIhttp://*with an empty path, sopathEnd/pathEndOrSingleSlashmatch it just as on HTTP/2. Inuri-model.md, "the default is off, so existing routes do not start receiving these requests" and "check the attribute before dispatching" only hold for HTTP/2, and a handler that checks only the attribute will treat HTTP/1.1OPTIONS *asOPTIONS /. Could the docs give the HTTP/1.1 check too (e.g.request.uri.authority.host.address == "*"), or recommend checking both so one handler works for both protocols? - Nit: the new test in
HttpMessageRenderingSpeccan't fail because of this change, since HTTP/2 request rendering never reads request attributes. Fine as a guard, but a short comment saying so would help. - Nit: the Tests section of the description still lists "three HTTP/2 request parsing cases"; the branch now also has the rejection cases.
Motivation: An HTTP/2 server needs to distinguish a server-wide OPTIONS request from the ordinary root resource without changing the existing default or rewriting an outbound request. Modification: Retain the default-off Scala and Java opt-in and the typed request attribute. Store the option in its own immutable implementation field, not in the internal settings slot. Preserve the published constructor and inferred copy entry points. Document the distinct existing HTTP/1.1 representation and the opt-in HTTP/2 one. Result: The opt-in and internal settings compose independently across ordinary withers and copies. The request attribute is not rendered on outbound requests. Existing HTTP/1.1 handling is unchanged. Tests: JDK 17, Scala 2.13.18 and 3.3.9: six scoped settings tests per version. On each version, scoped MiMa against 2.0.0 and old JVM consumer linkage passed, without new filters. The two ordinary HTTP/2 handler/renderer cases passed on Scala 2.13. No full CI. References: RFC 9113 section 8.3.1 and PJF feedback on apache#981. Co-authored-by: PJ Fanning <pjfanning@users.noreply.github.com>
45aa908 to
640aecf
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.
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: HTTP/2 applications need to distinguish server-wide OPTIONS from an ordinary resource request without changing default request routing. Modification: Use the opt-in HTTP/2 server setting and a typed asterisk request attribute, preserving the effective scheme and authority. Assert an ordinary OPTIONS root remains ordinary when its query is present, even an empty query. Preserve the released internal settings factory, constructor and copy entries. Keep HTTP/1.x behavior and outbound request rewriting independent of the marker. Result: Applications can identify server-wide requests explicitly, without changing existing default routing or ordinary OPTIONS query handling. Tests: - Six named positive cases passed with JDK 17 on Scala 2.13.18 and 3.3.9, compiling the exact changed sources against current-main build outputs. - JVM descriptor checks and direct calls compiled against Pekko HTTP 2.0.0 passed on both axes. Scoped Scalafmt and whitespace checks passed. - Full CI was not run. References: Refs apache#981 - RFC 9113 §8.3.1 (erratum 9175 held) and RFC 9110 §9.3.7.
640aecf to
14200db
Compare
Motivation: A valid HTTP/1.1 OPTIONS * request exposed "*" as the effective URI host instead of the authority from Host. The asterisk form provides no authority or path and query for target URI reconstruction. Modification: Preserve the raw asterisk target, but pass an empty target URI to the existing effective URI reconstruction for successfully parsed HTTP/1.1 OPTIONS * requests. Document the observable behavior change. Keep the existing Accept negotiation release note when resolving the rebase. Result: The effective URI now uses the Host authority with an empty path and no query. Applications can still opt in to capture the literal target through Raw-Request-URI. Origin-form OPTIONS is unchanged. Tests: - Prior scoped JDK 17 runs on Scala 2.13.18 and 3.3.9: 4/4 on each axis; the two asterisk cases failed on the old baseline and both origin-form controls passed. - This rebase preserves the tested source and fixture except for an independent comment already on main. The release-note conflict is resolved without changing either entry. Patch whitespace checked. No tests rerun on this rebased commit. References: None - RFC 9112 sections 3.2.4 and 3.3. HTTP/2 work in apache#981 is separate.
Motivation: A valid HTTP/1.1 OPTIONS * request exposed "*" as the effective URI host instead of the authority from Host. The asterisk form provides no authority or path and query for target URI reconstruction. Modification: Preserve the raw asterisk target, but pass an empty target URI to the existing effective URI reconstruction for successfully parsed HTTP/1.1 OPTIONS * requests. Document the observable behavior change. Keep the existing Accept negotiation release note when resolving the rebase. Result: The effective URI now uses the Host authority with an empty path and no query. Applications can still opt in to capture the literal target through Raw-Request-URI. Origin-form OPTIONS is unchanged. Tests: - Prior scoped JDK 17 runs on Scala 2.13.18 and 3.3.9: 4/4 on each axis; the two asterisk cases failed on the old baseline and both origin-form controls passed. - This rebase preserves the tested source and fixture except for an independent comment already on main. The release-note conflict is resolved without changing either entry. Patch whitespace checked. No tests rerun on this rebased commit. References: None - RFC 9112 sections 3.2.4 and 3.3. HTTP/2 work in #981 is separate.
Motivation: HTTP/2 applications need to distinguish server-wide OPTIONS from an ordinary resource request without changing default request routing. Modification: Use the opt-in HTTP/2 server setting and a typed asterisk request attribute, preserving the effective scheme and authority. Assert an ordinary OPTIONS root remains ordinary when its query is present, even an empty query. Preserve the released internal settings factory, constructor and copy entries. Keep HTTP/1.x behavior and outbound request rewriting independent of the marker. Result: Applications can identify server-wide requests explicitly, without changing existing default routing or ordinary OPTIONS query handling. Tests: - Six named positive cases passed with JDK 17 on Scala 2.13.18 and 3.3.9, compiling the exact changed sources against current-main build outputs. - JVM descriptor checks and direct calls compiled against Pekko HTTP 2.0.0 passed on both axes. Scoped Scalafmt and whitespace checks passed. - Full CI was not run. References: Refs apache#981 - RFC 9113 §8.3.1 (erratum 9175 held) and RFC 9110 §9.3.7.
14200db to
8543e47
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.
Motivation
HTTP/2 applications need to distinguish a server-wide
OPTIONS *request fromOPTIONS /without changing the default routing behavior or interfering with outbound URI rewriting.Modification
Add a typed, independent
acceptAsteriskOptionsflag, default off, in the Scala and Java HTTP/2 server settings. It does not wrap or change the originalinternalSettingsslot. When enabled, retain the effective URI scheme and authority and expose*usingAttributeKeys.asteriskRequestTarget, without a syntheticRaw-Request-URIheader. The guide explains how to identify server-wide OPTIONS on both HTTP/1.1 and HTTP/2. Ordinary path parsing and CONNECT behavior are unchanged.Result
Without opt-in, an HTTP/2 server continues rejecting
OPTIONS *. With opt-in, application handlers can distinguish it fromOPTIONS /. The attribute is not written to the wire and does not override a rewritten outbound URI. HTTP/1.1 wire and request-model behavior remain unchanged.Tests
References