Commit 385e612f authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- Armel Asselin improved libcurl to behave a lot better when an easy handle

  doing an FTP transfer is removed from a multi handle before completion. The
  fix also fixed the "alive counter" to be correct on "premature removal" for
  all protocols.
parent 18863887
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6,6 +6,12 @@

                                  Changelog

Daniel (16 January 2007)
- Armel Asselin improved libcurl to behave a lot better when an easy handle
  doing an FTP transfer is removed from a multi handle before completion. The
  fix also fixed the "alive counter" to be correct on "premature removal" for
  all protocols.

Dan F (16 January 2007)
- Fixed a small memory leak in tftp uploads discovered by curl's memory leak
  detector.  Also changed tftp downloads to URL-unescape the downloaded
+4 −1
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ This release includes the following bugfixes:
 o base64 encoding/decoding works on non-ASCII platforms
 o large file downloads
 o CURLOPT_COOKIELIST set to "ALL" crash
 o easy handle removal from multi handle before completion
 o TFTP upload memory leak

Other curl-related news:

@@ -71,6 +73,7 @@ advice from friends like these:
 Matt Witherspoon, Alexey Simak, Martin Skinner, Sh Diao, Jared Lundell,
 Stefan Krause, Sebastien Willemijns, Alexey Simak, Brendan Jurd,
 Robson Braga Araujo, David McCreedy, Robert Foreman, Nathanael Nerode,
 Victor Snezhko, Linus Nielsen Feltzing, Toby Peterson
 Victor Snezhko, Linus Nielsen Feltzing, Toby Peterson, Dan Fandrich, 
 Armel Asselin

        Thanks! (and sorry if I forgot to mention someone)
+4 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -165,7 +165,7 @@ CURLcode Curl_file_connect(struct connectdata *conn)
  file->fd = fd;
  if(!conn->data->set.upload && (fd == -1)) {
    failf(conn->data, "Couldn't open file %s", conn->data->reqdata.path);
    Curl_file_done(conn, CURLE_FILE_COULDNT_READ_FILE);
    Curl_file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE);
    return CURLE_FILE_COULDNT_READ_FILE;
  }

@@ -173,10 +173,11 @@ CURLcode Curl_file_connect(struct connectdata *conn)
}

CURLcode Curl_file_done(struct connectdata *conn,
                        CURLcode status)
                        CURLcode status, bool premature)
{
  struct FILEPROTO *file = conn->data->reqdata.proto.file;
  (void)status; /* not used */
  (void)premature; /* not used */
  Curl_safefree(file->freepath);

  if(file->fd != -1)
+2 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -25,7 +25,7 @@
 ***************************************************************************/
#ifndef CURL_DISABLE_FILE
CURLcode Curl_file(struct connectdata *, bool *done);
CURLcode Curl_file_done(struct connectdata *, CURLcode);
CURLcode Curl_file_done(struct connectdata *, CURLcode, bool premature);
CURLcode Curl_file_connect(struct connectdata *);
#endif
#endif
+10 −6
Original line number Diff line number Diff line
@@ -2964,7 +2964,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn,
 *
 * Input argument is already checked for validity.
 */
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature)
{
  struct SessionHandle *data = conn->data;
  struct FTP *ftp = data->reqdata.proto.ftp;
@@ -2998,8 +2998,12 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
    /* the connection stays alive fine even though this happened */
    /* fall-through */
  case CURLE_OK: /* doesn't affect the control connection's status */
    if (!premature) {
      ftpc->ctl_valid = was_ctl_valid;
      break;
    }
    /* until we cope better with prematurely ended requests, let them 
     * fallback as if in complete failure */
  default:       /* by default, an error means the control connection is
                    wedged and should not be used anymore */
    ftpc->ctl_valid = FALSE;
@@ -3048,7 +3052,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)

  conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;

  if(!ftp->no_transfer && !status) {
  if(!ftp->no_transfer && !status && !premature) {
    /*
     * Let's see what the server says about the transfer we just performed,
     * but lower the timeout as sometimes this connection has died while the
@@ -3081,7 +3085,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
    }
  }

  if(result)
  if(result || premature)
    /* the response code from the transfer showed an error already so no
       use checking further */
    ;
@@ -3123,7 +3127,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
  ftpc->dont_check = FALSE;

  /* Send any post-transfer QUOTE strings? */
  if(!status && !result && data->set.postquote)
  if(!status && !result && !premature && data->set.postquote)
    result = ftp_sendquote(conn, data->set.postquote);

  return result;
Loading