Commit 28027c2a authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

If nobody is set we won't download any FTP file. If include_header is set,

we return a set of headers not more. This enables FTP operations that don't
transfer any data, only perform FTP commands.
parent d60029d6
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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;