aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-09-07 18:22:54 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-09-07 18:29:03 +0200
commit18a758d9078f506ecfb995ef5ece46a83887a5da (patch)
tree1ee558e8d628fedf78acb7a207d645705bbbab35 /lib
parent7aea2d522df515a71447998e9875638ccac7b4b5 (diff)
chunky parser: only rewind if needed
The code reading chunked encoding attempts to rewind the code if it had read more data than the chunky parser consumes. The rewinding can fail and it will then cause an error. This change now makes the rewinding only happen if pipelining is in use - as that's the only time it really needs to be done. Bug: http://curl.haxx.se/mail/lib-2010-08/0297.html Reported by: Ron Parker
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 71fb3961e..feaf93695 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -594,9 +594,12 @@ static CURLcode readwrite_data(struct SessionHandle *data,
dataleft = conn->chunk.dataleft;
if(dataleft != 0) {
- infof(conn->data, "Leftovers after chunking. "
- " Rewinding %zu bytes\n",dataleft);
- read_rewind(conn, dataleft);
+ infof(conn->data, "Leftovers after chunking: %zu bytes", dataleft);
+ if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {
+ /* only attempt the rewind if we truly are pipelining */
+ infof(conn->data, "Rewinding %zu bytes\n",dataleft);
+ read_rewind(conn, dataleft);
+ }
}
}
/* If it returned OK, we just keep going */