From cde0cf7c5ede69c68cb00cba3d1a6ccc27c24bc9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 27 Feb 2014 01:21:17 +0900 Subject: Fix bug that HTTP/2 hangs if whole response body is read with headers For HTTP/2, we may read up everything including responde body with header fields in Curl_http_readwrite_headers. If no content-length is provided, curl waits for the connection close, which we emulate it using conn->proto.httpc.closed = TRUE. The thing is if we read everything, then http2_recv won't be called and we cannot signal the HTTP/2 stream has closed. As a workaround, we return nonzero from data_pending to call http2_recv. --- lib/http2.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/http2.c') diff --git a/lib/http2.c b/lib/http2.c index d364f3a77..b20854a3b 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -514,6 +514,10 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, (void)sockindex; /* we always do HTTP2 on sockindex 0 */ + if(httpc->closed) { + return 0; + } + /* Nullify here because we call nghttp2_session_send() and they might refer to the old buffer. */ httpc->upload_mem = NULL; -- cgit v1.2.3