mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-04-27 14:57:46 +00:00
HTTP::CookieJar#add: Use the hostname of domain_name.
This commit is contained in:
parent
a47a849387
commit
24e9b26004
1 changed files with 2 additions and 5 deletions
|
|
@ -23,12 +23,9 @@ class HTTP::CookieJar
|
||||||
|
|
||||||
# Add a +cookie+ to the jar and return self.
|
# Add a +cookie+ to the jar and return self.
|
||||||
def add(cookie)
|
def add(cookie)
|
||||||
normal_domain = cookie.domain.downcase
|
normal_domain = cookie.domain_name.hostname
|
||||||
|
|
||||||
@jar[normal_domain] ||= {} unless @jar.has_key?(normal_domain)
|
((@jar[normal_domain] ||= {})[cookie.path] ||= {})[cookie.name] = cookie
|
||||||
|
|
||||||
@jar[normal_domain][cookie.path] ||= {}
|
|
||||||
@jar[normal_domain][cookie.path][cookie.name] = cookie
|
|
||||||
|
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue