Project

General

Profile

« Previous | Next » 

Revision 63634928

Added by nagachika (Tomoyuki Chikanaga) about 4 years ago

merge revision(s) 990baec41174a0b4cf7e285cf3185b4ab444437e:

    [ruby/net-ftp] Close the passive connection data socket if there is
     an error setting up the transfer

    Previously, the connection leaked in this case.  This uses
    begin/ensure and checking for an error in the ensure block.

    An alternative approach would be to not even perform the
    connection until after the RETR (or other) command has been
    sent.  However, I'm not sure all FTP servers support that.
    The current behavior is:

    * Send (PASV/EPSV)
    * Connect to the host/port returned in 227/229 reply
    * Send (RETR/other command)

    Changing it to connect after the RETR could break things.
    FTP servers might expect that the client has already
    connected before sending the RETR.  The alternative
    approach is more likely to introduce backwards compatibility
    issues, compared to the begin/ensure approach taken here.

    Fixes Ruby Bug 17027

    https://github.com/ruby/net-ftp/commit/6e8535f076
    ---
     lib/net/ftp.rb           | 24 ++++++++++++++----------
     test/net/ftp/test_ftp.rb | 39 +++++++++++++++++++++++++++++++++++++--
     2 files changed, 51 insertions(+), 12 deletions(-)