pingpong: rename the curl_pp_transfer enum to use PP prefix

Using an FTP prefix for PP provided functionality was misleading.
This commit is contained in:
Daniel Stenberg 2021-02-04 13:06:17 +01:00
parent bcba216f9b
commit 5f08a5acd5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
5 changed files with 32 additions and 33 deletions

View File

@ -1357,7 +1357,7 @@ static CURLcode ftp_state_prepare_transfer(struct Curl_easy *data)
struct FTP *ftp = data->req.p.ftp;
struct connectdata *conn = data->conn;
if(ftp->transfer != FTPTRANSFER_BODY) {
if(ftp->transfer != PPTRANSFER_BODY) {
/* doesn't transfer any data */
/* still possibly do PRE QUOTE jobs */
@ -1401,7 +1401,7 @@ static CURLcode ftp_state_rest(struct Curl_easy *data,
struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
if((ftp->transfer != PPTRANSFER_BODY) && ftpc->file) {
/* if a "head"-like request is being made (on a file) */
/* Determine if server can respond to REST command and therefore
@ -1423,7 +1423,7 @@ static CURLcode ftp_state_size(struct Curl_easy *data,
struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
if((ftp->transfer == PPTRANSFER_INFO) && ftpc->file) {
/* if a "head"-like request is being made (on a file) */
/* we know ftpc->file is a valid pointer to a file name */
@ -1530,7 +1530,7 @@ static CURLcode ftp_state_type(struct Curl_easy *data)
may not support it! It is however the only way we have to get a file's
size! */
ftp->transfer = FTPTRANSFER_INFO;
ftp->transfer = PPTRANSFER_INFO;
/* this means no actual transfer will be made */
/* Some servers return different sizes for different modes, and thus we
@ -1652,7 +1652,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
/* Set ->transfer so that we won't get any error in
* ftp_done() because we didn't transfer anything! */
ftp->transfer = FTPTRANSFER_NONE;
ftp->transfer = PPTRANSFER_NONE;
state(data, FTP_STOP);
return CURLE_OK;
@ -1739,7 +1739,7 @@ static CURLcode ftp_state_quote(struct Curl_easy *data,
result = ftp_state_cwd(data, conn);
break;
case FTP_RETR_PREQUOTE:
if(ftp->transfer != FTPTRANSFER_BODY)
if(ftp->transfer != PPTRANSFER_BODY)
state(data, FTP_STOP);
else {
if(ftpc->known_filesize != -1) {
@ -2133,7 +2133,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
default:
if(data->info.filetime <= data->set.timevalue) {
infof(data, "The requested document is not new enough\n");
ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */
data->info.timecond = TRUE;
state(data, FTP_STOP);
return CURLE_OK;
@ -2142,7 +2142,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
case CURL_TIMECOND_IFUNMODSINCE:
if(data->info.filetime > data->set.timevalue) {
infof(data, "The requested document is not old enough\n");
ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */
data->info.timecond = TRUE;
state(data, FTP_STOP);
return CURLE_OK;
@ -2250,7 +2250,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
/* Set ->transfer so that we won't get any error in ftp_done()
* because we didn't transfer the any file */
ftp->transfer = FTPTRANSFER_NONE;
ftp->transfer = PPTRANSFER_NONE;
state(data, FTP_STOP);
return CURLE_OK;
}
@ -2521,7 +2521,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
else {
if((instate == FTP_LIST) && (ftpcode == 450)) {
/* simply no matching files in the dir listing */
ftp->transfer = FTPTRANSFER_NONE; /* don't download anything */
ftp->transfer = PPTRANSFER_NONE; /* don't download anything */
state(data, FTP_STOP); /* this phase is over */
}
else {
@ -3291,7 +3291,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
close_secondarysocket(data, conn);
}
if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
if(!result && (ftp->transfer == PPTRANSFER_BODY) && ftpc->ctl_valid &&
pp->pending_resp && !premature) {
/*
* Let's see what the server says about the transfer we just performed,
@ -3351,7 +3351,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
if((-1 != data->state.infilesize) &&
(data->state.infilesize != data->req.writebytecount) &&
!data->set.crlf &&
(ftp->transfer == FTPTRANSFER_BODY)) {
(ftp->transfer == PPTRANSFER_BODY)) {
failf(data, "Uploaded unaligned file size (%" CURL_FORMAT_CURL_OFF_T
" out of %" CURL_FORMAT_CURL_OFF_T " bytes)",
data->req.bytecount, data->state.infilesize);
@ -3383,7 +3383,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
}
/* clear these for next connection */
ftp->transfer = FTPTRANSFER_BODY;
ftp->transfer = PPTRANSFER_BODY;
ftpc->dont_check = FALSE;
/* Send any post-transfer QUOTE strings? */
@ -3594,7 +3594,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
*completep = 0;
}
if(ftp->transfer <= FTPTRANSFER_INFO) {
if(ftp->transfer <= PPTRANSFER_INFO) {
/* a transfer is about to take place, or if not a file name was given
so we'll do a SIZE on it later and then we need the right TYPE first */
@ -3647,7 +3647,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
need to set ASCII transfer mode. */
/* But only if a body transfer was requested. */
if(ftp->transfer == FTPTRANSFER_BODY) {
if(ftp->transfer == PPTRANSFER_BODY) {
result = ftp_nb_type(data, conn, TRUE, FTP_LIST_TYPE);
if(result)
return result;
@ -3703,7 +3703,7 @@ CURLcode ftp_perform(struct Curl_easy *data,
if(data->set.opt_no_body) {
/* requested no body means no transfer... */
struct FTP *ftp = data->req.p.ftp;
ftp->transfer = FTPTRANSFER_INFO;
ftp->transfer = PPTRANSFER_INFO;
}
*dophase_done = FALSE; /* not done yet */
@ -4193,7 +4193,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
ftpc->file = NULL; /* instead of point to a zero byte,
we make it a NULL pointer */
if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
if(data->set.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) {
/* We need a file name when uploading. Return error! */
failf(data, "Uploading to a URL without a file name!");
free(rawPath);
@ -4241,7 +4241,7 @@ static CURLcode ftp_dophase_done(struct Curl_easy *data, bool connected)
}
}
if(ftp->transfer != FTPTRANSFER_BODY)
if(ftp->transfer != PPTRANSFER_BODY)
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);
else if(!connected)
@ -4361,7 +4361,7 @@ static CURLcode ftp_setup_connection(struct Curl_easy *data,
}
/* get some initial data into the ftp struct */
ftp->transfer = FTPTRANSFER_BODY;
ftp->transfer = PPTRANSFER_BODY;
ftp->downloadsize = 0;
conn->proto.ftpc.known_filesize = -1; /* unknown size for now */

View File

@ -1519,7 +1519,7 @@ static CURLcode imap_done(struct Curl_easy *data, CURLcode status,
Curl_safefree(imap->custom_params);
/* Clear the transfer mode for the next request */
imap->transfer = FTPTRANSFER_BODY;
imap->transfer = PPTRANSFER_BODY;
return result;
}
@ -1545,7 +1545,7 @@ static CURLcode imap_perform(struct Curl_easy *data, bool *connected,
if(data->set.opt_no_body) {
/* Requested no body means no transfer */
imap->transfer = FTPTRANSFER_INFO;
imap->transfer = PPTRANSFER_INFO;
}
*dophase_done = FALSE; /* not done yet */
@ -1667,7 +1667,7 @@ static CURLcode imap_dophase_done(struct Curl_easy *data, bool connected)
(void)connected;
if(imap->transfer != FTPTRANSFER_BODY)
if(imap->transfer != PPTRANSFER_BODY)
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);

View File

@ -33,10 +33,9 @@
struct connectdata;
typedef enum {
FTPTRANSFER_BODY, /* yes do transfer a body */
FTPTRANSFER_INFO, /* do still go through to get info/headers */
FTPTRANSFER_NONE, /* don't get anything and don't get info */
FTPTRANSFER_LAST /* end of list marker, never used */
PPTRANSFER_BODY, /* yes do transfer a body */
PPTRANSFER_INFO, /* do still go through to get info/headers */
PPTRANSFER_NONE /* don't get anything and don't get info */
} curl_pp_transfer;
/*

View File

@ -576,7 +576,7 @@ static CURLcode pop3_perform_command(struct Curl_easy *data)
if(pop3->id[0] != '\0')
/* Message specific LIST so skip the BODY transfer */
pop3->transfer = FTPTRANSFER_INFO;
pop3->transfer = PPTRANSFER_INFO;
}
else
command = "RETR";
@ -916,7 +916,7 @@ static CURLcode pop3_state_command_resp(struct Curl_easy *data,
the strip counter here so that these bytes won't be delivered. */
pop3c->strip = 2;
if(pop3->transfer == FTPTRANSFER_BODY) {
if(pop3->transfer == PPTRANSFER_BODY) {
/* POP3 download */
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
@ -1150,7 +1150,7 @@ static CURLcode pop3_done(struct Curl_easy *data, CURLcode status,
Curl_safefree(pop3->custom);
/* Clear the transfer mode for the next request */
pop3->transfer = FTPTRANSFER_BODY;
pop3->transfer = PPTRANSFER_BODY;
return result;
}
@ -1174,7 +1174,7 @@ static CURLcode pop3_perform(struct Curl_easy *data, bool *connected,
if(data->set.opt_no_body) {
/* Requested no body means no transfer */
pop3->transfer = FTPTRANSFER_INFO;
pop3->transfer = PPTRANSFER_INFO;
}
*dophase_done = FALSE; /* not done yet */

View File

@ -1433,7 +1433,7 @@ static CURLcode smtp_done(struct Curl_easy *data, CURLcode status,
}
/* Clear the transfer mode for the next request */
smtp->transfer = FTPTRANSFER_BODY;
smtp->transfer = PPTRANSFER_BODY;
return result;
}
@ -1457,7 +1457,7 @@ static CURLcode smtp_perform(struct Curl_easy *data, bool *connected,
if(data->set.opt_no_body) {
/* Requested no body means no transfer */
smtp->transfer = FTPTRANSFER_INFO;
smtp->transfer = PPTRANSFER_INFO;
}
*dophase_done = FALSE; /* not done yet */
@ -1564,7 +1564,7 @@ static CURLcode smtp_dophase_done(struct Curl_easy *data, bool connected)
(void)connected;
if(smtp->transfer != FTPTRANSFER_BODY)
if(smtp->transfer != PPTRANSFER_BODY)
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);