91c50ee
From 98d59387c749256c2421b22dc3419b94d381986a Mon Sep 17 00:00:00 2001
91c50ee
From: Daniel Stenberg <daniel@haxx.se>
91c50ee
Date: Mon, 26 Aug 2019 16:00:05 +0200
91c50ee
Subject: [PATCH] http2: when marked for closure and wanted to close == OK
91c50ee
91c50ee
It could otherwise return an error even when closed correctly if GOAWAY
91c50ee
had been received previously.
91c50ee
91c50ee
Reported-by: Tom van der Woerdt
91c50ee
Fixes #4267
91c50ee
Closes #4268
91c50ee
91c50ee
Upstream-commit: c1b6a384f9c8a91197c20adb49d43f30dc0e917d
91c50ee
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
91c50ee
---
91c50ee
 lib/http2.c | 5 +++++
91c50ee
 1 file changed, 5 insertions(+)
91c50ee
91c50ee
diff --git a/lib/http2.c b/lib/http2.c
91c50ee
index 930e85165..31d2d698a 100644
91c50ee
--- a/lib/http2.c
91c50ee
+++ b/lib/http2.c
91c50ee
@@ -1566,6 +1566,11 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
91c50ee
   if(should_close_session(httpc)) {
91c50ee
     H2BUGF(infof(data,
91c50ee
                  "http2_recv: nothing to do in this session\n"));
91c50ee
+    if(conn->bits.close) {
91c50ee
+      /* already marked for closure, return OK and we're done */
91c50ee
+      *err = CURLE_OK;
91c50ee
+      return 0;
91c50ee
+    }
91c50ee
     *err = CURLE_HTTP2;
91c50ee
     return -1;
91c50ee
   }
91c50ee
-- 
91c50ee
2.20.1
91c50ee