]> granicus.if.org Git - curl/commitdiff
HTTP/2: Fix infinite loop in readwrite_data()
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Sun, 3 Aug 2014 04:57:57 +0000 (13:57 +0900)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 3 Aug 2014 20:49:56 +0000 (22:49 +0200)
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.

lib/http2.c

index 77dd014d33bd6bc3159079469dcb6a444b09a1f5..c53012d6ed0c402c3c4880c2cdf64a0f5f933f06 100644 (file)
@@ -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;