Get time once when checking cookie expiration.

This commit is contained in:
Sergio Benitez 2018-04-18 09:22:11 -07:00
parent 46b56f11e7
commit 6e34a04188
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}