static CURLcode pop3_cancel_auth(struct Curl_easy *data, const char *mech);
static CURLcode pop3_get_message(struct Curl_easy *data, struct bufref *out);
+/* This function scans the body after the end-of-body and writes everything
+ * until the end is found */
+static CURLcode pop3_write(struct Curl_easy *data,
+ const char *str, size_t nread, bool is_eos);
+
/*
* POP3 protocol handler.
*/
ZERO_NULL, /* domore_getsock */
ZERO_NULL, /* perform_getsock */
pop3_disconnect, /* disconnect */
- ZERO_NULL, /* write_resp */
+ pop3_write, /* write_resp */
ZERO_NULL, /* write_resp_hd */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
ZERO_NULL, /* domore_getsock */
ZERO_NULL, /* perform_getsock */
pop3_disconnect, /* disconnect */
- ZERO_NULL, /* write_resp */
+ pop3_write, /* write_resp */
ZERO_NULL, /* write_resp_hd */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
pp->nfinal = 0; /* done */
if(!data->req.no_body) {
- result = Curl_pop3_write(data, Curl_dyn_ptr(&pp->recvbuf),
- Curl_dyn_len(&pp->recvbuf));
+ result = pop3_write(data, Curl_dyn_ptr(&pp->recvbuf),
+ Curl_dyn_len(&pp->recvbuf), FALSE);
if(result)
return result;
}
/***********************************************************************
*
- * Curl_pop3_write()
+ * pop3_write()
*
* This function scans the body after the end-of-body and writes everything
* until the end is found.
*/
-CURLcode Curl_pop3_write(struct Curl_easy *data, const char *str, size_t nread)
+static CURLcode pop3_write(struct Curl_easy *data, const char *str,
+ size_t nread, bool is_eos)
{
/* This code could be made into a special function in the handler struct */
CURLcode result = CURLE_OK;
bool strip_dot = FALSE;
size_t last = 0;
size_t i;
+ (void)is_eos;
/* Search through the buffer looking for the end-of-body marker which is
5 bytes (0d 0a 2e 0d 0a). Note that a line starting with a dot matches
int cwtype = CLIENTWRITE_BODY;
if(is_eos)
cwtype |= CLIENTWRITE_EOS;
-
-#ifndef CURL_DISABLE_POP3
- if(blen && data->conn->handler->protocol & PROTO_FAMILY_POP3) {
- result = data->req.ignorebody? CURLE_OK :
- Curl_pop3_write(data, buf, blen);
- }
- else
-#endif /* CURL_DISABLE_POP3 */
- result = Curl_client_write(data, cwtype, buf, blen);
+ result = Curl_client_write(data, cwtype, buf, blen);
}
}