From 74627483d7bdcae3130b2ba173e08ec5f2658377 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Mon, 4 May 2015 15:15:44 -0700 Subject: [PATCH] [#3724] HTTP/2 Headers END_STREAM results in RST_STREAM Motivation: If headers are sent on a stream that does not yet exist and the END_STREAM flag is set we will send a RST_STREAM frame. We should send the HEADERS frame and no RST_STREAM. Modifications: DefaultHttp2RemoteFlowController should allow frames to be sent if stream is created in the 'half closed (local)' state. Result: We can send HEADERS frame with the END_STREAM flag sent without sending a RST_STREAM frame. --- .../codec/http2/DefaultHttp2Connection.java | 6 ---- .../http2/DefaultHttp2ConnectionDecoder.java | 2 +- .../DefaultHttp2RemoteFlowController.java | 3 +- .../handler/codec/http2/Http2Connection.java | 6 ++-- .../codec/http2/DataCompressionHttp2Test.java | 7 ++++ .../http2/Http2ConnectionRoundtripTest.java | 34 +++++++++++++++++-- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java index 5c6bb7a406..71a574f6cc 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java @@ -434,9 +434,6 @@ public class DefaultHttp2Connection implements Http2Connection { public Http2Stream open(boolean halfClosed) throws Http2Exception { state = activeState(id, state, isLocal(), halfClosed); activate(); - if (halfClosed) { - notifyHalfClosed(this); - } return this; } @@ -900,9 +897,6 @@ public class DefaultHttp2Connection implements Http2Connection { public DefaultStream createStream(int streamId, boolean halfClosed) throws Http2Exception { DefaultStream stream = createStream(streamId, activeState(streamId, IDLE, isLocal(), halfClosed)); stream.activate(); - if (halfClosed) { - notifyHalfClosed(stream); - } return stream; } diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoder.java index 656229fdf7..d477ea889e 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoder.java @@ -529,7 +529,7 @@ public class DefaultHttp2ConnectionDecoder implements Http2ConnectionDecoder { /** * Helper method for determining whether or not to ignore inbound frames. A stream is considered to be created - * after a go away is sent if the following conditions hold: + * after a {@code GOAWAY} is sent if the following conditions hold: *

*