diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-30 15:57:06 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-30 15:57:06 +0000 |
commit | 16310405170cf26f2412622ee7978e8d5a05d61b (patch) | |
tree | 52bab2d99bf0b396006e1f285578bcca1c3f9f12 | |
parent | 6468b9bec07ae06fedfe431efca42fd38877d0c7 (diff) |
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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/uri/generic.rb | 2 | ||||
-rw-r--r-- | test/uri/test_generic.rb | 9 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 18 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Sat Oct 1 00:56:19 2016 Aaron Patterson <tenderlove@ruby-lang.org> + + * 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 <usa@ruby-lang.org> * 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' @@ -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 |