ruby-changes:34442
From: nagachika <ko1@a...>
Date: Tue, 24 Jun 2014 00:20:00 +0900 (JST)
Subject: [ruby-changes:34442] nagachika:r46523 (ruby_2_1): merge revision(s) r46182: [Backport #9872]
nagachika 2014-06-24 00:19:51 +0900 (Tue, 24 Jun 2014) New Revision: 46523 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46523 Log: merge revision(s) r46182: [Backport #9872] * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an exception occur. Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/lib/net/ftp.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 46522) +++ ruby_2_1/ChangeLog (revision 46523) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Tue Jun 24 00:14:20 2014 Tanaka Akira <akr@f...> + + * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an + exception occur. + Tue Jun 24 00:06:41 2014 Hiroshi Shirosaki <h.shirosaki@g...> * thread_win32.c (rb_w32_stack_overflow_handler): use Structured Index: ruby_2_1/lib/net/ftp.rb =================================================================== --- ruby_2_1/lib/net/ftp.rb (revision 46522) +++ ruby_2_1/lib/net/ftp.rb (revision 46523) @@ -420,23 +420,26 @@ module Net https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/net/ftp.rb#L420 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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 46522) +++ ruby_2_1/version.h (revision 46523) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-06-24" -#define RUBY_PATCHLEVEL 139 +#define RUBY_PATCHLEVEL 140 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46182 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/