Skip to content

Commit

Permalink
fix weak eTag handling of If-Match and If-None-Match headers
Browse files Browse the repository at this point in the history
* they were not supporting both variants, but "If-Match" header assumed strong etags and "If-None-Match" assumed weak etags
  • Loading branch information
thjaeckle committed Apr 5, 2024
1 parent 6ee7ce0 commit c2a8f06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -59,7 +59,13 @@ public boolean meetsConditionFor(@Nullable final EntityTag entityTag) {
return false;
}

return entityTagsToMatch.stream().anyMatch(entityTagToMatch -> entityTagToMatch.strongMatch(entityTag));
return entityTagsToMatch.stream().anyMatch(entityTagToMatch -> {
if (entityTag.isWeak()) {
return entityTagToMatch.weakMatch(entityTag);
} else {
return entityTagToMatch.strongMatch(entityTag);
}
});
}

/**
Expand Down
Expand Up @@ -56,7 +56,13 @@ public boolean meetsConditionFor(@Nullable final EntityTag entityTag) {
return true;
}

return entityTagsToMatch.stream().noneMatch(entityTagToMatch -> entityTagToMatch.weakMatch(entityTag));
return entityTagsToMatch.stream().noneMatch(entityTagToMatch -> {
if (entityTag.isWeak()) {
return entityTagToMatch.weakMatch(entityTag);
} else {
return entityTagToMatch.strongMatch(entityTag);
}
});
}

/**
Expand Down

0 comments on commit c2a8f06

Please sign in to comment.