summaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-01-21 08:50:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-01-21 08:50:08 +0000
commit5e2fcc1f74fa5d793e7e3c6e3384879327705bdd (patch)
treeee7954fe94c9b0183f3e87775caeadeec09799a9 /lib/ftp.c
parente262a7265a2f75ed239beb2360657a63a342163f (diff)
downloadcurl-5e2fcc1f74fa5d793e7e3c6e3384879327705bdd.tar.gz
use the proper timecond defines, not the obsolete ones I've removed! ;-)
The initial QUIT-sending code is added, but not yet used due to the issues previously mentioned on the mailing list.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index c5e2dc4aa..2b3490ce1 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2136,7 +2136,7 @@ CURLcode ftp_perform(struct connectdata *conn,
if(data->set.timecondition) {
if((data->info.filetime > 0) && (data->set.timevalue > 0)) {
switch(data->set.timecondition) {
- case TIMECOND_IFMODSINCE:
+ case CURL_TIMECOND_IFMODSINCE:
default:
if(data->info.filetime < data->set.timevalue) {
infof(data, "The requested document is not new enough\n");
@@ -2144,7 +2144,7 @@ CURLcode ftp_perform(struct connectdata *conn,
return CURLE_OK;
}
break;
- case TIMECOND_IFUNMODSINCE:
+ case CURL_TIMECOND_IFUNMODSINCE:
if(data->info.filetime > data->set.timevalue) {
infof(data, "The requested document is not old enough\n");
ftp->no_transfer = TRUE; /* mark this to not transfer data */
@@ -2411,6 +2411,29 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
/***********************************************************************
*
+ * Curl_ftp_quit()
+ *
+ * This should be called before calling sclose() on an ftp control connection
+ * (not data connections). We should then wait for the response from the
+ * server before returning. The calling code should then try to close the
+ * connection.
+ *
+ */
+CURLcode Curl_ftp_quit(struct connectdata *conn)
+{
+ int nread;
+ int ftpcode;
+ CURLcode ret;
+
+ ret = Curl_ftpsendf(conn, "%s", "QUIT");
+ if(CURLE_OK == ret)
+ ret = Curl_GetFTPResponse(&nread, conn, &ftpcode);
+
+ return ret;
+}
+
+/***********************************************************************
+ *
* Curl_ftp_disconnect()
*
* Disconnect from an FTP server. Cleanup protocol-specific per-connection
@@ -2420,6 +2443,16 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
{
struct FTP *ftp= conn->proto.ftp;
+#if 0
+ /* We cannot send quit unconditionally. If this connection is stale or
+ bad in any way, sending quit and waiting around here will make the
+ disconnect wait in vain and cause more problems than we need to.
+
+ Until fixed, we keep this #if 0'ed. To be fixed in 7.11.1. Stay tuned.
+ */
+ (void)Curl_ftp_quit(conn); /* ignore errors on the QUIT */
+#endif
+
/* The FTP session may or may not have been allocated/setup at this point! */
if(ftp) {
if(ftp->entrypath)