From 6edbc658472a552da3b26f32773a8fa97b51aff8 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 18 Mar 2021 19:46:43 +0100 Subject: [PATCH] Add trinity's comment in the code --- src/api/s3_get.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/s3_get.rs b/src/api/s3_get.rs index 0e3caad..2590c9b 100644 --- a/src/api/s3_get.rs +++ b/src/api/s3_get.rs @@ -45,6 +45,11 @@ fn try_answer_cached( version_meta: &ObjectVersionMeta, req: &Request, ) -> Option> { + // It is possible, and is even usually the case, [that both If-None-Match and + // If-Modified-Since] are present in a request. In this situation If-None-Match takes + // precedence and If-Modified-Since is ignored (as per 6.Precedence from rfc7232). The rational + // being that etag based matching is more accurate, it has no issue with sub-second precision + // for instance (in case of very fast updates) let cached = if let Some(none_match) = req.headers().get(http::header::IF_NONE_MATCH) { let none_match = none_match.to_str().ok()?; let expected = format!("\"{}\"", version_meta.etag);