summaryrefslogtreecommitdiff
path: root/lib/http2.c
diff options
context:
space:
mode:
authorPeng-Yu Chen <pengyu@libstarrify.so>2021-05-10 23:05:36 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-05-11 08:03:22 +0200
commit455a63c66f188598275e87d32de2c4e8e26b80cb (patch)
treeb3e7fb190e08527a159de7a4fcfe625afa6f62aa /lib/http2.c
parent651a75e1e71be0eeb27cbfa041225a725debef9e (diff)
downloadcurl-455a63c66f188598275e87d32de2c4e8e26b80cb.tar.gz
http2: skip immediate parsing of payload following protocol switch
This is considered not harmful as a following http2_recv shall be called very soon. This is considered helpful in the specific situation where some servers (e.g. nghttpx v1.43.0) may fulfill stream 1 immediately following the return of HTTP status 101, other than waiting for the client-side connection preface to arrive. Fixes #7036 Closes #7040
Diffstat (limited to 'lib/http2.c')
-rw-r--r--lib/http2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/http2.c b/lib/http2.c
index 661a4cbab..ac04d348c 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -2335,8 +2335,15 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
DEBUGASSERT(httpc->nread_inbuf == 0);
- if(-1 == h2_process_pending_input(data, httpc, &result))
- return CURLE_HTTP2;
+ /* Good enough to call it an end once the remaining payload is copied to the
+ * connection buffer.
+ * Some servers (e.g. nghttpx v1.43.0) may fulfill stream 1 immediately
+ * following the protocol switch other than waiting for the client-side
+ * connection preface. If h2_process_pending_input is invoked here to parse
+ * the remaining payload, stream 1 would be marked as closed too early and
+ * thus ignored in http2_recv (following 252790c53).
+ * The logic in lib/http.c and lib/transfer.c guarantees a following
+ * http2_recv would be invoked very soon. */
return CURLE_OK;
}