Skip to content

Commit

Permalink
Merge pull request 'better-caching' (#840) from better-caching into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KitaitiMakoto committed Dec 6, 2020
2 parents 963e742 + d44c034 commit 5099a00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/template_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ impl<'r> Responder<'r> for Ructe {
let etag = format!("{:x}", hasher.finish());
if r.headers()
.get("If-None-Match")
.any(|s| s[1..s.len() - 1] == etag)
// This check matches both weak and strong ETags
// NGINX (and maybe other software) sometimes sends ETags with a
// "W/" prefix, that we ignore here
.any(|s| s[1..s.len() - 1] == etag || s[3..s.len() - 1] == etag)
{
Response::build()
.status(Status::NotModified)
Expand Down

0 comments on commit 5099a00

Please sign in to comment.