if(pp->sendleft)
return Curl_pp_flushsend(pp);
- /* Read the response from the server */
- result = Curl_pp_readresp(sock, pp, &imapcode, &nread);
- if(result)
- return result;
+ do {
+ /* Read the response from the server */
+ result = Curl_pp_readresp(sock, pp, &imapcode, &nread);
+ if(result)
+ return result;
- /* Was there an error parsing the response line? */
- if(imapcode == -1)
- return CURLE_FTP_WEIRD_SERVER_REPLY;
+ /* Was there an error parsing the response line? */
+ if(imapcode == -1)
+ return CURLE_FTP_WEIRD_SERVER_REPLY;
+
+ if(!imapcode)
+ break;
- if(imapcode) {
/* We have now received a full IMAP server response */
switch(imapc->state) {
case IMAP_SERVERGREET:
state(conn, IMAP_STOP);
break;
}
- }
+ } while(!result && imapc->state != IMAP_STOP && Curl_pp_moredata(pp));
return result;
}