Skip to content

Commit

Permalink
Polish ServletWebRequest
Browse files Browse the repository at this point in the history
Closes gh-33698
  • Loading branch information
smartandhandsome authored and sdeleuze committed Oct 14, 2024
1 parent b3cc9a2 commit ae32227
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,23 @@ public boolean checkNotModified(String etag) {

@Override
public boolean checkNotModified(@Nullable String etag, long lastModifiedTimestamp) {
if (this.notModified) {
return true;
}

HttpServletResponse response = getResponse();
if (this.notModified || (response != null && HttpStatus.OK.value() != response.getStatus())) {
return this.notModified;
if (response != null && HttpStatus.OK.value() != response.getStatus()) {
return false;
}

// Evaluate conditions in order of precedence.
// See https://datatracker.ietf.org/doc/html/rfc9110#section-13.2.2
if (validateIfMatch(etag)) {
updateResponseStateChanging(etag, lastModifiedTimestamp);
return this.notModified;
}
// 2) If-Unmodified-Since
else if (validateIfUnmodifiedSince(lastModifiedTimestamp)) {
if (validateIfUnmodifiedSince(lastModifiedTimestamp)) {
updateResponseStateChanging(etag, lastModifiedTimestamp);
return this.notModified;
}
Expand Down

0 comments on commit ae32227

Please sign in to comment.