From 37cc18d54bf008cf4ab8e0c39829f96efdfe037e Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 30 Aug 2012 00:22:11 +0000 Subject: [PATCH] * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//" is not present [ruby-core:47344] [Bug #6945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/uri/ftp.rb | 1 + test/uri/test_ftp.rb | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 089d0cf30fb42f..3e1dc9b5ce0df0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 30 09:21:01 2012 NARUSE, Yui + + * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//" + is not present [ruby-core:47344] [Bug #6945] + Thu Aug 30 07:45:12 2012 Luis Lavena * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 26e4bb83260240..971684a5459661 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -135,6 +135,7 @@ def self.build(args) # +opaque+, +query+ and +fragment+, in that order. # def initialize(*arg) + raise InvalidURIError unless arg[5] arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/') super(*arg) @typecode = nil diff --git a/test/uri/test_ftp.rb b/test/uri/test_ftp.rb index 0d76c4497b8e90..cc6843e60f293a 100644 --- a/test/uri/test_ftp.rb +++ b/test/uri/test_ftp.rb @@ -27,6 +27,10 @@ def test_parse assert_equal('pass', url.password) end + def test_parse_invalid + assert_raise(InvalidURIError){URI.parse('ftp:example')} + end + def test_paths # If you think what's below is wrong, please read RubyForge bug 2055, # RFC 1738 section 3.2.2, and RFC 2396.