mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
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
This commit is contained in:
parent
7aea2d522d
commit
18a758d907
@ -594,11 +594,14 @@ static CURLcode readwrite_data(struct SessionHandle *data,
|
|||||||
|
|
||||||
dataleft = conn->chunk.dataleft;
|
dataleft = conn->chunk.dataleft;
|
||||||
if(dataleft != 0) {
|
if(dataleft != 0) {
|
||||||
infof(conn->data, "Leftovers after chunking. "
|
infof(conn->data, "Leftovers after chunking: %zu bytes", dataleft);
|
||||||
" Rewinding %zu bytes\n",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);
|
read_rewind(conn, dataleft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* If it returned OK, we just keep going */
|
/* If it returned OK, we just keep going */
|
||||||
}
|
}
|
||||||
#endif /* CURL_DISABLE_HTTP */
|
#endif /* CURL_DISABLE_HTTP */
|
||||||
|
Loading…
Reference in New Issue
Block a user