summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2023-02-23 12:41:50 +0900
committernagachika <nagachika@ruby-lang.org>2023-02-23 12:41:50 +0900
commit4141989b2aef2993bb19140a4be355d1c68b8be1 (patch)
tree7b5dace128591b4db4853adb008afbf87248ebb4
parenta4ab9921a15fccca606e5f1ec741f802d39392b1 (diff)
downloadruby-4141989b2aef2993bb19140a4be355d1c68b8be1.tar.gz
merge revision(s) 656f25987cf2885104d5b13c8d3f5b7d32f1b333,98074a57ca9f3169fe9da9af6c49b636d37db16f,745dcf5326ea2c8e2047a3bddeb0fbb7e7d07649,b335d899fff3cc22b022c9ee2ceb636d714bf1a7: [Backport #19153]
[ruby/cgi] Fix test_cgi_cookie_new_with_domain to pass on older rubies https://github.com/ruby/cgi/commit/05f0c58048 --- test/cgi/test_cgi_cookie.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) [ruby/cgi] Prepare to release 0.3.6 https://github.com/ruby/cgi/commit/710a647855 --- lib/cgi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) [ruby/cgi] Loosen the domain regex to accept '.' (https://github.com/ruby/cgi/pull/29) * Loosen the domain regex to accept '.' Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> https://github.com/ruby/cgi/commit/5e09d632f3 Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> --- lib/cgi/cookie.rb | 2 +- test/cgi/test_cgi_cookie.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) [ruby/cgi] Bump up 0.3.6 https://github.com/ruby/cgi/commit/827b7d43cc --- lib/cgi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
-rw-r--r--lib/cgi.rb2
-rw-r--r--lib/cgi/cookie.rb2
-rw-r--r--test/cgi/test_cgi_cookie.rb11
-rw-r--r--version.h8
4 files changed, 13 insertions, 10 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index dda5eb1712..4cd6b3bd8e 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -288,7 +288,7 @@
#
class CGI
- VERSION = "0.3.5"
+ VERSION = "0.3.6"
end
require 'cgi/core'
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index 1a9c1a82c1..9498e2f9fa 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -42,7 +42,7 @@ class CGI
TOKEN_RE = %r"\A[[!-~]&&[^()<>@,;:\\\"/?=\[\]{}]]+\z"
PATH_VALUE_RE = %r"\A[[ -~]&&[^;]]*\z"
- DOMAIN_VALUE_RE = %r"\A(?<label>(?!-)[-A-Za-z0-9]+(?<!-))(?:\.\g<label>)*\z"
+ DOMAIN_VALUE_RE = %r"\A\.?(?<label>(?!-)[-A-Za-z0-9]+(?<!-))(?:\.\g<label>)*\z"
# Create a new CGI::Cookie object.
#
diff --git a/test/cgi/test_cgi_cookie.rb b/test/cgi/test_cgi_cookie.rb
index e3ec4bea52..eadae45313 100644
--- a/test/cgi/test_cgi_cookie.rb
+++ b/test/cgi/test_cgi_cookie.rb
@@ -62,18 +62,21 @@ class CGICookieTest < Test::Unit::TestCase
def test_cgi_cookie_new_with_domain
h = {'name'=>'name1', 'value'=>'value1'}
- cookie = CGI::Cookie.new('domain'=>'a.example.com', **h)
+ cookie = CGI::Cookie.new(h.merge('domain'=>'a.example.com'))
assert_equal('a.example.com', cookie.domain)
- cookie = CGI::Cookie.new('domain'=>'1.example.com', **h)
+ cookie = CGI::Cookie.new(h.merge('domain'=>'.example.com'))
+ assert_equal('.example.com', cookie.domain)
+
+ cookie = CGI::Cookie.new(h.merge('domain'=>'1.example.com'))
assert_equal('1.example.com', cookie.domain, 'enhanced by RFC 1123')
assert_raise(ArgumentError) {
- CGI::Cookie.new('domain'=>'-a.example.com', **h)
+ CGI::Cookie.new(h.merge('domain'=>'-a.example.com'))
}
assert_raise(ArgumentError) {
- CGI::Cookie.new('domain'=>'a-.example.com', **h)
+ CGI::Cookie.new(h.merge('domain'=>'a-.example.com'))
}
end
diff --git a/version.h b/version.h
index c192428aba..6627f91e2b 100644
--- a/version.h
+++ b/version.h
@@ -11,11 +11,11 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 188
+#define RUBY_PATCHLEVEL 189
-#define RUBY_RELEASE_YEAR 2022
-#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 17
+#define RUBY_RELEASE_YEAR 2023
+#define RUBY_RELEASE_MONTH 2
+#define RUBY_RELEASE_DAY 23
#include "ruby/version.h"