From 57218cb85808af84611793239bfdd22b5ab43d31 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Thu, 11 Apr 2013 21:12:53 +0900 Subject: [PATCH] HTTP::CookieJar#cookies: accessed_at is updated in the underlying store. --- lib/http/cookie_jar.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/http/cookie_jar.rb b/lib/http/cookie_jar.rb index b08b0f1..e3712eb 100644 --- a/lib/http/cookie_jar.rb +++ b/lib/http/cookie_jar.rb @@ -70,12 +70,11 @@ class HTTP::CookieJar end alias << add - # Gets an array of cookies that should be sent for the URL/URI. + # Gets an array of cookies that should be sent for the URL/URI, + # updating the access time of each cookie. def cookies(url) now = Time.now - each(url).select { |cookie| - !cookie.expired? && (cookie.accessed_at = now) - }.sort + each(url).reject(&:expired?).sort end # Tests if the jar is empty. If `url` is given, tests if there is