aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2012-03-24 00:09:38 +0000
committerSteve Holme <steve_holme@hotmail.com>2012-03-24 00:09:38 +0000
commit602a8a565cf8661a85b74f23e14449ff04b9f543 (patch)
tree8caa6e29e95dc8fa4fa6e2b52e5c829eb799fd1d /lib/pop3.c
parentc4a8446c7087ce1502e0df5214ab1e61f168a098 (diff)
pop3.c: Fixed body data being written when CURLOPT_NOBODY is specified
Body data would be forwarded to the client application in both the RETR and LIST commands even if CURLOPT_NOBODY was specified.
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index 4cddba25d..c95f45e19 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -382,30 +382,32 @@ static CURLcode pop3_state_retr_resp(struct connectdata *conn,
}
/* POP3 download */
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE,
- pop3->bytecountp, -1, NULL); /* no upload here */
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp,
+ -1, NULL); /* no upload here */
if(pp->cache) {
- /* At this point there is a bunch of data in the header "cache" that is
- actually body content, send it as body and then skip it. Do note
- that there may even be additional "headers" after the body. */
+ /* The header "cache" contains a bunch of data that is actually body
+ content so send it as such. Note that there may even be additional
+ "headers" after the body */
- /* we may get the EOB already here! */
- result = Curl_pop3_write(conn, pp->cache, pp->cache_size);
- if(result)
- return result;
+ if(!data->set.opt_no_body) {
+ result = Curl_pop3_write(conn, pp->cache, pp->cache_size);
+ if(result)
+ return result;
+ }
- /* cache is drained */
- free(pp->cache);
- pp->cache = NULL;
+ /* Free the cache */
+ Curl_safefree(pp->cache);
+
+ /* Reset the cache size */
pp->cache_size = 0;
}
state(conn, POP3_STOP);
+
return result;
}
-
/* for the list response */
static CURLcode pop3_state_list_resp(struct connectdata *conn,
int pop3code,
@@ -439,20 +441,24 @@ static CURLcode pop3_state_list_resp(struct connectdata *conn,
-1, NULL); /* no upload here */
if(pp->cache) {
- /* cache holds the email ID listing */
+ /* The header "cache" contains a bunch of data that is actually list data
+ so send it as such */
- /* we may get the EOB already here! */
- result = Curl_pop3_write(conn, pp->cache, pp->cache_size);
- if(result)
- return result;
+ if(!data->set.opt_no_body) {
+ result = Curl_pop3_write(conn, pp->cache, pp->cache_size);
+ if(result)
+ return result;
+ }
- /* cache is drained */
- free(pp->cache);
- pp->cache = NULL;
+ /* Free the cache */
+ Curl_safefree(pp->cache);
+
+ /* Reset the cache size */
pp->cache_size = 0;
}
state(conn, POP3_STOP);
+
return result;
}