From 6e34a04188e1d0e9b1c8350c4f44732fd4257479 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 18 Apr 2018 09:22:11 -0700 Subject: [PATCH] Get time once when checking cookie expiration. --- lib/src/local/client.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/local/client.rs b/lib/src/local/client.rs index 4a4c955f..43ca3b83 100644 --- a/lib/src/local/client.rs +++ b/lib/src/local/client.rs @@ -155,9 +155,10 @@ impl Client { pub(crate) fn update_cookies(&self, response: &Response) { if let Some(ref jar) = self.cookies { let mut jar = jar.borrow_mut(); + let current_time = ::time::now(); for cookie in response.cookies() { if let Some(expires) = cookie.expires() { - if expires <= ::time::now() { + if expires <= current_time { jar.force_remove(cookie); continue; }