diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-09 03:15:48 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-09 03:15:48 +0000 |
| commit | 1cf094c5f2bf4cd40cac3e52df2879dc31ad94c9 (patch) | |
| tree | 163c8ec7beeff5d8bdddbbdbe5deb4447d3c5635 | |
| parent | 21bb30e6fdedd449a5d4e5c0f2c27f5383240583 (diff) | |
r22142@crimson: knu | 2009-02-08 22:27:31 +0900
(:ftp_active_mode) new option. (r13307)
(URI::FTP.buffer_open) turn ftp passive mode on if
:ftp_active_mode => false is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | lib/open-uri.rb | 11 |
2 files changed, 14 insertions, 0 deletions
@@ -8,6 +8,9 @@ Sun Feb 8 21:39:06 2009 Akinori MUSHA <knu@iDaemons.org> does not exist. [ruby-dev:27630] (r9500) (:ssl_verify_mode): new option suggested by Will Glynn. (r9958) (:ssl_ca_cert): new option. (r9958, r13691) + (:ftp_active_mode) new option. (r13307) + (URI::FTP.buffer_open) turn ftp passive mode on if + :ftp_active_mode => false is given. Mon Feb 9 01:21:16 2009 Tanaka Akira <akr@fsij.org> diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 2f3e5ce8ac..3995e305a1 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -98,6 +98,7 @@ module OpenURI :read_timeout => true, :ssl_ca_cert => nil, :ssl_verify_mode => nil, + :ftp_active_mode => true, } def OpenURI.check_options(options) # :nodoc: @@ -596,6 +597,15 @@ module OpenURI # 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=>false is used to make ftp passive 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 @@ -732,6 +742,7 @@ module URI # The access sequence is defined by RFC 1738 ftp = Net::FTP.open(self.host) + ftp.passive = true if !options[:ftp_active_mode] # todo: extract user/passwd from .netrc. user = 'anonymous' passwd = nil |
