Skip to content

test: cover HTTP/2 cache metadata and declared trailers - #1861

Merged
He-Pin merged 1 commit into
apache:mainfrom
He-Pin:test/http2-response-metadata-and-declared-trailers
Nov 29, 2026
Merged

He-Pin merged 1 commit into
apache:mainfrom
He-Pin:test/http2-response-metadata-and-declared-trailers

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 28, 2026

Copy link
Copy Markdown
Member

Motivation

Pin two native HTTP/2 response behaviors that were not directly covered.

Modification

  • Verify that a 304 response to a conditional GET carries the application's ETag, Vary, and Cache-Control in the initial HEADERS and ends the stream there.
  • Extend the strict-response trailers test to verify the initial Trailer declaration, the non-terminal DATA frame, and the exact fields in the terminal HEADERS.

Result

Two focused checks in Http2ServerSpec; no production changes. Both passed on Scala 2.13.18 and 3.3.9 (JDK 21). The final single-file formatting check also passed; the formatter changed only line wrapping and indentation in the new request call.

RFC 9110 §6.6.2, §15.4.5, and RFC 9113 §8.1.

Assert cache fields and END_STREAM on a 304 response to a conditional GET.
Assert the initial Trailer declaration, non-terminal DATA, and exact fields in terminal HEADERS on a strict response.

RFC 9110 sections 6.6.2 and 15.4.5; RFC 9113 section 8.1.
@He-Pin
He-Pin marked this pull request as ready for review November 28, 2026 18:46
@He-Pin
He-Pin requested a review from pjfanning November 28, 2026 18:46

@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.

Test-only change, reads fine and CI is green. Looks good to me.

@He-Pin
He-Pin merged commit 7576511 into apache:main Nov 29, 2026
6 checks passed
@He-Pin
He-Pin deleted the test/http2-response-metadata-and-declared-trailers branch November 29, 2026 11:37
He-Pin added a commit to He-Pin/incubator-pekko-http that referenced this pull request Nov 29, 2026
### Motivation

A native HTTP/2 conditional GET can return a bodyless 304 and advertise the known length of the selected representation. Preserve this opt-in behavior while integrating current main.

### Modification

Keep the existing Scala and Java opt-in and emit the explicit length once for a native HTTP/2 conditional GET. Default omission, transparent HEAD, HTTP/1.1, and h2c replay stay unchanged; no length is inferred from the 304 entity. Resolve the conflicts while preserving apache#1868’s conditional precedence and apache#1861’s test coverage.

### Result

Independent source review passed. On JDK 17, four focused cases passed on each of Scala 2.13.18 and 3.3.9. Scoped formatting passed for seven Scala files, and the Paradox documentation build passed.

### References

- [RFC 9110 §8.6](https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6)
- [RFC 9113 §8.1.1](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.1.1)
@pjfanning pjfanning added this to the 2.1.0 milestone Nov 29, 2026
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