Do not store a cookie if it is already expired at the time of adding.

This commit is contained in:
Akinori MUSHA 2013-03-14 11:24:43 +09:00
parent 1fcf008cf0
commit f60e678cb8

View file

@ -26,7 +26,13 @@ class HTTP::CookieJar
end
normal_domain = cookie.domain_name.hostname
((@jar[normal_domain] ||= {})[cookie.path] ||= {})[cookie.name] = cookie
path_cookies = ((@jar[normal_domain] ||= {})[cookie.path] ||= {})
if cookie.expired?
path_cookies.delete(cookie.name)
else
path_cookies[cookie.name] = cookie
end
self
end