From 719fec0828ae52579dc11a708821701b3a09fbc1 Mon Sep 17 00:00:00 2001 From: Ana Gelez Date: Thu, 25 Jun 2020 22:26:44 +0200 Subject: [PATCH] Add a comment --- src/template_utils.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/template_utils.rs b/src/template_utils.rs index 25c703a36..0b1268492 100644 --- a/src/template_utils.rs +++ b/src/template_utils.rs @@ -63,6 +63,9 @@ impl<'r> Responder<'r> for Ructe { let etag = format!("{:x}", hasher.finish()); if r.headers() .get("If-None-Match") + // 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()