[前][次][番号順一覧][スレッド一覧]

ruby-changes:24801

From: naruse <ko1@a...>
Date: Thu, 30 Aug 2012 09:22:44 +0900 (JST)
Subject: [ruby-changes:24801] naruse:r36852 (trunk): * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"

naruse	2012-08-30 09:22:11 +0900 (Thu, 30 Aug 2012)

  New Revision: 36852

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36852

  Log:
    * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
      is not present [ruby-core:47344] [Bug #6945]

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/ftp.rb
    trunk/test/uri/test_ftp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36851)
+++ ChangeLog	(revision 36852)
@@ -1,3 +1,8 @@
+Thu Aug 30 09:21:01 2012  NARUSE, Yui  <naruse@r...>
+
+	* 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  <luislavena@g...>
 
 	* test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
Index: lib/uri/ftp.rb
===================================================================
--- lib/uri/ftp.rb	(revision 36851)
+++ lib/uri/ftp.rb	(revision 36852)
@@ -135,6 +135,7 @@
     # +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
Index: test/uri/test_ftp.rb
===================================================================
--- test/uri/test_ftp.rb	(revision 36851)
+++ test/uri/test_ftp.rb	(revision 36852)
@@ -27,6 +27,10 @@
     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.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]