Skip to content

fix: honor wildcard If-Match for date-only conditional requests - #1909

Closed
He-Pin wants to merge 2 commits into
apache:mainfrom
He-Pin:fix/date-only-put-if-match
Closed

He-Pin wants to merge 2 commits into
apache:mainfrom
He-Pin:fix/date-only-put-if-match

Conversation

@He-Pin

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

Copy link
Copy Markdown
Member

Motivation

A wildcard If-Match tests whether a selected representation exists. A route using only Last-Modified should not reject a matching wildcard PUT solely because a lower-priority date precondition is stale.

Modification

For a date-only known representation, evaluate the wildcard first and skip the date precondition if it matches. Keep the existing QUERY behavior, ETag comparisons, and evaluation of later preconditions.

Result

The real routing test confirms that the stale date alone returns 412 without running the route, and adding a matching wildcard lets the same PUT run. It failed at 412 versus 200 before the fix. After the fix, all 22 tests in the directive suite and scoped Scala formatting passed locally on JDK 21 / Scala 2.13.18.

Stacked on #1858. Review the child-only diff. GitHub cannot use the fork-only parent branch as an Apache base, so the hosted base is main. Merge #1858 first, then rebase this child onto current main and revalidate alongside #1881. Do not merge this child independently.

References

RFC 9110 §13.1.1 · §13.1.4 · §13.2.2

Motivation:
HTTP QUERY needs selected-result preconditions, structured format
advertisements, and opt-in byte ranges beyond method registration.

Modification:
Validate QUERY content metadata and evaluate preconditions against the
selected result. Model Accept-Query after collecting initial response
fields, leaving trailers unchanged. Add opt-in QUERY range handling
and apply the range count limit before selecting an entity strategy.
Reject unrepresentable parameters when building typed Accept-Query values.

Result:
Default GET handling is unchanged. QUERY preserves the full otherwise
successful response when If-Range has no matching strong validator.

Tests:
Exercise typed date and range routing, including streamed results,
as well as a native HTTP/2 exchange with two Accept-Query field lines.
Verify the Java strong Last-Modified overload with a matching date and
check the new range guide and migration notes.

References:
RFC 10008 sections 2 and 3, RFC 9110 sections 13 and 14, RFC 9651 section 4.2.
Motivation: A known representation must satisfy wildcard If-Match even when the route supplies only Last-Modified.

Modification: Skip If-Unmodified-Since for that matched wildcard, while retaining later preconditions and tagged behavior.

Result: A stale date alone still rejects PUT; the same request with a matching wildcard runs the route.

References: RFC 9110 §§13.1.1, 13.1.4 and 13.2.2; apache#1858.
@He-Pin

He-Pin commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

This change is now included in #1858 as commit b12651b. Closing the separate PR to keep the review in one place.

@He-Pin He-Pin closed this Nov 29, 2026
@He-Pin
He-Pin deleted the fix/date-only-put-if-match branch November 29, 2026 17:21
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