From d11f610f3789317d3ca79e79f6a96457755bcdd9 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Thu, 12 Mar 2015 22:57:22 +0900
Subject: [PATCH] Fix client sending invalid GOAWAY last-stream-id

Previously client sends its own initiated stream ID in last-stream-id
field of GOAWAY, which misses the point in HTTP/2 specification.
Unless server push is utilized heavily, client should not assign its
transport's last_incoming_stream_id, since it is a response from
server to client's initiated stream ID.  This commit fixes it.

See GH-1024
---
 src/core/transport/chttp2_transport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index 0d01a37112..5cc8375d65 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -1655,7 +1655,9 @@ static int process_read(transport *t, gpr_slice slice) {
       if (!init_frame_parser(t)) {
         return 0;
       }
-      t->last_incoming_stream_id = t->incoming_stream_id;
+      if (!t->is_client) {
+        t->last_incoming_stream_id = t->incoming_stream_id;
+      }
       if (t->incoming_frame_size == 0) {
         if (!parse_frame_slice(t, gpr_empty_slice(), 1)) {
           return 0;
-- 
GitLab