From: Simon Williams Date: 2007-02-06T18:19:44+09:00 Subject: Re: [PATCH] Net::FTP should check the control connection on EPIPE --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 06, 2007 at 11:23:01AM +0900, Shugo Maeda wrote: > Simon Williams wrote: > > This patch applies to the Net::FTP class that comes with Ruby 1.8.5. > > I merged your patch to SVN trunk. > Thanks for your contribution. No problem. Thanks for applying it. However, it appears that there wasn't enough context in the patch for it to apply to the correct place. Those two changes were supposed to be at the end of storbinary and storlines. I've attached a patch against revision 11638 in SVN trunk (with more context, this time). Thanks, -- Simon Williams --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ftp.rb.epipe.patch" --- ftp.rb.orig 2007-02-06 09:11:02.000000000 +0000 +++ ftp.rb 2007-02-06 09:15:28.000000000 +0000 @@ -288,19 +288,12 @@ # def voidcmd(cmd) synchronize do putline(cmd) voidresp end - rescue Errno::EPIPE - # EPIPE, in this case, means that the data connection was unexpectedly - # terminated. Rather than just raising EPIPE to the caller, check the - # response on the control connection. If getresp doesn't raise a more - # appropriate exception, re-raise the original exception. - getresp - raise end def sendport(host, port) af = (@sock.peeraddr)[0] if af == "AF_INET" hbytes = host.split(".") @@ -431,19 +424,12 @@ yield(data) end conn.close voidresp end end - rescue Errno::EPIPE - # EPIPE, in this case, means that the data connection was unexpectedly - # terminated. Rather than just raising EPIPE to the caller, check the - # response on the control connection. If getresp doesn't raise a more - # appropriate exception, re-raise the original exception. - getresp - raise end # # Puts the connection into ASCII (text) mode, issues the given command, and # passes the resulting data, one line at a time, to the associated block. If # no block is given, prints the lines. Note that +cmd+ is a server command @@ -489,12 +475,19 @@ yield(buf) if block end conn.close voidresp end end + rescue Errno::EPIPE + # EPIPE, in this case, means that the data connection was unexpectedly + # terminated. Rather than just raising EPIPE to the caller, check the + # response on the control connection. If getresp doesn't raise a more + # appropriate exception, re-raise the original exception. + getresp + raise end # # Puts the connection into ASCII (text) mode, issues the given server-side # command (such as "STOR myfile"), and sends the contents of the file # named +file+ to the server, one line at a time. If the optional block is @@ -514,12 +507,19 @@ yield(buf) if block end conn.close voidresp end end + rescue Errno::EPIPE + # EPIPE, in this case, means that the data connection was unexpectedly + # terminated. Rather than just raising EPIPE to the caller, check the + # response on the control connection. If getresp doesn't raise a more + # appropriate exception, re-raise the original exception. + getresp + raise end # # Retrieves +remotefile+ in binary mode, storing the result in +localfile+. # If +localfile+ is nil, returns retrieved data. # If a block is supplied, it is passed the retrieved data in +blocksize+ --Bn2rw/3z4jIqBvZU--