From 28027c2aa2578710464698118ef073f33813bad4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 20 Dec 2001 11:22:01 +0000 Subject: 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. --- lib/ftp.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'lib/ftp.c') diff --git a/lib/ftp.c b/lib/ftp.c index ce566eb86..50bd2918e 100644 --- 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; -- cgit v1.2.3