aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c28
-rw-r--r--lib/urldata.h3
2 files changed, 21 insertions, 10 deletions
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;
diff --git a/lib/urldata.h b/lib/urldata.h
index 23aaac379..3f57f1fc8 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -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;