From 82deac2f19fe8bdea39a8e9c2f53b08c04e56105 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Mon, 22 Oct 2012 14:50:13 +0900 Subject: [PATCH] HTTP::Cookie#origin=: Acceptability check must be performed after setting the domain and path. --- lib/http/cookie.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/http/cookie.rb b/lib/http/cookie.rb index 517b998..e4d1bfa 100644 --- a/lib/http/cookie.rb +++ b/lib/http/cookie.rb @@ -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