Skip to content

Honour an If-Range date only if it is a strong validator (#1742) - #1745

Merged
thboileau-git merged 1 commit into
2.6from
fix/1742-if-range-strong-date-2.6
Nov 28, 2026
Merged

thboileau-git merged 1 commit into
2.6from
fix/1742-if-range-strong-date-2.6

Conversation

@thboileau-git

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

Copy link
Copy Markdown
Collaborator

Fixes #1742

RFC 9110 section 13.1.5: a server must ignore an If-Range date unless it is a strong validator, i.e. the Last-Modified is at least one second older than the response (section 8.8.2.2). Conditions.getRangeStatus only tested that the two dates were equal, so a resource modified less than a second ago was served as 206 instead of a full 200.

  • DateUtils.isStrong(modificationDate, referenceDate) holds the rule, shared with Conditions.unchangedSince.
  • getRangeStatus also requires the modification date to be strong against the current time (the response Date is written later, so it cannot be earlier). A weak date means the range is ignored and the whole entity is sent. No new public API.
  • The Date fallback of HeaderUtils (invalid header replaced by the reception time) is unchanged: RFC 9110 section 6.6.1 allows it. Only the Javadoc of unchangedSince mentions it.
  • Tests (red first): ConditionsTestCase, RangeFilterTestCase, wire-level RangeRequestEndToEndTestCase, DateUtilsTestCase.

Same fix on the other maintained versions: 3.0: #1743, 2.7: #1744

🤖 Generated with Claude Code

RFC 9110 section 13.1.5: a server must ignore an If-Range date unless it
is a strong validator, i.e. the Last-Modified is at least one second older
than the response (section 8.8.2.2). Conditions.getRangeStatus only tested
that the two dates were equal, so a resource modified less than a second
ago was served as a 206 instead of a full 200.

DateUtils.isStrong holds the rule, shared with Conditions.unchangedSince.

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

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.6% Duplication on New Code (required ≤ 3%)
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@thboileau-git
thboileau-git merged commit fbda469 into 2.6 Nov 28, 2026
2 of 3 checks passed
@thboileau-git
thboileau-git deleted the fix/1742-if-range-strong-date-2.6 branch November 28, 2026 14:28
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