Added a loop to pop3_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.
if(pp->sendleft)
return Curl_pp_flushsend(pp);
- /* Read the response from the server */
- result = Curl_pp_readresp(sock, pp, &pop3code, &nread);
- if(result)
- return result;
+ do {
+ /* Read the response from the server */
+ result = Curl_pp_readresp(sock, pp, &pop3code, &nread);
+ if(result)
+ return result;
+
+ if(!pop3code)
+ break;
- if(pop3code) {
/* We have now received a full POP3 server response */
switch(pop3c->state) {
case POP3_SERVERGREET:
state(conn, POP3_STOP);
break;
}
- }
+ } while(!result && pop3c->state != POP3_STOP && Curl_pp_moredata(pp));
return result;
}