Skip to content

Commit

Permalink
Improve tolerance of If-Modified-Since time point comparison (#168)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Jul 29, 2024
1 parent abe6873 commit 9af3480
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/httpserver/request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ auto ServerRequest::header_if_modified_since(
return true;
}

// We have seen than on Docker, time comparison can be flaky, but adding
// a bit of tolerance leads to more consistent behavior.
return (if_modified_since.value() + std::chrono::microseconds(100)) <
// Time comparison can be flaky, but adding a bit of tolerance leads
// to more consistent behavior.
return (if_modified_since.value() + std::chrono::milliseconds(1)) <
last_modified;
// If there is an error parsing the `If-Modified-Since` timestamp, don't
// abort, but lean on the safe side: the requested resource has been
Expand Down

0 comments on commit 9af3480

Please sign in to comment.