From eed566debe11a12eb36a9aa6b8f950b2649f7047 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 16 Aug 2016 02:48:59 +0000 Subject: [PATCH] merge revision(s) 55563: [Backport #12498] * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque only if the URI has path-rootless, not path-empty. [ruby-core:76055] [Bug #12498] patched by Chris Heisterkamp git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/uri/mailto.rb | 3 +++ test/uri/test_mailto.rb | 10 ++++++---- version.h | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a37dcd9a1..ffcbe44f8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Aug 16 11:46:07 2016 NARUSE, Yui + + * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque + only if the URI has path-rootless, not path-empty. + [ruby-core:76055] [Bug #12498] + patched by Chris Heisterkamp + Tue Aug 16 04:57:28 2016 Shugo Maeda * lib/net/http/generic_request.rb (write_header): A Request-Line must diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index 495f939a3b..7299550d3f 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -136,6 +136,9 @@ module URI @to = nil @headers = [] + # The RFC3986 parser does not normally populate opaque + @opaque = "?#{@query}" if @query && !@opaque + unless @opaque raise InvalidComponentError, "missing opaque part for mailto URL" diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb index 4e3b0425fa..c09b001e0f 100644 --- a/test/uri/test_mailto.rb +++ b/test/uri/test_mailto.rb @@ -112,13 +112,15 @@ class TestMailTo < Test::Unit::TestCase bad << ["foo@example.jp?subject=1+1=2", []] ok.each do |x| - assert_equal(x[0], - @u.build(x[1]).to_s) - assert_equal(x[0], - @u.build(x[2]).to_s) + assert_equal(x[0], URI.parse(x[0]).to_s) + assert_equal(x[0], @u.build(x[1]).to_s) + assert_equal(x[0], @u.build(x[2]).to_s) end bad.each do |x| + assert_raise(URI::InvalidURIError) { + URI.parse(x) + } assert_raise(URI::InvalidComponentError) { @u.build(x) } diff --git a/version.h b/version.h index c27b5d876c..97b3a72414 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 163 +#define RUBY_PATCHLEVEL 164 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8