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 | 6f94b4e8964b5ebc2a401408489e3365887066e4 (patch) | |
| tree | 4ab2d54cef57ce367a5de6846f798cf27a3d0553 | |
| parent | 9d215b7b97e2dde26fbb45525d210dc80feba738 (diff) | |
| download | ruby-6f94b4e8964b5ebc2a401408489e3365887066e4.tar.gz ruby-6f94b4e8964b5ebc2a401408489e3365887066e4.tar.xz ruby-6f94b4e8964b5ebc2a401408489e3365887066e4.zip | |
* lib/cgi.rb (CGI::Cookie::initialize): performance patch from
Makoto Kuwata <kwa@kuwata-lab.com> in [ruby-dev:34048].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/cgi.rb | 17 |
2 files changed, 16 insertions, 6 deletions
@@ -8,6 +8,11 @@ Fri Mar 14 16:59:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (RUBY_LIB_PREFIX): fix for prefix. +Fri Mar 14 16:35:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * lib/cgi.rb (CGI::Cookie::initialize): performance patch from + Makoto Kuwata <kwa@kuwata-lab.com> in [ruby-dev:34048]. + Fri Mar 14 15:49:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (RUBY_LIB_PREFIX): use libdir. diff --git a/lib/cgi.rb b/lib/cgi.rb index 7997a58f4..538b33380 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 |
