From: Tatsuhiro Tsujikawa Date: Sat, 13 Sep 2014 02:59:23 +0000 (+0900) Subject: http2: Fix busy loop when EOF is encountered X-Git-Tag: curl-7_39_0~220 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d9bef9286cd8efbed032d41a36e82d1c44058a7;p=thirdparty%2Fcurl.git http2: Fix busy loop when EOF is encountered Previously we did not handle EOF from underlying transport socket and wrongly just returned error code CURL_AGAIN from http2_recv, which caused busy loop since socket has been closed. This patch adds the code to handle EOF situation and tells the upper layer that we got EOF. --- diff --git a/lib/http2.c b/lib/http2.c index 604514d71c..f86d3ebff1 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -744,6 +744,12 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, } infof(conn->data, "nread=%zd\n", nread); + + if(nread == 0) { + failf(conn->data, "EOF"); + return 0; + } + rv = nghttp2_session_mem_recv(httpc->h2, (const uint8_t *)httpc->inbuf, nread);