1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 09:08:49 -05:00

imap: set cselect_bits to CURL_CSELECT_IN initially

... when continuing a transfer from a FETCH response.

When the size of the file was small enough that the entirety of the
transfer happens in a single go and schannel buffers holds the entire
data. However, it wasn't completely read in Curl_pp_readresp since a
line break was found before that could happen. So, by the time we are in
imap_state_fetch_resp - there's data in buffers that needs to be read
via Curl_read but nothing to read from the socket. After we setup a
transfer (Curl_setup_transfer), curl just waits on the socket state to
change - which doesn't happen since no new data ever comes.

Closes #5961
This commit is contained in:
Antarpreet Singh 2020-05-08 00:50:26 +05:30 committed by Daniel Stenberg
parent 51e8f2938b
commit da5ae38db0
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1176,6 +1176,9 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
else { else {
/* IMAP download */ /* IMAP download */
data->req.maxdownload = size; data->req.maxdownload = size;
/* force a recv/send check of this connection, as the data might've been
read off the socket already */
data->conn->cselect_bits = CURL_CSELECT_IN;
Curl_setup_transfer(data, FIRSTSOCKET, size, FALSE, -1); Curl_setup_transfer(data, FIRSTSOCKET, size, FALSE, -1);
} }
} }