topdown: Address negative duration for the current age of http response
The current age of a http response is calculated as the difference between the current time and the value contained in the "Date" response header. There are couple of scenarios that could lead to the current age being represented as a negative duration. 1. Since the value of "Date" response header is parsed using Go's time.Parse method, it does not contain a monotonic clock reading. As a result, the time.Sub method uses wall clock readings to determine the difference between current time and the parsed version of the response time. 2. The server could set a value for the "Date" response header which may not be a true indication of when the response was generated. This change updates the logic that determines whether a cached response is fresh or not, to treat the resposne as stale if the current response age is represented as a negative duration. Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
A
Ashutosh Narkar committed
8cb34e48c285a4448f8f91a215aba5c05c7ab9b1
Parent: 5433a93
Committed by Torin Sandall <torinsandall@gmail.com>
on 9/21/2020, 2:46:53 PM