aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-18 19:46:43 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-18 19:46:43 +0100
commit6edbc658472a552da3b26f32773a8fa97b51aff8 (patch)
treeef395ce65b61a097702c60b2e3a41922594abd80 /src/api
parentbfa0ff8f82c88ea3ea606bf0fcce60d36f9716ac (diff)
downloadgarage-6edbc658472a552da3b26f32773a8fa97b51aff8.tar.gz
garage-6edbc658472a552da3b26f32773a8fa97b51aff8.zip
Add trinity's comment in the code
Diffstat (limited to 'src/api')
-rw-r--r--src/api/s3_get.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/api/s3_get.rs b/src/api/s3_get.rs
index 0e3caad6..2590c9bd 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<Body>,
) -> Option<Response<Body>> {
+ // <trinity> 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);