ruby-changes:1816
From: ko1@a...
Date: 29 Aug 2007 18:38:44 +0900
Subject: [ruby-changes:1816] akr - Ruby:r13307 (trunk): * lib/open-uri.rb: add :ftp_active_mode option.
akr 2007-08-29 18:38:36 +0900 (Wed, 29 Aug 2007) New Revision: 13307 Modified files: trunk/ChangeLog trunk/lib/open-uri.rb Log: * lib/open-uri.rb: add :ftp_active_mode option. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13307&r2=13306 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/open-uri.rb?r1=13307&r2=13306 Index: ChangeLog =================================================================== --- ChangeLog (revision 13306) +++ ChangeLog (revision 13307) @@ -1,3 +1,7 @@ +Wed Aug 29 18:36:06 2007 Tanaka Akira <akr@f...> + + * lib/open-uri.rb: add :ftp_active_mode option. + Wed Aug 29 12:48:17 2007 Nobuyoshi Nakada <nobu@r...> * parse.y (aref_args): args may not be a list. [ruby-dev:31592] Index: lib/open-uri.rb =================================================================== --- lib/open-uri.rb (revision 13306) +++ lib/open-uri.rb (revision 13307) @@ -98,6 +98,7 @@ :read_timeout => true, :ssl_ca_cert => nil, :ssl_verify_mode => nil, + :ftp_active_mode => false, } def OpenURI.check_options(options) # :nodoc: @@ -607,6 +608,15 @@ # OpenURI::OpenRead#open returns an IO like object if block is not given. # Otherwise it yields the IO object and return the value of the block. # The IO object is extended with OpenURI::Meta. + # + # [:ftp_active_mode] + # Synopsis: + # :ftp_active_mode=>bool + # + # :ftp_active_mode=>true is used to make ftp active mode. + # Note that the active mode is default in Ruby 1.8 or prior. + # Ruby 1.9 uses passive mode by default. + # def open(*rest, &block) OpenURI.open_uri(self, *rest, &block) end @@ -743,7 +753,7 @@ # The access sequence is defined by RFC 1738 ftp = Net::FTP.open(self.host) - ftp.passive = true + ftp.passive = true if !options[:ftp_active_mode] # todo: extract user/passwd from .netrc. user = 'anonymous' passwd = nil -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml