Skip to content

Commit

Permalink
UNDERTOW-830 Fix issue with HTTP upgrade requests
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Sep 14, 2016
1 parent 5cb536b commit fe20f4d
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -184,6 +184,7 @@ public Http2Channel(StreamConnection connectedStreamChannel, String protocol, By
public Http2Channel(StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, boolean prefaceRequired, ByteBuffer initialOtherSideSettings, OptionMap settings) {
super(connectedStreamChannel, bufferPool, Http2FramePriority.INSTANCE, data, settings);
streamIdCounter = clientSide ? (fromUpgrade ? 3 : 1) : 2;

pushEnabled = settings.get(UndertowOptions.HTTP2_SETTINGS_ENABLE_PUSH, true);
this.initialReceiveWindowSize = settings.get(UndertowOptions.HTTP2_SETTINGS_INITIAL_WINDOW_SIZE, DEFAULT_INITIAL_WINDOW_SIZE);

Expand All @@ -209,6 +210,11 @@ public Http2Channel(StreamConnection connectedStreamChannel, String protocol, By
prefaceCount = PREFACE_BYTES.length;
sendSettings();
initialSettingsSent = true;
if(fromUpgrade) {
StreamHolder streamHolder = new StreamHolder((Http2StreamSinkChannel) null);
streamHolder.sinkClosed = true;
currentStreams.put(1, streamHolder);
}
} else if(fromUpgrade) {
sendSettings();
initialSettingsSent = true;
Expand Down Expand Up @@ -921,7 +927,9 @@ public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream() {
}
lastGoodStreamId = 1;
Http2HeadersStreamSinkChannel stream = new Http2HeadersStreamSinkChannel(this, 1);
currentStreams.put(1, new StreamHolder(stream));
StreamHolder streamHolder = new StreamHolder(stream);
streamHolder.sourceClosed = true;
currentStreams.put(1, streamHolder);
return stream;

}
Expand Down

0 comments on commit fe20f4d

Please sign in to comment.