26 #ifndef CURL_DISABLE_FTP
37 #ifdef HAVE_SYS_SELECT_H
38 #include <sys/select.h>
41 #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
44 #ifdef HAVE_SYS_SOCKET_H
45 #include <sys/socket.h>
47 #include <sys/types.h>
48 #ifdef HAVE_NETINET_IN_H
49 #include <netinet/in.h>
51 #ifdef HAVE_ARPA_INET_H
52 #include <arpa/inet.h>
54 #include <sys/utsname.h>
64 #if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__)
68 #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
70 #define in_addr_t unsigned long
95 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
99 #define _MPRINTF_REPLACE
115 #define FTPSENDF(x,y,z) if((result = Curl_ftpsendf(x,y,z))) return result
117 static void freedirs(
struct FTP *ftp)
120 for (i=0; ftp->
dirs[
i]; i++){
148 FD_SET(sock, &rdset);
151 timeout -= timespent;
153 failf(data,
"Timed out before server could connect to us");
159 dt.tv_sec = (
int)(timeout?timeout:60);
165 failf(data,
"Error while waiting for server connect");
169 failf(data,
"Timeout while waiting for server connect");
175 size_t size =
sizeof(
struct sockaddr_in);
176 struct sockaddr_in add;
178 getsockname(sock, (
struct sockaddr *) &add, (
socklen_t *)&size);
179 s=accept(sock, (
struct sockaddr *) &add, (
socklen_t *)&size);
185 failf(data,
"Error accept()ing server connect");
188 infof(data,
"Connection accepted from server\n");
240 FD_SET (sockfd, &readfd);
253 while((*nreadp<
BUFSIZE) && (keepon && !result)) {
274 failf(data,
"FTP response timeout");
286 failf(data,
"FTP response aborted due to select() error: %d", errno);
331 else if(gotbytes <= 0) {
334 failf(data,
"FTP response reading failed");
343 for(i = 0; i < gotbytes; ptr++, i++) {
359 line_start, perline);
363 #define lastline(line) (isdigit((int)line[0]) && isdigit((int)line[1]) && \
364 isdigit((int)line[2]) && (' ' == line[3]))
366 if(perline>3 &&
lastline(line_start)) {
372 for(meow=line_start, n=0; meow<ptr; meow++, n++)
384 if(!keepon && (i != gotbytes)) {
433 static const char *ftpauth[]= {
451 ftp = (
struct FTP *)malloc(
sizeof(
struct FTP));
455 memset(ftp, 0,
sizeof(
struct FTP));
491 failf(data,
"This doesn't seem like a nice ftp-server response");
507 infof(data,
"Logging in with password in cleartext!\n");
509 infof(data,
"Authentication successful\n");
516 for (
try = 0; ftpauth[
try];
try++) {
518 FTPSENDF(conn,
"AUTH %s", ftpauth[
try]);
532 if((ftpcode == 234) || (ftpcode == 334)) {
554 failf(data,
"Access denied: %s", &buf[4]);
557 else if(ftpcode == 331) {
568 failf(data,
"the username and/or the password are incorrect");
571 else if(ftpcode == 230) {
575 infof(data,
"We have successfully logged in\n");
578 failf(data,
"Odd return code after PASS");
582 else if(buf[0] ==
'2') {
585 infof(data,
"We have successfully logged in\n");
591 if(conn->sec_complete)
606 failf(data,
"Odd return code after USER");
660 char *dir = (
char *)malloc(nread+1);
700 infof(data,
"Failed to figure out path\n");
764 failf(data,
"No data was received!");
789 failf(data,
"control connection looks dead");
798 if((ftpcode != 226) && (ftpcode != 250)) {
799 failf(data,
"server did not report OK, got %d", ftpcode);
841 if (ftpcode >= 400) {
842 failf(conn->
data,
"QUOT string not accepted: %s", item->
data);
880 int year, month, day, hour, minute, second;
881 if(6 == sscanf(buf+4,
"%04d%02d%02d%02d%02d%02d",
882 &year, &month, &day, &hour, &minute, &second)) {
884 time_t secs=time(
NULL);
885 sprintf(buf,
"%04d%02d%02d %02d:%02d:%02d GMT",
886 year, month, day, hour, minute, second);
893 infof(conn->
data,
"unsupported MDTM reply format\n");
896 failf(conn->
data,
"Given file does not exist");
918 FTPSENDF(conn,
"TYPE %s", ascii?
"A":
"I");
925 failf(data,
"Couldn't set %s mode",
926 ascii?
"ASCII":
"binary");
987 struct hostent * answer;
989 #ifdef HAVE_INET_NTOA_R
995 long bigbuf[9000 /
sizeof(long)];
997 #if defined(HAVE_INET_ADDR)
999 # if defined(HAVE_GETHOSTBYADDR_R)
1002 char *hostent_buf = (
char *)bigbuf;
1004 address = inet_addr(newhost);
1005 # ifdef HAVE_GETHOSTBYADDR_R
1007 # ifdef HAVE_GETHOSTBYADDR_R_5
1021 memset(hostent_buf, 0,
sizeof(
struct hostent)+
sizeof(
struct hostent_data));
1023 if(gethostbyaddr_r((
char *) &address,
1024 sizeof(address), AF_INET,
1025 (
struct hostent *)hostent_buf,
1026 (
struct hostent_data *)(hostent_buf +
sizeof(*answer))))
1029 answer=(
struct hostent *)hostent_buf;
1032 # ifdef HAVE_GETHOSTBYADDR_R_7
1034 answer = gethostbyaddr_r((
char *) &address,
sizeof(address), AF_INET,
1035 (
struct hostent *)bigbuf,
1036 hostent_buf +
sizeof(*answer),
1037 sizeof(bigbuf) -
sizeof(*answer),
1040 # ifdef HAVE_GETHOSTBYADDR_R_8
1042 if(gethostbyaddr_r((
char *) &address,
sizeof(address), AF_INET,
1043 (
struct hostent *)hostent_buf,
1044 hostent_buf +
sizeof(*answer),
1045 sizeof(bigbuf) -
sizeof(*answer),
1053 answer = gethostbyaddr((
char *) &address,
sizeof(address), AF_INET);
1059 infof(conn->
data,
"Connecting to %s (%s) port %u\n",
1060 answer?answer->h_name:newhost,
1061 #
if defined(HAVE_INET_NTOA_R)
1073 char hbuf[NI_MAXHOST];
1074 char nbuf[NI_MAXHOST];
1075 char sbuf[NI_MAXSERV];
1076 #ifdef NI_WITHSCOPEID
1077 const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1079 const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
1082 if (getnameinfo(addr->ai_addr, addr->ai_addrlen,
1083 nbuf,
sizeof(nbuf), sbuf,
sizeof(sbuf), niflags)) {
1088 if (getnameinfo(addr->ai_addr, addr->ai_addrlen,
1089 hbuf,
sizeof(hbuf),
NULL, 0, 0)) {
1090 infof(conn->
data,
"Connecting to %s (%s) port %s\n", nbuf, newhost, sbuf);
1093 infof(conn->
data,
"Connecting to %s (%s) port %s\n", hbuf, nbuf, sbuf);
1123 struct addrinfo hints, *
res, *ai;
1124 struct sockaddr_storage ss;
1126 char hbuf[NI_MAXHOST];
1128 struct sockaddr *sa=(
struct sockaddr *)&ss;
1129 #ifdef NI_WITHSCOPEID
1130 #define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID
1132 #define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV
1136 char portmsgbuf[4096], tmp[4096];
1138 const char *
mode[] = {
"EPRT",
"LPRT",
"PORT",
NULL };
1147 rc = getsockname(conn->
sock[
FIRSTSOCKET], (
struct sockaddr *)&ss, &sslen);
1149 failf(data,
"getsockname() returned %d\n", rc);
1153 rc = getnameinfo((
struct sockaddr *)&ss, sslen, hbuf,
sizeof(hbuf),
NULL, 0,
1156 failf(data,
"getnameinfo() returned %d\n", rc);
1160 memset(&hints, 0,
sizeof(hints));
1161 hints.ai_family = sa->sa_family;
1165 hints.ai_socktype = SOCK_STREAM;
1166 hints.ai_flags = AI_PASSIVE;
1168 rc = getaddrinfo(hbuf,
NULL, &hints, &res);
1170 failf(data,
"getaddrinfo() returned %d\n", rc);
1175 for (ai = res; ai; ai = ai->ai_next) {
1179 if (ai->ai_socktype == 0)
1180 ai->ai_socktype = hints.ai_socktype;
1182 portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1186 if (bind(portsock, ai->ai_addr, ai->ai_addrlen) < 0) {
1192 if (listen(portsock, 1) < 0) {
1202 failf(data,
"%s", strerror(errno));
1207 if (getsockname(portsock, sa, &sslen) < 0) {
1208 failf(data,
"%s", strerror(errno));
1213 modep && *modep; modep++) {
1217 switch (sa->sa_family) {
1219 ap = (
unsigned char *)&((
struct sockaddr_in *)&ss)->sin_addr;
1220 alen =
sizeof(((
struct sockaddr_in *)&ss)->sin_addr);
1221 pp = (
unsigned char *)&((
struct sockaddr_in *)&ss)->sin_port;
1222 plen =
sizeof(((
struct sockaddr_in *)&ss)->sin_port);
1227 ap = (
unsigned char *)&((
struct sockaddr_in6 *)&ss)->sin6_addr;
1228 alen =
sizeof(((
struct sockaddr_in6 *)&ss)->sin6_addr);
1229 pp = (
unsigned char *)&((
struct sockaddr_in6 *)&ss)->sin6_port;
1230 plen =
sizeof(((
struct sockaddr_in6 *)&ss)->sin6_port);
1236 lprtaf = eprtaf = -1;
1240 if (
strcmp(*modep,
"EPRT") == 0) {
1243 if (getnameinfo((
struct sockaddr *)&ss, sslen,
1244 portmsgbuf,
sizeof(portmsgbuf), tmp,
sizeof(tmp),
1249 if (sa->sa_family == AF_INET6) {
1250 char *
q = strchr(portmsgbuf,
'%');
1255 result =
Curl_ftpsendf(conn,
"%s |%d|%s|%s|", *modep, eprtaf,
1259 }
else if (
strcmp(*modep,
"LPRT") == 0 ||
1260 strcmp(*modep,
"PORT") == 0) {
1263 if (
strcmp(*modep,
"LPRT") == 0 && lprtaf < 0)
1265 if (
strcmp(*modep,
"PORT") == 0 && sa->sa_family != AF_INET)
1268 portmsgbuf[0] =
'\0';
1269 if (
strcmp(*modep,
"LPRT") == 0) {
1270 snprintf(tmp,
sizeof(tmp),
"%d,%d", lprtaf, alen);
1271 if (
strlcat(portmsgbuf, tmp,
sizeof(portmsgbuf)) >=
1272 sizeof(portmsgbuf)) {
1277 for (i = 0; i < alen; i++) {
1279 snprintf(tmp,
sizeof(tmp),
",%u", ap[i]);
1281 snprintf(tmp,
sizeof(tmp),
"%u", ap[i]);
1283 if (
strlcat(portmsgbuf, tmp,
sizeof(portmsgbuf)) >=
1284 sizeof(portmsgbuf)) {
1289 if (
strcmp(*modep,
"LPRT") == 0) {
1290 snprintf(tmp,
sizeof(tmp),
",%d", plen);
1292 if (
strlcat(portmsgbuf, tmp,
sizeof(portmsgbuf)) >=
sizeof(portmsgbuf))
1296 for (i = 0; i < plen; i++) {
1297 snprintf(tmp,
sizeof(tmp),
",%u", pp[i]);
1299 if (
strlcat(portmsgbuf, tmp,
sizeof(portmsgbuf)) >=
1300 sizeof(portmsgbuf)) {
1314 if (ftpcode != 200) {
1323 failf(data,
"PORT command attempts failed");
1337 struct sockaddr_in sa;
1339 unsigned short porttouse;
1340 char myhost[256] =
"";
1341 bool sa_filled_in =
FALSE;
1374 (
struct sockaddr *)&sa, &sslen) < 0) {
1375 failf(data,
"getsockname() failed");
1379 sa_filled_in =
TRUE;
1386 if ( h || sa_filled_in) {
1387 if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) !=
CURL_SOCKET_BAD ) {
1396 memset((
char *)&sa, 0,
sizeof(sa));
1397 memcpy((
char *)&sa.sin_addr,
1400 sa.sin_family = AF_INET;
1401 sa.sin_addr.s_addr = INADDR_ANY;
1407 if(bind(portsock, (
struct sockaddr *)&sa, size) >= 0) {
1409 struct sockaddr_in add;
1412 if(getsockname(portsock, (
struct sockaddr *) &add,
1414 failf(data,
"getsockname() failed");
1417 porttouse = ntohs(add.sin_port);
1419 if ( listen(portsock, 1) < 0 ) {
1420 failf(data,
"listen(2) failed on socket");
1425 failf(data,
"bind(2) failed on socket");
1430 failf(data,
"socket(2) failed (%s)");
1435 failf(data,
"could't find my own IP address (%s)", myhost);
1439 #ifdef HAVE_INET_NTOA_R
1443 unsigned short ip[5];
1444 (
void) memcpy(&in.s_addr,
1445 h?*h->
addr->h_addr_list:(
char *)&sa.sin_addr.s_addr,
1446 sizeof (in.s_addr));
1448 #ifdef HAVE_INET_NTOA_R
1452 sscanf( ntoa_buf,
"%hu.%hu.%hu.%hu",
1453 &ip[0], &ip[1], &ip[2], &ip[3]);
1455 sscanf(
inet_ntoa(in),
"%hu.%hu.%hu.%hu",
1456 &ip[0], &ip[1], &ip[2], &ip[3]);
1458 infof(data,
"Telling server to connect to %d.%d.%d.%d:%d\n",
1459 ip[0], ip[1], ip[2], ip[3], porttouse);
1462 ip[0], ip[1], ip[2], ip[3],
1473 if(ftpcode != 200) {
1474 failf(data,
"Server does not grok PORT, try without it!");
1518 const char *mode[] = {
"EPSV",
"PASV",
NULL };
1519 int results[] = { 229, 227, 0 };
1521 unsigned short connectport;
1522 unsigned short newport=0;
1527 char *newhostp=
NULL;
1530 mode[modeoff]; modeoff++) {
1537 if (ftpcode == results[modeoff])
1541 if (!mode[modeoff]) {
1542 failf(data,
"Odd return code after PASV");
1545 else if (227 == results[modeoff]) {
1562 if (6 == sscanf(str,
"%d,%d,%d,%d,%d,%d",
1563 &ip[0], &ip[1], &ip[2], &ip[3],
1564 &port[0], &port[1]))
1570 failf(data,
"Couldn't interpret this 227-reply: %s", buf);
1574 sprintf(newhost,
"%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
1576 newport = (port[0]<<8) + port[1];
1578 else if (229 == results[modeoff]) {
1579 char *ptr = strchr(buf,
'(');
1584 if(5 == sscanf(ptr,
"%c%c%c%u%c",
1590 char sep1 = separator[0];
1595 for(i=1; i<4; i++) {
1596 if(separator[i] != sep1) {
1605 newhostp = conn->
name;
1612 failf(data,
"Weirdly formatted EPSV reply");
1632 (
unsigned short)conn->
port;
1642 failf(data,
"Can't resolve new host %s:%d", newhostp, newport);
1645 connectport = newport;
1668 ftp_pasv_verbose(conn, conninfo, newhostp, connectport);
1732 if(
CURLE_OK != ftp_getsize(conn, ftp->
file, &gottensize)) {
1733 failf(data,
"Couldn't get remote file size");
1752 if(readthisamountnow >
BUFSIZE)
1759 passed += actuallyread;
1760 if(actuallyread != readthisamountnow) {
1762 " bytes from the input", passed);
1773 infof(data,
"File already completely uploaded\n");
1803 failf(data,
"Failed FTP upload:%s", buf+3);
1810 result = AllowServerConnect(conn);
1818 infof(data,
"Doing the SSL/TLS handshake on the data stream\n");
1849 while(ptr && *ptr && (isspace((
int)*ptr) || (*ptr==
'-')))
1856 if((-1 == to) && (from>=0)) {
1870 totalsize = to-from;
1889 result = ftp_transfertype(conn,
TRUE );
1918 result = ftp_getsize(conn, ftp->
file, &foundsize);
1921 failf(data,
"Maximum file size exceeded");
1924 downloadsize = foundsize;
1940 infof(data,
"ftp server doesn't support SIZE\n");
1951 if(foundsize < -conn->resume_from) {
1963 if(foundsize < conn->resume_from) {
1974 if (downloadsize == 0) {
1977 infof(data,
"File already completely downloaded\n");
1996 if(ftpcode != 350) {
1997 failf(data,
"Couldn't use REST: %s", buf+4);
2009 if((ftpcode == 150) || (ftpcode == 125)) {
2042 (downloadsize < 1)) {
2051 bytes=strstr(buf,
" bytes");
2060 if(!isdigit((
int)*bytes)) {
2075 else if(downloadsize > -1)
2076 size = downloadsize;
2079 result = AllowServerConnect(conn);
2087 infof(data,
"Doing the SSL/TLS handshake on the data stream\n");
2106 if(dirlist && (ftpcode == 450)) {
2111 failf(data,
"%s", buf+4);
2159 for (i=0; ftp->
dirs[
i]; i++) {
2162 if ((result = ftp_cwd_and_mkd(conn, ftp->
dirs[i])) !=
CURLE_OK)
2170 result = ftp_getfiletime(conn, ftp->
file);
2181 infof(data,
"The requested document is not new enough\n");
2188 infof(data,
"The requested document is not old enough\n");
2196 infof(data,
"Skipping time comparison\n");
2225 result = ftp_getsize(conn, ftp->
file, &filesize);
2239 if ((
CURLE_OK == result) && (ftpcode == 350)) {
2241 (
char *)
"Accept-ranges: bytes\r\n", 0);
2249 #ifdef HAVE_STRFTIME
2253 #ifdef HAVE_GMTIME_R
2255 tm = (
struct tm *)gmtime_r(&clock, &
buffer);
2260 strftime(buf,
BUFSIZE-1,
"Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n",
2277 result = ftp_use_port(conn);
2280 infof(data,
"Ordered connect of the data stream with PORT!\n");
2286 result = ftp_use_pasv(conn, connected);
2287 if(
CURLE_OK == result && *connected)
2288 infof(data,
"Connected the data stream with PASV!\n");
2314 char *cur_pos=conn->
ppath;
2332 while((slash_pos=strchr(cur_pos,
'/'))) {
2334 bool absolute_dir = (cur_pos - conn->
ppath > 0) && (path_part == 0);
2337 if (slash_pos-cur_pos) {
2342 slash_pos - cur_pos + absolute_dir);
2344 if (!ftp->
dirs[path_part]) {
2345 failf(data,
"no memory");
2351 cur_pos = slash_pos + 1;
2356 cur_pos = slash_pos + 1;
2360 failf(data,
"too deep dir hierarchy");
2367 ftp->
file = cur_pos;
2373 failf(data,
"no memory");
2381 retcode = ftp_perform(conn, &connected);
2417 const char *fmt, ...)
2433 write_len = strlen(s);
2445 if(bytes_written != (
ssize_t)write_len) {
2446 write_len -= bytes_written;
2447 sptr += bytes_written;
2543 infof( conn->
data ,
"Created remote directory %s\n" , path );
2546 failf(conn->
data,
"Permission denied to make directory %s", path);
2550 failf(conn->
data,
"unrecognized MKD response: %d", ftpcode );
2580 if (ftpcode/100 != 2)
2599 result = ftp_cwd(conn, path);
2602 result = ftp_mkd(conn, path);
2606 result = ftp_cwd(conn, path);
2609 failf(conn->
data,
"Couldn't cd to %s", path);
GLdouble GLdouble GLdouble GLdouble q
int Curl_sec_read_msg(struct connectdata *conn, char *, int)
CURLcode Curl_krb_kauth(struct connectdata *conn)
struct ssl_connect_data ssl[2]
void Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size)
char * dirs[CURL_MAX_FTP_DIRDEPTH]
char * curl_unescape(const char *string, int length)
union connectdata::@11 proto
int Curl_resolv(struct connectdata *conn, char *hostname, int port, struct Curl_dns_entry **entry)
struct DynamicStatic change
CURLcode Curl_client_write(struct SessionHandle *data, int type, char *ptr, size_t len)
time_t curl_getdate(const char *p, const time_t *now)
CURLcode Curl_ftp_quit(struct connectdata *conn)
CURLcode Curl_GetFTPResponse(ssize_t *nreadp, struct connectdata *conn, int *ftpcode)
struct in_addr Curl_ipconnect
struct curl_slist * quote
unsigned short remote_port
CURLcode Curl_ftpsendf(struct connectdata *conn, const char *fmt,...)
int Curl_read(struct connectdata *conn, curl_socket_t sockfd, char *buf, size_t buffersize, ssize_t *n)
#define CURL_MAX_FTP_DIRDEPTH
long ftp_response_timeout
CURLcode Curl_ftp(struct connectdata *conn)
int Curl_sec_request_prot(struct connectdata *conn, const char *level)
int Curl_nonblock(curl_socket_t sockfd, int nonblock)
CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, void *mem, size_t len, ssize_t *written)
bool tunnel_thru_httpproxy
char * inet_ntoa_r(const struct in_addr in, char *buffer, int buflen)
void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size)
int Curl_pgrsUpdate(struct connectdata *conn)
void Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size)
void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns)
bool ftp_create_missing_dirs
void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size)
GLsizei GLsizei GLenum GLenum const GLvoid * data
int Curl_sec_fflush_fd(struct connectdata *conn, int fd)
void Curl_sec_set_protection_level(struct connectdata *conn)
#define CLIENTWRITE_HEADER
struct tm * gmtime(const time_t *)
CURLcode Curl_Transfer(struct connectdata *c_conn, int sockindex, curl_off_t size, bool getheader, curl_off_t *bytecountp, int writesockindex, curl_off_t *writecountp)
long Curl_tvdiff(struct timeval newer, struct timeval older)
GLenum const GLvoid * addr
struct SessionHandle * data
char * Curl_if2ip(char *interface, char *buf, int buf_size)
int Curl_debug(struct SessionHandle *data, curl_infotype type, char *ptr, size_t size)
CURLcode Curl_connecthost(struct connectdata *conn, struct Curl_dns_entry *remotehost, int port, curl_socket_t *sockconn, Curl_ipconnect **addr, bool *connected)
CURLcode Curl_ftp_done(struct connectdata *conn)
struct curl_slist * postquote
CURLcode Curl_wait_for_resolv(struct connectdata *conn, struct Curl_dns_entry **entry)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
struct timeval Curl_tvnow(void)
CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
struct curl_slist * prequote
#define FTPSENDF(x, y, z)
CURLcode Curl_SSLConnect(struct connectdata *conn, int sockindex)
curl_TimeCond timecondition
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, int sockindex, char *hostname, int remote_port)
CURLcode Curl_ftp_disconnect(struct connectdata *conn)
CURLcode Curl_ftp_connect(struct connectdata *conn)
int sprintf(idStr &string, const char *fmt,...)
int Curl_sec_login(struct connectdata *)
#define CURLE_OPERATION_TIMEDOUT
#define CURLE_FTP_BAD_DOWNLOAD_RESUME