#include "setup.h"
-/* MN 06/07/02 */
#ifndef CURL_DISABLE_FTP
#include <stdio.h>
#include <string.h>
sclose(conn->secondarysocket);
conn->secondarysocket = -1;
- if(!data->set.no_body && !ftp->dont_check) {
+ if(!ftp->no_transfer) {
/* now let's see what the server says about the transfer we just
performed: */
nread = Curl_GetFTPResponse(buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
- /* 226 Transfer complete, 250 Requested file action okay, completed. */
- if((ftpcode != 226) && (ftpcode != 250)) {
- failf(data, "server did not report OK, got %d", ftpcode);
- return CURLE_FTP_WRITE_ERROR;
+ if(!ftp->dont_check) {
+ /* 226 Transfer complete, 250 Requested file action okay, completed. */
+ if((ftpcode != 226) && (ftpcode != 250)) {
+ failf(data, "server did not report OK, got %d", ftpcode);
+ return CURLE_FTP_WRITE_ERROR;
+ }
}
}
- if(ftp->dont_check)
- /* if we don't check, we can't re-use this connection as it leaves the
- control connection in a weird status */
- conn->bits.close = TRUE;
- /* reset these for next connection */
- conn->bits.resume_done = FALSE;
+ /* clear these for next connection */
+ ftp->no_transfer = FALSE;
ftp->dont_check = FALSE;
/* Send any post-transfer QUOTE strings? */
size! */
ssize_t filesize;
+ ftp->no_transfer = TRUE; /* this means no actual transfer is made */
+
/* Some servers return different sizes for different modes, and thus we
must set the proper type before we check the size */
result = ftp_transfertype(conn, data->set.ftp_ascii);
}
if(data->set.no_body)
- /* don't transfer the data */
- ;
+ /* doesn't really transfer any data */
+ ftp->no_transfer = TRUE;
/* Get us a second connection up and connected */
else if(data->set.ftp_use_port) {
/* We have chosen to use the PORT command */
/* no data to transfer */
result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
- /* Set resume done and dont_check so that we won't get any error
- * in Curl_ftp_done() because we didn't transfer the amount of
- * bytes that the local file file obviously is */
- conn->bits.resume_done = TRUE;
- ftp->dont_check = TRUE;
+ /* Set no_transfer so that we won't get any error in
+ * Curl_ftp_done() because we didn't transfer anything! */
+ ftp->no_transfer = TRUE;
return CURLE_OK;
}
}
infof(data, "range-download from %d to %d, totally %d bytes\n",
from, to, totalsize);
- conn->bits.resume_done = TRUE; /* to prevent some error due to this */
ftp->dont_check = TRUE; /* dont check for successful transfer */
}
result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
infof(data, "File already completely downloaded\n");
- /* Set resume done so that we won't get any error in Curl_ftp_done()
- * because we didn't transfer the amount of bytes that the remote
- * file obviously is */
- conn->bits.resume_done = TRUE;
- ftp->dont_check = TRUE;
-
+ /* Set no_transfer so that we won't get any error in Curl_ftp_done()
+ * because we didn't transfer the any file */
+ ftp->no_transfer = TRUE;
return CURLE_OK;
}
char *cache; /* data cache between getresponse()-calls */
size_t cache_size; /* size of cache in bytes */
- bool dont_check; /* set to TRUE to prevent the final (post-transfer)
- file size and 226/250 status check */
+ bool dont_check; /* Set to TRUE to prevent the final (post-transfer)
+ file size and 226/250 status check. It should still
+ read the line, just ignore the result. */
+ bool no_transfer; /* nothing was transfered, (possibly because a resumed
+ transfer already was complete) */
+
};
/****************************************************************************
bool use_range;
bool rangestringalloc; /* the range string is malloc()'ed */
-
- bool resume_done; /* nothing was transfered, resumed transfer already
- complete */
};
/*