diff --git a/lib/http2.c b/lib/http2.c index de6d03d39..bd29a926b 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1094,17 +1094,13 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, nread = ((Curl_recv *)httpc->recv_underlying)( conn, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, &result); - if(result == CURLE_AGAIN) { + if(nread == -1) { + if(result != CURLE_AGAIN) + failf(data, "Failed receiving HTTP2 data"); *err = result; return -1; } - if(nread == -1) { - failf(data, "Failed receiving HTTP2 data"); - *err = result; - return 0; - } - if(nread == 0) { failf(data, "Unexpected EOF"); *err = CURLE_RECV_ERROR;