• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/curl-83.1.2/curl/lib/

Lines Matching refs:ftpc

283 static void freedirs(struct ftp_conn *ftpc)
286 if(ftpc->dirs) {
287 for(i=0; i < ftpc->dirdepth; i++) {
288 if(ftpc->dirs[i]) {
289 free(ftpc->dirs[i]);
290 ftpc->dirs[i]=NULL;
293 free(ftpc->dirs);
294 ftpc->dirs = NULL;
295 ftpc->dirdepth = 0;
297 if(ftpc->file) {
298 free(ftpc->file);
299 ftpc->file = NULL;
423 struct ftp_conn *ftpc = &conn->proto.ftpc;
424 struct pingpong *pp = &ftpc->pp;
504 if(conn->proto.ftpc.state_saved == FTP_STOR) {
521 conn->proto.ftpc.retr_size_saved, FALSE,
525 conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */
687 struct ftp_conn *ftpc = &conn->proto.ftpc;
688 struct pingpong *pp = &ftpc->pp;
823 struct ftp_conn *ftpc = &conn->proto.ftpc;
825 if(ftpc->state != newstate)
827 (void *)ftpc, lineno, ftp_state_names[ftpc->state],
830 ftpc->state = newstate;
838 PPSENDF(&conn->proto.ftpc.pp, "USER %s", ftp->user?ftp->user:"");
851 PPSENDF(&conn->proto.ftpc.pp, "%s", "PWD");
862 return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
869 struct ftp_conn *ftpc = &conn->proto.ftpc;
879 if(FTP_STOP == ftpc->state) {
906 return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
918 struct ftp_conn *ftpc = &conn->proto.ftpc;
920 if(ftpc->cwddone)
924 ftpc->count2 = 0; /* count2 counts failed CWDs */
929 ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0;
931 if(conn->bits.reuse && ftpc->entrypath) {
935 ftpc->count1 = 0; /* we count this as the first path, then we add one
937 PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->entrypath);
941 if(ftpc->dirdepth) {
942 ftpc->count1 = 1;
945 PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->dirs[ftpc->count1 -1]);
968 struct ftp_conn *ftpc = &conn->proto.ftpc;
1274 result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd],
1282 ftpc->count1 = PORT;
1305 result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
1319 ftpc->count1 = fcmd;
1343 struct ftp_conn *ftpc = &conn->proto.ftpc;
1371 PPSENDF(&ftpc->pp, "%s", mode[modeoff]);
1373 ftpc->count1 = modeoff;
1409 if(!conn->proto.ftpc.file) {
1410 PPSENDF(&conn->proto.ftpc.pp, "PRET %s",
1416 PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file);
1419 PPSENDF(&conn->proto.ftpc.pp, "PRET RETR %s", conn->proto.ftpc.file);
1434 struct ftp_conn *ftpc = &conn->proto.ftpc;
1436 if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
1441 PPSENDF(&conn->proto.ftpc.pp, "REST %d", 0);
1455 struct ftp_conn *ftpc = &conn->proto.ftpc;
1457 if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
1460 /* we know ftpc->file is a valid pointer to a file name */
1461 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1525 result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", cmd);
1567 struct ftp_conn *ftpc = &conn->proto.ftpc;
1572 if(data->set.opt_no_body && ftpc->file &&
1599 struct ftp_conn *ftpc = &conn->proto.ftpc;
1602 if((data->set.get_filetime || data->set.timecondition) && ftpc->file) {
1606 PPSENDF(&ftpc->pp, "MDTM %s", ftpc->file);
1624 struct ftp_conn *ftpc = &conn->proto.ftpc;
1644 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1706 PPSENDF(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s",
1707 ftpc->file);
1721 struct ftp_conn *ftpc = &conn->proto.ftpc;
1746 ftpc->count1 = 0;
1748 ftpc->count1++;
1754 while((i< ftpc->count1) && item) {
1762 ftpc->count2 = 1; /* the sent command is allowed to fail */
1765 ftpc->count2 = 0; /* failure means cancel operation */
1767 PPSENDF(&ftpc->pp, "%s", cmd);
1784 if(ftpc->known_filesize != -1) {
1785 Curl_pgrsSetDownloadSize(data, ftpc->known_filesize);
1786 result = ftp_state_retr(conn, ftpc->known_filesize);
1789 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1815 PPSENDF(&conn->proto.ftpc.pp, "%s", "PASV");
1816 conn->proto.ftpc.count1++;
1897 struct ftp_conn *ftpc = &conn->proto.ftpc;
1905 if((ftpc->count1 == 0) &&
1935 ftpc->newport = (unsigned short)(num & 0xffff);
1944 snprintf(ftpc->newhost, sizeof(ftpc->newhost), "%s",
1948 snprintf(ftpc->newhost, NEWHOST_BUFSIZE, "%s", conn->ip_addr_str);
1959 else if((ftpc->count1 == 1) &&
2001 snprintf(ftpc->newhost, sizeof(ftpc->newhost), "%s", conn->host.name);
2003 snprintf(ftpc->newhost, sizeof(ftpc->newhost), "%s",
2007 snprintf(ftpc->newhost, sizeof(ftpc->newhost),
2009 ftpc->newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff);
2011 else if(ftpc->count1 == 0) {
2043 rc = Curl_resolv(conn, ftpc->newhost, ftpc->newport, &addr);
2048 connectport = ftpc->newport; /* we connect to the remote port */
2051 failf(data, "Can't resolve new host %s:%hu", ftpc->newhost, connectport);
2062 if(ftpc->count1 == 0 && ftpcode == 229)
2077 ftp_pasv_verbose(conn, conn->ip_addr, ftpc->newhost, connectport);
2089 struct ftp_conn *ftpc = &conn->proto.ftpc;
2090 ftpport fcmd = (ftpport)ftpc->count1;
2125 struct ftp_conn *ftpc = &conn->proto.ftpc;
2151 ftpc->file &&
2259 struct ftp_conn *ftpc = &conn->proto.ftpc;
2321 PPSENDF(&ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T,
2328 PPSENDF(&ftpc->pp, "RETR %s", ftpc->file);
2377 struct ftp_conn *ftpc = &conn->proto.ftpc;
2399 PPSENDF(&ftpc->pp, "RETR %s", ftpc->file);
2421 conn->proto.ftpc.state_saved = instate;
2434 struct ftp_conn *ftpc = &conn->proto.ftpc;
2436 ftpc->wait_data_conn = TRUE;
2536 conn->proto.ftpc.state_saved = instate;
2537 conn->proto.ftpc.retr_size_saved = size;
2547 struct ftp_conn *ftpc = &conn->proto.ftpc;
2550 ftpc->wait_data_conn = TRUE;
2593 PPSENDF(&conn->proto.ftpc.pp, "PBSZ %d", 0);
2610 struct ftp_conn *ftpc = &conn->proto.ftpc;
2614 if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
2617 PPSENDF(&ftpc->pp, "PASS %s", ftp->passwd?ftp->passwd:"");
2627 PPSENDF(&ftpc->pp, "ACCT %s", data->set.str[STRING_FTP_ACCOUNT]);
2644 PPSENDF(&conn->proto.ftpc.pp, "%s",
2681 struct ftp_conn *ftpc = &conn->proto.ftpc;
2682 struct pingpong *pp = &ftpc->pp;
2695 switch(ftpc->state) {
2699 return ftp_state_user_resp(conn, ftpcode, ftpc->state);
2728 ftpc->count3=0;
2732 ftpc->count2 = 1; /* add one to get next */
2733 ftpc->count1 = 0;
2736 ftpc->count2 = -1; /* subtract one to get next */
2737 ftpc->count1 = 1;
2744 PPSENDF(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
2773 else if(ftpc->count3 < 1) {
2774 ftpc->count3++;
2775 ftpc->count1 += ftpc->count2; /* get next attempt */
2776 result = Curl_pp_sendf(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
2794 result = ftp_state_user_resp(conn, ftpcode, ftpc->state);
2802 PPSENDF(&ftpc->pp, "PROT %c",
2822 PPSENDF(&ftpc->pp, "%s", "CCC");
2907 if(!ftpc->server_os && dir[0] != '/') {
2909 result = Curl_pp_sendf(&ftpc->pp, "%s", "SYST");
2914 Curl_safefree(ftpc->entrypath);
2915 ftpc->entrypath = dir; /* remember this */
2916 infof(data, "Entry path is '%s'\n", ftpc->entrypath);
2918 data->state.most_recent_ftp_entrypath = ftpc->entrypath;
2923 Curl_safefree(ftpc->entrypath);
2924 ftpc->entrypath = dir; /* remember this */
2925 infof(data, "Entry path is '%s'\n", ftpc->entrypath);
2927 data->state.most_recent_ftp_entrypath = ftpc->entrypath;
2962 result = Curl_pp_sendf(&ftpc->pp, "%s", "SITE NAMEFMT 1");
2968 Curl_safefree(ftpc->server_os);
2969 ftpc->server_os = os;
2976 Curl_safefree(ftpc->server_os);
2977 ftpc->server_os = os;
3003 if((ftpcode >= 400) && !ftpc->count2) {
3008 result = ftp_state_quote(conn, FALSE, ftpc->state);
3018 ftpc->count1 && !ftpc->count2) {
3020 ftpc->count2++; /* counter to prevent CWD-MKD loops */
3021 PPSENDF(&ftpc->pp, "MKD %s", ftpc->dirs[ftpc->count1 - 1]);
3027 ftpc->cwdfail = TRUE; /* don't remember this path as we failed
3034 ftpc->count2=0;
3035 if(++ftpc->count1 <= ftpc->dirdepth) {
3037 PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]);
3048 if((ftpcode/100 != 2) && !ftpc->count3--) {
3055 PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]);
3066 result = ftp_state_type_resp(conn, ftpcode, ftpc->state);
3072 result = ftp_state_size_resp(conn, ftpcode, ftpc->state);
3077 result = ftp_state_rest_resp(conn, ftpcode, ftpc->state);
3099 result = ftp_state_get_resp(conn, ftpcode, ftpc->state);
3103 result = ftp_state_stor_resp(conn, ftpcode, ftpc->state);
3123 struct ftp_conn *ftpc = &conn->proto.ftpc;
3124 CURLcode result = Curl_pp_statemach(&ftpc->pp, FALSE);
3129 *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;
3136 struct ftp_conn *ftpc = &conn->proto.ftpc;
3137 struct pingpong *pp = &ftpc->pp;
3140 while(ftpc->state != FTP_STOP) {
3161 struct ftp_conn *ftpc = &conn->proto.ftpc;
3162 struct pingpong *pp = &ftpc->pp;
3206 struct ftp_conn *ftpc = &conn->proto.ftpc;
3207 struct pingpong *pp = &ftpc->pp;
3211 bool was_ctl_valid = ftpc->ctl_valid;
3241 ftpc->ctl_valid = was_ctl_valid;
3248 ftpc->ctl_valid = FALSE;
3249 ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the
3257 if(ftpc->prevpath)
3258 free(ftpc->prevpath);
3261 if(data->set.chunk_end && ftpc->file) {
3264 ftpc->known_filesize = -1;
3274 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3276 ftpc->prevpath = NULL; /* no path remembering */
3279 size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is "raw" already */
3281 if(!ftpc->cwdfail) {
3283 ftpc->prevpath = path;
3286 ftpc->prevpath[dlen]=0; /* terminate */
3290 ftpc->prevpath=strdup("");
3293 if(ftpc->prevpath)
3294 infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath);
3297 ftpc->prevpath = NULL; /* no path */
3302 freedirs(ftpc);
3311 if(!result && ftpc->dont_check && data->req.maxdownload > 0) {
3317 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3337 if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
3356 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3363 if(ftpc->dont_check && data->req.maxdownload > 0) {
3371 if(!ftpc->dont_check) {
3411 else if(!ftpc->dont_check &&
3421 ftpc->dont_check = FALSE;
3447 struct ftp_conn *ftpc = &conn->proto.ftpc;
3448 struct pingpong *pp = &ftpc->pp;
3466 PPSENDF(&conn->proto.ftpc.pp, "%s", cmd);
3495 return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I');
3509 struct ftp_conn *ftpc = &conn->proto.ftpc;
3513 if(ftpc->transfertype == want) {
3518 PPSENDF(&ftpc->pp, "TYPE %c", want);
3522 ftpc->transfertype = want;
3559 struct ftp_conn *ftpc = &conn->proto.ftpc;
3595 ftpc->dont_check = TRUE; /* dont check for successful transfer */
3617 struct ftp_conn *ftpc = &conn->proto.ftpc;
3642 result = proxy_magic(conn, ftpc->newhost, ftpc->newport, &connected);
3646 if(result && (ftpc->count1 == 0)) {
3655 if(ftpc->state) {
3664 if(result || (ftpc->wait_data_conn != TRUE))
3667 if(ftpc->wait_data_conn)
3669 TRUE but so is ftpc->wait_data_conn, which says we need to wait for
3678 if(ftpc->wait_data_conn == TRUE) {
3688 ftpc->wait_data_conn = FALSE;
3714 else if(data->set.ftp_list_only || !ftpc->file) {
3744 if(!ftpc->wait_data_conn) {
3942 struct ftp_conn *ftpc = &conn->proto.ftpc;
3976 ftpc->known_filesize = finfo->size;
4032 struct ftp_conn *ftpc = &conn->proto.ftpc;
4035 ftpc->wait_data_conn = FALSE; /* default to no such wait */
4130 if(conn->proto.ftpc.ctl_valid) {
4131 result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "QUIT");
4135 conn->proto.ftpc.ctl_valid = FALSE; /* mark control connection as bad */
4158 struct ftp_conn *ftpc= &conn->proto.ftpc;
4159 struct pingpong *pp = &ftpc->pp;
4169 ftpc->ctl_valid = FALSE;
4174 if(ftpc->entrypath) {
4176 if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) {
4179 free(ftpc->entrypath);
4180 ftpc->entrypath = NULL;
4183 freedirs(ftpc);
4184 if(ftpc->prevpath) {
4185 free(ftpc->prevpath);
4186 ftpc->prevpath = NULL;
4188 if(ftpc->server_os) {
4189 free(ftpc->server_os);
4190 ftpc->server_os = NULL;
4215 struct ftp_conn *ftpc = &conn->proto.ftpc;
4224 ftpc->ctl_valid = FALSE;
4225 ftpc->cwdfail = FALSE;
4243 ftpc->file is not used anywhere other than for operations on a file.
4254 ftpc->dirdepth = 0;
4261 ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
4262 if(!ftpc->dirs)
4268 ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/",
4271 if(!ftpc->dirs[0]) {
4272 freedirs(ftpc);
4275 ftpc->dirdepth = 1; /* we consider it to be a single dir */
4284 ftpc->dirdepth = 0;
4285 ftpc->diralloc = 5; /* default dir depth to allocate */
4286 ftpc->dirs = calloc(ftpc->diralloc, sizeof(ftpc->dirs[0]));
4287 if(!ftpc->dirs)
4293 ftpc->dirs[0] = strdup("/");
4294 ftpc->dirdepth++;
4301 (ftpc->dirdepth == 0))?1:0;
4309 ftpc->dirs[ftpc->dirdepth] =
4311 if(!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
4313 freedirs(ftpc);
4316 if(isBadFtpString(ftpc->dirs[ftpc->dirdepth])) {
4317 free(ftpc->dirs[ftpc->dirdepth]);
4318 freedirs(ftpc);
4324 if(!ftpc->dirdepth) {
4326 ftpc->dirs[ftpc->dirdepth] = strdup("/");
4327 if(!ftpc->dirs[ftpc->dirdepth++]) { /* run out of memory ... */
4329 freedirs(ftpc);
4337 if(++ftpc->dirdepth >= ftpc->diralloc) {
4340 ftpc->diralloc *= 2; /* double the size each time */
4341 bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0]));
4343 freedirs(ftpc);
4346 ftpc->dirs = bigger;
4355 ftpc->file = curl_easy_unescape(conn->data, filename, 0, NULL);
4356 if(NULL == ftpc->file) {
4357 freedirs(ftpc);
4361 if(isBadFtpString(ftpc->file)) {
4362 freedirs(ftpc);
4367 ftpc->file=NULL; /* instead of point to a zero byte, we make it a NULL
4370 if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
4376 ftpc->cwddone = FALSE; /* default to not done */
4378 if(ftpc->prevpath) {
4384 freedirs(ftpc);
4388 dlen -= ftpc->file?curlx_uztosi(strlen(ftpc->file)):0;
4389 if((dlen == curlx_uztosi(strlen(ftpc->prevpath))) &&
4390 strnequal(path, ftpc->prevpath, dlen)) {
4392 ftpc->cwddone = TRUE;
4405 struct ftp_conn *ftpc = &conn->proto.ftpc;
4428 ftpc->ctl_valid = TRUE; /* seems good */
4468 struct ftp_conn *ftpc = &conn->proto.ftpc;
4476 ftpc->ctl_valid = TRUE; /* starts good */
4494 freedirs(ftpc);
4580 conn->proto.ftpc.known_filesize = -1; /* unknown size for now */