Skip to content

Answer a HEAD request with a 304 like the GET request (#1738) - #1740

Merged
thboileau-git merged 1 commit into
2.7from
fix/1738-head-not-modified-headers-2.7
Nov 28, 2026
Merged

thboileau-git merged 1 commit into
2.7from
fix/1738-head-not-modified-headers-2.7

Conversation

@thboileau-git

@thboileau-git thboileau-git commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1738.

RFC 9110 §9.3.2 and §15.4.5: a HEAD request answered 304 is answered like the GET, with the validators and caching headers only (the server SHOULD NOT send other representation metadata). The server adapters tested the method HEAD before the status 304, so a HEAD answered 304 wrote all the entity headers (Content-Type, Last-Modified, ...) instead of the restricted set a GET 304 carries (NettyServerCall.prepareEntity in 3.0, ServerAdapter.commit in 2.7 and 2.6).

The 304 status is now tested first; the other statuses keep their path (the branches are exclusive on the status). No API change.

Tests: three added to the wire-level NotModifiedHeadersTestCase (HEAD 304 without Content-Type / Last-Modified, same header names as the GET 304, unconditional HEAD unchanged). changes.md updated.

Same fix on the other maintained versions: 3.0: #1739, 2.6: #1741

🤖 Generated with Claude Code

RFC 9110 sections 9.3.2 and 15.4.5: a 304 carries the validators and
caching headers only. The HEAD branch came first and wrote all the entity
headers (Content-Type, Last-Modified...) on a HEAD answered 304.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@thboileau-git
thboileau-git merged commit 1b298b5 into 2.7 Nov 28, 2026
6 checks passed
@thboileau-git
thboileau-git deleted the fix/1738-head-not-modified-headers-2.7 branch November 28, 2026 12:45
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.

A HEAD request answered 304 (Not Modified) carries all the entity headers

1 participant