diff options
author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2017-03-03 21:44:01 +0900 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-03-07 23:12:41 +0100 |
commit | 475c2583d506f9ee19375eb92c423dc492b1b2ed (patch) | |
tree | 3f67011561bf3dad939f7424b5ce8929b039ac7d | |
parent | 958e1766889d01b0e1f9634069ac413121c75e3c (diff) |
http2: Fix assertion error on redirect with CL=0
This fixes assertion error which occurs when redirect is done with 0
length body via HTTP/2, and the easy handle is reused, but new
connection is established due to hostname change:
curl: http2.c:1572: ssize_t http2_recv(struct connectdata *,
int, char *, size_t, CURLcode *):
Assertion `httpc->drain_total >= data->state.drain' failed.
To fix this bug, ensure that http2_handle_stream is called.
Fixes #1286
Closes #1302
-rw-r--r-- | lib/http.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/http.c b/lib/http.c index 8db86cd84..fbb0376a3 100644 --- a/lib/http.c +++ b/lib/http.c @@ -3240,9 +3240,17 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, k->maxdownload = k->size; } - /* If max download size is *zero* (nothing) we already - have nothing and can safely return ok now! */ - if(0 == k->maxdownload) + /* If max download size is *zero* (nothing) we already have + nothing and can safely return ok now! But for HTTP/2, we'd + like to call http2_handle_stream_close to properly close a + stream. In order to do this, we keep reading until we + close the stream. */ + if(0 == k->maxdownload +#if defined(USE_NGHTTP2) + && !((conn->handler->protocol & PROTO_FAMILY_HTTP) && + conn->httpversion == 20) +#endif + ) *stop_reading = TRUE; if(*stop_reading) { |