diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-03-27 12:14:57 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-03-28 13:27:49 +0200 |
commit | 452203341d6e97b8f52f9a886046d9fdb96346a9 (patch) | |
tree | c5aa7fa5e29da5a1799123703be46f28d0491fc1 /lib/multi.c | |
parent | 7975d10cf8a3fe9b35867509b9ef10d06614eb3a (diff) |
pause: handle mixed types of data when paused
When receiving chunked encoded data with trailers, and the write
callback returns PAUSE, there might be both body and header to store to
resend on unpause. Previously libcurl returned error for that case.
Added test case 1540 to verify.
Reported-by: Stephen Toub
Fixes #1354
Closes #1357
Diffstat (limited to 'lib/multi.c')
-rw-r--r-- | lib/multi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/multi.c b/lib/multi.c index 88ce00566..47e24005a 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -532,6 +532,7 @@ static CURLcode multi_done(struct connectdata **connp, CURLcode result; struct connectdata *conn; struct Curl_easy *data; + unsigned int i; DEBUGASSERT(*connp); @@ -598,9 +599,11 @@ static CURLcode multi_done(struct connectdata **connp, } /* if the transfer was completed in a paused state there can be buffered - data left to write and then kill */ - free(data->state.tempwrite); - data->state.tempwrite = NULL; + data left to free */ + for(i=0; i < data->state.tempcount; i++) { + free(data->state.tempwrite[i].buf); + } + data->state.tempcount = 0; /* if data->set.reuse_forbid is TRUE, it means the libcurl client has forced us to close this connection. This is ignored for requests taking |