mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05:00
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.
This commit is contained in:
parent
d60029d66e
commit
28027c2aa2
28
lib/ftp.c
28
lib/ftp.c
@ -1517,9 +1517,10 @@ CURLcode ftp_perform(struct connectdata *conn)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have selected NOBODY, it means that we only want file information.
|
/* If we have selected NOBODY and HEADER, it means that we only want file
|
||||||
Which in FTP can't be much more than the file size! */
|
information. Which in FTP can't be much more than the file size and
|
||||||
if(data->set.no_body) {
|
date. */
|
||||||
|
if(data->set.no_body && data->set.include_header) {
|
||||||
/* The SIZE command is _not_ RFC 959 specified, and therefor many servers
|
/* 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
|
may not support it! It is however the only way we have to get a file's
|
||||||
size! */
|
size! */
|
||||||
@ -1565,20 +1566,27 @@ CURLcode ftp_perform(struct connectdata *conn)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(data->set.no_body)
|
||||||
|
/* don't transfer the data */
|
||||||
|
;
|
||||||
/* Get us a second connection up and connected */
|
/* 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 */
|
/* We have chosen to use the PORT command */
|
||||||
result = ftp_use_port(conn);
|
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 */
|
/* We have chosen (this is default) to use the PASV command */
|
||||||
result = ftp_use_pasv(conn);
|
result = ftp_use_pasv(conn);
|
||||||
|
if(CURLE_OK == result)
|
||||||
|
infof(data, "Connected the data stream with PASV!\n");
|
||||||
|
}
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* we have the data connection ready */
|
|
||||||
infof(data, "Connected the data stream!\n");
|
|
||||||
|
|
||||||
if(data->set.upload) {
|
if(data->set.upload) {
|
||||||
|
|
||||||
/* Set type to binary (unless specified ASCII) */
|
/* Set type to binary (unless specified ASCII) */
|
||||||
@ -1701,7 +1709,7 @@ CURLcode ftp_perform(struct connectdata *conn)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else if(!data->set.no_body) {
|
||||||
/* Retrieve file or directory */
|
/* Retrieve file or directory */
|
||||||
bool dirlist=FALSE;
|
bool dirlist=FALSE;
|
||||||
long downloadsize=-1;
|
long downloadsize=-1;
|
||||||
|
@ -569,7 +569,10 @@ struct UserDefined {
|
|||||||
bool hide_progress;
|
bool hide_progress;
|
||||||
bool http_fail_on_error;
|
bool http_fail_on_error;
|
||||||
bool http_follow_location;
|
bool http_follow_location;
|
||||||
|
|
||||||
bool http_include_header;
|
bool http_include_header;
|
||||||
|
#define include_header http_include_header
|
||||||
|
|
||||||
bool http_set_referer;
|
bool http_set_referer;
|
||||||
bool http_auto_referer; /* set "correct" referer when following location: */
|
bool http_auto_referer; /* set "correct" referer when following location: */
|
||||||
bool no_body;
|
bool no_body;
|
||||||
|
Loading…
Reference in New Issue
Block a user