From 16310405170cf26f2412622ee7978e8d5a05d61b Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 30 Sep 2016 15:57:06 +0000 Subject: 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_2@56307 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 bef450bc7f..f8841f5e4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Oct 1 00:56:19 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 + Sat Oct 1 00:55:19 2016 NAKAMURA Usaku * io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if the diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 5c134e5924..c608f0b045 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -426,7 +426,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 37605d5de5..a225bc573c 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -741,6 +741,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 f629b02d0a..3e988431ad 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-10-01" -#define RUBY_PATCHLEVEL 376 +#define RUBY_PATCHLEVEL 377 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 10 -- cgit v1.2.3