aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Smowton <cs448@cam.ac.uk>2011-04-07 14:17:05 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-04-07 14:18:07 +0200
commitd54668eb00c31e3eaf6987c5f4184aea98cf227e (patch)
treeb438dc178e0ac209523082e25a7c149902d85860 /lib
parentee4c1206de9ab08054b48b675fb049e64066deec (diff)
HTTP pipelining: Fix handling of zero-length responses
Also add test case 584 for the same Bug: http://curl.haxx.se/bug/view.cgi?id=3214223
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index bd5f49dd4..065c7341f 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -500,9 +500,28 @@ static CURLcode readwrite_data(struct SessionHandle *data,
}
#endif
- if(stop_reading)
+ if(stop_reading) {
/* We've stopped dealing with input, get out of the do-while loop */
- break;
+
+ if(nread > 0) {
+ if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {
+ infof(data,
+ "Rewinding stream by : %zd"
+ " bytes on url %s (zero-length body)\n",
+ nread, data->state.path);
+ read_rewind(conn, (size_t)nread);
+ }
+ else {
+ infof(data,
+ "Excess found in a non pipelined read:"
+ " excess = %zd"
+ " url = %s (zero-length body)\n",
+ nread, data->state.path);
+ }
+ }
+
+ break;
+ }
}
#endif /* CURL_DISABLE_HTTP */