зеркало из https://github.com/github/ruby.git
[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>
This commit is contained in:
Родитель
1612d57691
Коммит
745dcf5326
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -65,6 +65,9 @@ class CGICookieTest < Test::Unit::TestCase
|
|||
cookie = CGI::Cookie.new(h.merge('domain'=>'a.example.com'))
|
||||
assert_equal('a.example.com', cookie.domain)
|
||||
|
||||
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')
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче