mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
imap: Added processing of more than one response when sent in same packet
Added a loop to imap_statemach_act() in which Curl_pp_readresp() is called until the cache is drained. Without this multiple responses received in a single packet could result in a hang or delay.
This commit is contained in:
parent
b644c47192
commit
c368fbcb10
21
lib/imap.c
21
lib/imap.c
@ -1351,16 +1351,19 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
|
|||||||
if(pp->sendleft)
|
if(pp->sendleft)
|
||||||
return Curl_pp_flushsend(pp);
|
return Curl_pp_flushsend(pp);
|
||||||
|
|
||||||
/* Read the response from the server */
|
do {
|
||||||
result = Curl_pp_readresp(sock, pp, &imapcode, &nread);
|
/* Read the response from the server */
|
||||||
if(result)
|
result = Curl_pp_readresp(sock, pp, &imapcode, &nread);
|
||||||
return result;
|
if(result)
|
||||||
|
return result;
|
||||||
|
|
||||||
/* Was there an error parsing the response line? */
|
/* Was there an error parsing the response line? */
|
||||||
if(imapcode == -1)
|
if(imapcode == -1)
|
||||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||||
|
|
||||||
|
if(!imapcode)
|
||||||
|
break;
|
||||||
|
|
||||||
if(imapcode) {
|
|
||||||
/* We have now received a full IMAP server response */
|
/* We have now received a full IMAP server response */
|
||||||
switch(imapc->state) {
|
switch(imapc->state) {
|
||||||
case IMAP_SERVERGREET:
|
case IMAP_SERVERGREET:
|
||||||
@ -1436,7 +1439,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
|
|||||||
state(conn, IMAP_STOP);
|
state(conn, IMAP_STOP);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while(!result && imapc->state != IMAP_STOP && Curl_pp_moredata(pp));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user