diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-14 08:08:51 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-14 08:08:51 +0000 |
commit | 8ead07182897bc4f70f2a74833e50ac8ab700fa9 (patch) | |
tree | 4ab2d54cef57ce367a5de6846f798cf27a3d0553 /lib/cgi.rb | |
parent | 657429b75b32a9554195e571668465a55f38a5bc (diff) |
* 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.rb | 17 |
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 |