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
This commit is contained in:
Daniel Stenberg 2017-03-27 12:14:57 +02:00
parent 7975d10cf8
commit 452203341d
8 changed files with 290 additions and 54 deletions

View file

@ -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