mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
imap: Removed more FTP leftovers
Changed some variables and comments still using FTP terminology.
This commit is contained in:
parent
13625a0d09
commit
35fb6bee0e
32
lib/imap.c
32
lib/imap.c
@ -664,7 +664,7 @@ static CURLcode imap_state_servergreet_resp(struct connectdata *conn,
|
|||||||
|
|
||||||
if(imapcode != 'O') {
|
if(imapcode != 'O') {
|
||||||
failf(data, "Got unexpected imap-server response");
|
failf(data, "Got unexpected imap-server response");
|
||||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
return CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */
|
||||||
}
|
}
|
||||||
|
|
||||||
result = imap_state_capability(conn);
|
result = imap_state_capability(conn);
|
||||||
@ -1168,11 +1168,11 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
|
|||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr == '{') {
|
if(*ptr == '{') {
|
||||||
curl_off_t filesize = curlx_strtoofft(ptr + 1, NULL, 10);
|
curl_off_t size = curlx_strtoofft(ptr + 1, NULL, 10);
|
||||||
if(filesize)
|
if(size)
|
||||||
Curl_pgrsSetDownloadSize(data, filesize);
|
Curl_pgrsSetDownloadSize(data, size);
|
||||||
|
|
||||||
infof(data, "Found %" FORMAT_OFF_TU " bytes to download\n", filesize);
|
infof(data, "Found %" FORMAT_OFF_TU " bytes to download\n", size);
|
||||||
|
|
||||||
if(pp->cache) {
|
if(pp->cache) {
|
||||||
/* At this point there is a bunch of data in the header "cache" that is
|
/* At this point there is a bunch of data in the header "cache" that is
|
||||||
@ -1180,20 +1180,20 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
|
|||||||
that there may even be additional "headers" after the body. */
|
that there may even be additional "headers" after the body. */
|
||||||
size_t chunk = pp->cache_size;
|
size_t chunk = pp->cache_size;
|
||||||
|
|
||||||
if(chunk > (size_t)filesize)
|
if(chunk > (size_t)size)
|
||||||
/* the conversion from curl_off_t to size_t is always fine here */
|
/* the conversion from curl_off_t to size_t is always fine here */
|
||||||
chunk = (size_t)filesize;
|
chunk = (size_t)size;
|
||||||
|
|
||||||
result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk);
|
result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
filesize -= chunk;
|
size -= chunk;
|
||||||
|
|
||||||
/* we've now used parts of or the entire cache */
|
/* we've now used parts of or the entire cache */
|
||||||
if(pp->cache_size > chunk) {
|
if(pp->cache_size > chunk) {
|
||||||
/* part of, move the trailing data to the start and reduce the size */
|
/* part of, move the trailing data to the start and reduce the size */
|
||||||
memmove(pp->cache, pp->cache+chunk,
|
memmove(pp->cache, pp->cache + chunk,
|
||||||
pp->cache_size - chunk);
|
pp->cache_size - chunk);
|
||||||
pp->cache_size -= chunk;
|
pp->cache_size -= chunk;
|
||||||
}
|
}
|
||||||
@ -1205,17 +1205,17 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
infof(data, "Filesize left: %" FORMAT_OFF_T "\n", filesize);
|
infof(data, "Size left: %" FORMAT_OFF_T "\n", size);
|
||||||
|
|
||||||
if(!filesize)
|
if(!size)
|
||||||
/* the entire data is already transferred! */
|
/* the entire data is already transferred! */
|
||||||
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
else
|
else
|
||||||
/* IMAP download */
|
/* IMAP download */
|
||||||
Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, size, FALSE, imap->bytecountp,
|
||||||
imap->bytecountp, -1, NULL); /* no upload here */
|
-1, NULL); /* no upload here */
|
||||||
|
|
||||||
data->req.maxdownload = filesize;
|
data->req.maxdownload = size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* We don't know how to parse this line */
|
/* We don't know how to parse this line */
|
||||||
@ -1479,8 +1479,8 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
*
|
*
|
||||||
* imap_perform()
|
* imap_perform()
|
||||||
*
|
*
|
||||||
* This is the actual DO function for IMAP. Get a file/directory according to
|
* This is the actual DO function for IMAP. Fetch a message according to the
|
||||||
* the options previously setup.
|
* options previously setup.
|
||||||
*/
|
*/
|
||||||
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
||||||
bool *dophase_done)
|
bool *dophase_done)
|
||||||
|
Loading…
Reference in New Issue
Block a user