]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
If nobody is set we won't download any FTP file. If include_header is set,
authorDaniel Stenberg <daniel@haxx.se>
Thu, 20 Dec 2001 11:22:01 +0000 (11:22 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 20 Dec 2001 11:22:01 +0000 (11:22 +0000)
we return a set of headers not more. This enables FTP operations that don't
transfer any data, only perform FTP commands.

lib/ftp.c
lib/urldata.h

index ce566eb865067d57ab56489d82ee33539a42c5a0..50bd2918efeb6d679813dc0b7dc5905ec4f65ee3 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1517,9 +1517,10 @@ CURLcode ftp_perform(struct connectdata *conn)
       return result;
   }
 
-  /* If we have selected NOBODY, it means that we only want file information.
-     Which in FTP can't be much more than the file size! */
-  if(data->set.no_body) {
+  /* If we have selected NOBODY and HEADER, it means that we only want file
+     information. Which in FTP can't be much more than the file size and
+     date. */
+  if(data->set.no_body && data->set.include_header) {
     /* The SIZE command is _not_ RFC 959 specified, and therefor many servers
        may not support it! It is however the only way we have to get a file's
        size! */
@@ -1565,20 +1566,27 @@ CURLcode ftp_perform(struct connectdata *conn)
     return CURLE_OK;
   }
 
+  if(data->set.no_body)
+    /* don't transfer the data */
+    ;
   /* Get us a second connection up and connected */
-  if(data->set.ftp_use_port)
+  else if(data->set.ftp_use_port) {
     /* We have chosen to use the PORT command */
     result = ftp_use_port(conn);
-  else
+    if(CURLE_OK == result)
+      /* we have the data connection ready */
+      infof(data, "Connected the data stream with PORT!\n");
+  }
+  else {
     /* We have chosen (this is default) to use the PASV command */
     result = ftp_use_pasv(conn);
-
+    if(CURLE_OK == result)
+      infof(data, "Connected the data stream with PASV!\n");
+  }
+  
   if(result)
     return result;
 
-  /* we have the data connection ready */
-  infof(data, "Connected the data stream!\n");
-
   if(data->set.upload) {
 
     /* Set type to binary (unless specified ASCII) */
@@ -1701,7 +1709,7 @@ CURLcode ftp_perform(struct connectdata *conn)
       return result;
       
   }
-  else {
+  else if(!data->set.no_body) {
     /* Retrieve file or directory */
     bool dirlist=FALSE;
     long downloadsize=-1;
index 23aaac37941664da409d4575d856adf31f3b433f..3f57f1fc826ad6dec99635c5fdd677584c2cf01d 100644 (file)
@@ -569,7 +569,10 @@ struct UserDefined {
   bool hide_progress;
   bool http_fail_on_error;
   bool http_follow_location;
+
   bool http_include_header;
+#define include_header http_include_header
+
   bool http_set_referer;
   bool http_auto_referer; /* set "correct" referer when following location: */
   bool no_body;