From: Tatsuhiro Tsujikawa Date: Sun, 3 Aug 2014 04:57:57 +0000 (+0900) Subject: HTTP/2: Fix infinite loop in readwrite_data() X-Git-Tag: curl-7_38_0~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67920e15167790e6d5f347ef7672bb4a2e5f712f;p=thirdparty%2Fcurl.git HTTP/2: Fix infinite loop in readwrite_data() To prevent infinite loop in readwrite_data() function when stream is reset before any response body comes, reset closed flag to false once it is evaluated to true. --- diff --git a/lib/http2.c b/lib/http2.c index 77dd014d33..c53012d6ed 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -668,6 +668,9 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, (void)sockindex; /* we always do HTTP2 on sockindex 0 */ if(httpc->closed) { + /* Reset to FALSE to prevent infinite loop in readwrite_data + function. */ + httpc->closed = FALSE; return 0; } @@ -747,6 +750,9 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, /* If stream is closed, return 0 to signal the http routine to close the connection */ if(httpc->closed) { + /* Reset to FALSE to prevent infinite loop in readwrite_data + function. */ + httpc->closed = FALSE; return 0; } *err = CURLE_AGAIN;