ruby-changes:13130
From: akr <ko1@a...>
Date: Sun, 13 Sep 2009 02:14:28 +0900 (JST)
Subject: [ruby-changes:13130] Ruby:r24879 (ruby_1_8): * lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling.
akr 2009-09-13 02:14:15 +0900 (Sun, 13 Sep 2009) New Revision: 24879 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24879 Log: * lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling. * lib/open-uri.rb (URI::FTP#buffer_open): use the port specified in the URI. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/open-uri.rb Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 24878) +++ ruby_1_8/ChangeLog (revision 24879) @@ -1,3 +1,10 @@ +Sun Sep 13 01:55:32 2009 Tanaka Akira <akr@f...> + + * lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling. + + * lib/open-uri.rb (URI::FTP#buffer_open): use the port specified in + the URI. + Sat Sep 12 13:29:58 2009 Masaki Suketa <masaki.suketa@n...> * ext/win32ole/win32ole.c (EVENTSINK_Invoke): initialize result Index: ruby_1_8/lib/open-uri.rb =================================================================== --- ruby_1_8/lib/open-uri.rb (revision 24878) +++ ruby_1_8/lib/open-uri.rb (revision 24879) @@ -748,8 +748,9 @@ end require 'net/ftp' - directories = self.path.split(%r{/}, -1) - directories.shift if directories[0] == '' # strip a field before leading slash + path = self.path + path = path.sub(%r{\A/}, '%2F') # re-encode the beginning slash because uri library decodes it. + directories = path.split(%r{/}, -1) directories.each {|d| d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") } } @@ -770,7 +771,8 @@ end # The access sequence is defined by RFC 1738 - ftp = Net::FTP.open(self.host) + ftp = Net::FTP.new + ftp.connect(self.host, self.port) ftp.passive = true if !options[:ftp_active_mode] # todo: extract user/passwd from .netrc. user = 'anonymous' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/