Skip to content

Commit

Permalink
Also match weakly validated ETags (#28957)
Browse files Browse the repository at this point in the history
  • Loading branch information
cchangwen and delvh authored Jan 29, 2024
1 parent 2a50d78 commit 28fe3db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/httpcache/httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func checkIfNoneMatchIsValid(req *http.Request, etag string) bool {
ifNoneMatch := req.Header.Get("If-None-Match")
if len(ifNoneMatch) > 0 {
for _, item := range strings.Split(ifNoneMatch, ",") {
item = strings.TrimSpace(item)
item = strings.TrimPrefix(strings.TrimSpace(item), "W/") // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#directives
if item == etag {
return true
}
Expand Down

0 comments on commit 28fe3db

Please sign in to comment.