diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-12-20 07:17:17 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-12-20 07:20:49 +0000 |
commit | 045297671100a1361e0fb99f4a71a2cc696382b0 (patch) | |
tree | a498e3ff3403b7d1da34804e0a7cb3e1bece568a | |
parent | 94d820b4cbf764b820c8b76e9705b88ab1932656 (diff) |
pop3: Fixed processing of more than one response when sent in same packet
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.
-rw-r--r-- | lib/pop3.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/pop3.c b/lib/pop3.c index 71873a7cc..093b77e93 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -1376,12 +1376,15 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) 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: @@ -1471,7 +1474,7 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) state(conn, POP3_STOP); break; } - } + } while(!result && pop3c->state != POP3_STOP && Curl_pp_moredata(pp)); return result; } |