aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-09-13 11:59:23 +0900
committerDaniel Stenberg <daniel@haxx.se>2014-09-13 13:54:08 +0200
commit7d9bef9286cd8efbed032d41a36e82d1c44058a7 (patch)
tree831152bfd98936915b6ea859c2501003b8813346 /lib
parent1d2ffb47125700c6c6a9371794490cc4b011dbde (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/http2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/http2.c b/lib/http2.c
index 604514d71..f86d3ebff 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);