aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-08-16 13:21:11 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-08-17 23:16:55 +0200
commitc7ea4ddd2e5db304bc3170eeb8d5aa91f1921013 (patch)
tree9651ed35972e610afd4d6e056f2a5a94ba7d7653
parentba58ce669ca6609253055d081a00a4f709ce382e (diff)
http2: make sure to send after RST_STREAM
If this is the last stream on this connection, the RST_STREAM might not get pushed to the wire otherwise. Fixes #2882 Closes #2887 Researched-by: Michael Kaufmann
-rw-r--r--lib/http2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/http2.c b/lib/http2.c
index e9ec73a6d..9380ca7cf 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1146,6 +1146,9 @@ void Curl_http2_done(struct connectdata *conn, bool premature)
struct HTTP *http = data->req.protop;
struct http_conn *httpc = &conn->proto.httpc;
+ if(!httpc->h2) /* not HTTP/2 ? */
+ return;
+
if(data->state.drain)
drained_transfer(data, httpc);
@@ -1166,8 +1169,10 @@ void Curl_http2_done(struct connectdata *conn, bool premature)
if(premature) {
/* RST_STREAM */
- nghttp2_submit_rst_stream(httpc->h2, NGHTTP2_FLAG_NONE, http->stream_id,
- NGHTTP2_STREAM_CLOSED);
+ if(!nghttp2_submit_rst_stream(httpc->h2, NGHTTP2_FLAG_NONE,
+ http->stream_id, NGHTTP2_STREAM_CLOSED))
+ (void)nghttp2_session_send(httpc->h2);
+
if(http->stream_id == httpc->pause_stream_id) {
infof(data, "stopped the pause stream!\n");
httpc->pause_stream_id = 0;