Skip to content

Commit

Permalink
http2: Fix busy loop when EOF is encountered
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tatsuhiro-t authored and bagder committed Sep 13, 2014
1 parent 1d2ffb4 commit 7d9bef9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/http2.c
Expand Up @@ -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);

Expand Down

0 comments on commit 7d9bef9

Please sign in to comment.