HTTP::Cookie#origin=: Acceptability check must be performed after setting the domain and path.

This commit is contained in:
Akinori MUSHA 2012-10-22 14:50:13 +09:00
parent fa45e028a7
commit 82deac2f19

View file

@ -307,10 +307,10 @@ class HTTP::Cookie
@origin.nil? or
raise ArgumentError, "origin cannot be changed once it is set"
origin = URI(origin)
acceptable_from_uri?(origin) or
raise ArgumentError, "unacceptable cookie sent from URI #{origin}"
self.domain ||= origin.host
self.path ||= (normalize_uri_path(origin) + './').path
acceptable_from_uri?(origin) or
raise ArgumentError, "unacceptable cookie sent from URI #{origin}"
@origin = origin
end