aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-14 08:08:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-14 08:08:51 +0000
commit8ead07182897bc4f70f2a74833e50ac8ab700fa9 (patch)
tree4ab2d54cef57ce367a5de6846f798cf27a3d0553 /lib/cgi.rb
parent657429b75b32a9554195e571668465a55f38a5bc (diff)
downloadruby-8ead07182897bc4f70f2a74833e50ac8ab700fa9.tar.gz
* lib/cgi.rb (CGI::Cookie::initialize): performance patch from
Makoto Kuwata <kwa@kuwata-lab.com> in [ruby-dev:34048]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 7997a58f4c..538b33380d 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -802,11 +802,16 @@ class CGI
#
# These keywords correspond to attributes of the cookie object.
def initialize(name = "", *value)
- options = if name.kind_of?(String)
- { "name" => name, "value" => value }
- else
- name
- end
+ if name.kind_of?(String)
+ @name = name
+ @value = value
+ %r|^(.*/)|.match(ENV["SCRIPT_NAME"])
+ @path = ($1 or "")
+ @secure = false
+ return super(@value)
+ end
+
+ options = name
unless options.has_key?("name")
raise ArgumentError, "`name' required"
end
@@ -890,7 +895,7 @@ class CGI
if cookies.has_key?(name)
values = cookies[name].value + values
end
- cookies[name] = Cookie::new({ "name" => name, "value" => values })
+ cookies[name] = Cookie::new(name, *values)
end
cookies