ruby-changes:34496
From: usa <ko1@a...>
Date: Fri, 27 Jun 2014 17:05:51 +0900 (JST)
Subject: [ruby-changes:34496] usa:r46577 (ruby_2_0_0): merge revision(s) 46182: [Backport #9872]
usa 2014-06-27 17:05:43 +0900 (Fri, 27 Jun 2014) New Revision: 46577 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46577 Log: merge revision(s) 46182: [Backport #9872] * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an exception occur. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/net/ftp.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 46576) +++ ruby_2_0_0/ChangeLog (revision 46577) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Jun 27 17:05:23 2014 Tanaka Akira <akr@f...> + + * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an + exception occur. + Fri Jun 27 17:02:36 2014 Hiroshi Shirosaki <h.shirosaki@g...> * thread_win32.c (rb_w32_stack_overflow_handler): use Structured Index: ruby_2_0_0/lib/net/ftp.rb =================================================================== --- ruby_2_0_0/lib/net/ftp.rb (revision 46576) +++ ruby_2_0_0/lib/net/ftp.rb (revision 46577) @@ -419,23 +419,26 @@ module Net https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/net/ftp.rb#L419 end else sock = makeport - if @resume and rest_offset - resp = sendcmd("REST " + rest_offset.to_s) - if resp[0] != ?3 + begin + if @resume and rest_offset + resp = sendcmd("REST " + rest_offset.to_s) + if resp[0] != ?3 + raise FTPReplyError, resp + end + end + resp = sendcmd(cmd) + # skip 2XX for some ftp servers + resp = getresp if resp[0] == ?2 + if resp[0] != ?1 raise FTPReplyError, resp end + conn = BufferedSocket.new(sock.accept) + conn.read_timeout = @read_timeout + sock.shutdown(Socket::SHUT_WR) rescue nil + sock.read rescue nil + ensure + sock.close end - resp = sendcmd(cmd) - # skip 2XX for some ftp servers - resp = getresp if resp[0] == ?2 - if resp[0] != ?1 - raise FTPReplyError, resp - end - conn = BufferedSocket.new(sock.accept) - conn.read_timeout = @read_timeout - sock.shutdown(Socket::SHUT_WR) rescue nil - sock.read rescue nil - sock.close end return conn end Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 46576) +++ ruby_2_0_0/version.h (revision 46577) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-06-27" -#define RUBY_PATCHLEVEL 501 +#define RUBY_PATCHLEVEL 502 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46182 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/