From d45d826f94fcc41d3ff351087631c4a0be2bcf18 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 25 Sep 2016 21:33:38 +0000 Subject: [PATCH] merge revision(s) 56166: [Backport #12766] * lib/uri/generic.rb (def check_password): don't include bad password in URI exception output * test/uri/test_generic.rb (def test_set_component): test for behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/uri/generic.rb | 2 +- test/uri/test_generic.rb | 9 +++++++++ version.h | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef2b7f7f6d..af15d6e156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Sep 26 06:33:16 2016 Aaron Patterson + + * lib/uri/generic.rb (def check_password): don't include bad password + in URI exception output + + * test/uri/test_generic.rb (def test_set_component): test for behavior + Mon Sep 26 06:20:58 2016 CHIKANAGA Tomoyuki * tool/downloader.rb: comment out gem package verification. diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index aba54c14b6..85d42d7bd2 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -428,7 +428,7 @@ module URI if parser.regexp[:USERINFO] !~ v raise InvalidComponentError, - "bad component(expected user component): #{v}" + "bad password component" end return true diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index a427809daf..002fcc4a3b 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -749,6 +749,15 @@ class URI::TestGeneric < Test::Unit::TestCase assert_equal('foo:xyzzy', uri.to_s) end + def test_bad_password_component + uri = URI.parse('http://foo:bar@baz') + password = 'foo@bar' + e = assert_raise(URI::InvalidComponentError) do + uri.password = password + end + refute_match password, e.message + end + def test_set_scheme uri = URI.parse 'HTTP://example' diff --git a/version.h b/version.h index d0b25e1bd6..db5cbf7f5b 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-09-26" -#define RUBY_PATCHLEVEL 186 +#define RUBY_PATCHLEVEL 187 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 9