From 1da8e51941b9a2c8f4bc3271acc30393c29e9cc0 Mon Sep 17 00:00:00 2001 From: Andrew Seigner Date: Mon, 15 Oct 2018 14:28:12 -0700 Subject: [PATCH] transport: http2Client sends RST_STREAM (#2354) If http2Client receives END_STREAM before it sends END_STREAM, it will send RST_STREAM to fully closed the stream. --- internal/transport/http2_client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/transport/http2_client.go b/internal/transport/http2_client.go index 2bd70597e..0c3c47e2a 100644 --- a/internal/transport/http2_client.go +++ b/internal/transport/http2_client.go @@ -1173,7 +1173,9 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { if !endStream { return } - t.closeStream(s, io.EOF, false, http2.ErrCodeNo, state.status(), state.mdata, true) + // if client received END_STREAM from server while stream was still active, send RST_STREAM + rst := s.getState() == streamActive + t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, state.status(), state.mdata, true) } // reader runs as a separate goroutine in charge of reading data from network