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

ruby-changes:10596

From: knu <ko1@a...>
Date: Mon, 9 Feb 2009 12:15:58 +0900 (JST)
Subject: [ruby-changes:10596] Ruby:r22153 (ruby_1_8): r22142@crimson: knu | 2009-02-08 22:27:31 +0900

knu	2009-02-09 12:15:48 +0900 (Mon, 09 Feb 2009)

  New Revision: 22153

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

  Log:
     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.

  Modified directories:
    branches/ruby_1_8/
  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 22152)
+++ ruby_1_8/ChangeLog	(revision 22153)
@@ -8,6 +8,9 @@
 	  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@f...>
 
Index: ruby_1_8/lib/open-uri.rb
===================================================================
--- ruby_1_8/lib/open-uri.rb	(revision 22152)
+++ ruby_1_8/lib/open-uri.rb	(revision 22153)
@@ -98,6 +98,7 @@
     :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 @@
     # 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 @@
 
       # 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

Property changes on: ruby_1_8
___________________________________________________________________
Name: svk:merge
   - 050cfa88-b445-4b2e-b226-957b86f2c464:/local/ruby/1.8:22141
b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk:5286
   + 050cfa88-b445-4b2e-b226-957b86f2c464:/local/ruby/1.8:22142
b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk:5286


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

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