Lines Matching refs:FTP
59 #include "ftp.h"
163 * FTP protocol handler.
167 "FTP", /* scheme */
217 * HTTP-proxyed FTP protocol handler.
221 "FTP", /* scheme */
279 * NOTE: back in the old days, we added code in the FTP code that made NOBODY
499 struct FTP *ftp = data->req.protop;
512 *(ftp->bytecountp)=0;
523 SECONDARYSOCKET, ftp->bytecountp);
526 /* FTP download: */
529 ftp->bytecountp, -1, NULL); /* no upload here */
593 /* macro to check for a three-digit ftp status code at the start of the
598 /* macro to check for the last line in an FTP server response */
616 int *ftpcode, /* return the ftp-code if done */
643 /* normal ftp stuff we pass through! */
655 /* 421 means "Service not available, closing control connection." and FTP
670 /* --- parse FTP server responses --- */
680 int *ftpcode) /* return the ftp-code */
713 failf(data, "FTP response timeout");
746 failf(data, "FTP response aborted due to select/poll error: %d",
822 /* This is the ONLY way to change FTP state! */
838 infof(conn->data, "FTP %p (line %d) state change from %s to %s\n",
850 struct FTP *ftp = conn->data->req.protop;
852 PPSENDF(&conn->proto.ftpc.pp, "USER %s", ftp->user?ftp->user:"");
871 /* For the FTP "protocol connect" and "doing" phases only */
879 /* For the FTP "DO_MORE" phase only */
950 for all upcoming ones in the ftp->dirs[] array */
1244 /* step 5, send the proper FTP command */
1344 multi interface with active FTP work - as it will not wait for a
1405 struct FTP *ftp = conn->data->req.protop;
1408 if(ftp->transfer != FTPTRANSFER_BODY) {
1448 struct FTP *ftp = conn->data->req.protop;
1451 if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
1469 struct FTP *ftp = conn->data->req.protop;
1472 if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
1577 struct FTP *ftp = conn->data->req.protop;
1582 information. Which in FTP can't be much more than the file size and
1590 ftp->transfer = FTPTRANSFER_INFO;
1634 struct FTP *ftp = conn->data->req.protop;
1647 don't another ftp command. We just skip the source file
1709 ftp->transfer = FTPTRANSFER_NONE;
1732 struct FTP *ftp = data->req.protop;
1793 if(ftp->transfer != FTPTRANSFER_BODY)
1900 /* We want "seamless" FTP operations through HTTP proxy tunnel */
1903 * member conn->proto.http; we want FTP through HTTP and we have to
1906 * struct FTP pointer
1909 struct FTP *ftp_save = data->req.protop;
1937 not the ftp host. */
2082 /* normal, direct, ftp connection */
2133 /* The FTP spec tells a positive response should have code 200.
2166 struct FTP *ftp = data->req.protop;
2237 ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
2246 ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
2300 struct FTP *ftp = data->req.protop;
2307 ftp->downloadsize = filesize;
2313 infof(data, "ftp server doesn't support SIZE\n");
2331 ftp->downloadsize = -data->state.resume_from;
2333 data->state.resume_from = filesize - ftp->downloadsize;
2343 ftp->downloadsize = filesize-data->state.resume_from;
2347 if(ftp->downloadsize == 0) {
2354 ftp->transfer = FTPTRANSFER_NONE;
2457 failf(data, "Failed FTP upload: %0d", ftpcode);
2494 struct FTP *ftp = data->req.protop;
2520 * It appears that there are FTP-servers that return size 0 for files when
2530 (ftp->downloadsize < 1)) {
2562 else if(ftp->downloadsize > -1)
2563 size = ftp->downloadsize;
2577 /* FTP download: */
2601 ftp->transfer = FTPTRANSFER_NONE; /* don't download anything */
2623 The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says:
2651 struct FTP *ftp = data->req.protop;
2659 PPSENDF(&ftpc->pp, "PASS %s", ftp->passwd?ftp->passwd:"");
2736 /* we have now received a full FTP server response */
2743 failf(data, "Got a %03d ftp-server response when 220 was expected",
2855 /* FTP servers typically responds with 500 if they decide to reject
2940 an OS400 FTP server: this server supports two name syntaxes,
3208 /* We always support persistent connections on ftp */
3209 connkeep(conn, "FTP default");
3247 struct FTP *ftp = data->req.protop;
3257 if(!ftp)
3288 connclose(conn, "FTP ended with bad error code");
3311 connclose(conn, "FTP: out of memory!"); /* mark for connection closure */
3369 if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
3389 connclose(conn, "Timeout or similar in FTP DONE operation"); /* close */
3418 (data->state.infilesize != *ftp->bytecountp) &&
3420 (ftp->transfer == FTPTRANSFER_BODY)) {
3423 *ftp->bytecountp, data->state.infilesize);
3429 (data->req.size != *ftp->bytecountp) &&
3431 /* Most FTP servers don't adjust their file SIZE response for CRLFs, so
3436 *ftp->bytecountp) &&
3438 (data->req.maxdownload != *ftp->bytecountp)) {
3440 " bytes", *ftp->bytecountp);
3444 !*ftp->bytecountp &&
3452 ftp->transfer = FTPTRANSFER_BODY;
3488 /* if a command starts with an asterisk, which a legal FTP command never
3605 DEBUGF(infof(conn->data, "FTP RANGE %" CURL_FORMAT_CURL_OFF_T
3612 DEBUGF(infof(conn->data, "FTP RANGE the last %" CURL_FORMAT_CURL_OFF_T
3619 DEBUGF(infof(conn->data, "FTP RANGE from %" CURL_FORMAT_CURL_OFF_T
3638 * This function shall be called when the second FTP (data) connection is
3654 /* the ftp struct is inited in ftp_connect() */
3655 struct FTP *ftp = data->req.protop;
3700 /* if we reach the end of the FTP state machine here, *complete will be
3706 if(ftp->transfer <= FTPTRANSFER_INFO) {
3738 /* if we reach the end of the FTP state machine here, *complete will be
3747 ftp->downloadsize = -1; /* unknown as of yet */
3758 if(ftp->transfer == FTPTRANSFER_BODY) {
3777 if(!result && (ftp->transfer != FTPTRANSFER_BODY))
3797 * This is the actual DO function for FTP. Get a file/directory according to
3806 /* this is FTP and no proxy */
3813 struct FTP *ftp = conn->data->req.protop;
3814 ftp->transfer = FTPTRANSFER_INFO;
3885 /* allocate ftp protocol specific temporary wildcard data */
3907 /* try to parse ftp url */
4157 * This should be called before calling sclose() on an ftp control connection
4190 * Disconnect from an FTP server. Cleanup protocol-specific per-connection
4202 ftp_quit() will check the state of ftp->ctl_valid. If it's ok it
4208 /* The FTP session may or may not have been allocated/setup at this point! */
4246 /* the ftp struct is already inited in ftp_connect() */
4247 struct FTP *ftp = data->req.protop;
4339 /* we skip empty path components, like "x//y" since the FTP command
4404 if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
4438 struct FTP *ftp = conn->data->req.protop;
4451 if(ftp->transfer != FTPTRANSFER_BODY)
4488 * ftp->ctl_valid starts out as FALSE, and gets set to TRUE if we reach the
4534 struct FTP *ftp;
4537 /* Unless we have asked to tunnel ftp operations through the proxy, we
4553 failf(data, "FTP over http proxy requires HTTP support built-in!");
4558 conn->data->req.protop = ftp = malloc(sizeof(struct FTP));
4559 if(NULL == ftp)
4565 /* FTP URLs support an extension like ";type=<typecode>" that
4594 /* get some initial data into the ftp struct */
4595 ftp->bytecountp = &conn->data->req.bytecount;
4596 ftp->transfer = FTPTRANSFER_BODY;
4597 ftp->downloadsize = 0;
4603 ftp->user = conn->user;
4604 ftp->passwd = conn->passwd;
4605 if(isBadFtpString(ftp->user))
4607 if(isBadFtpString(ftp->passwd))