Skip to content

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

Merged
thboileau-git merged 2 commits into
3.0from
fix/1738-head-not-modified-headers
Nov 28, 2026
Merged

thboileau-git merged 2 commits into
3.0from
fix/1738-head-not-modified-headers

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: 2.7: #1740, 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]>
Reduces the cognitive complexity of the method from 16 to under 15; no
behavior change.

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

Copy link
Copy Markdown

@thboileau-git
thboileau-git merged commit 967fddd into 3.0 Nov 28, 2026
3 checks passed
@thboileau-git
thboileau-git deleted the fix/1738-head-not-modified-headers 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.

1 participant