This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 882a7b4 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63223
882a7b4 is described below
commit 882a7b48186c9f07108f4e44937f02e408e173cb
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Mar 7 10:50:05 2019 +0000
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63223
Include pushed streams in the count of currently open streams
Reject (ignore) a pushed stream if max streams has been reached
Correctly track the state of a pushed stream
---
java/org/apache/coyote/http2/Http2UpgradeHandler.java | 8 ++++++++
java/org/apache/coyote/http2/Stream.java | 7 ++++++-
java/org/apache/coyote/http2/StreamStateMachine.java | 2 +-
webapps/docs/changelog.xml | 4 ++++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 8e45d4f..86f0e93 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -562,6 +562,7 @@ public class Http2UpgradeHandler extends AbstractStream
implements InternalHttpU
synchronized (socketWrapper) {
doWriteHeaders(stream, pushedStreamId, mimeHeaders, endOfStream,
payloadSize);
}
+ stream.sentHeaders();
if (endOfStream) {
stream.sentEndOfStream();
}
@@ -1179,6 +1180,13 @@ public class Http2UpgradeHandler extends AbstractStream
implements InternalHttpU
void push(Request request, Stream associatedStream) throws IOException {
+ if (localSettings.getMaxConcurrentStreams() <
activeRemoteStreamCount.incrementAndGet()) {
+ // If there are too many open streams, simply ignore the push
+ // request.
+ activeRemoteStreamCount.decrementAndGet();
+ return;
+ }
+
Stream pushStream;
// Synchronized since PUSH_PROMISE frames have to be sent in order.
Once
diff --git a/java/org/apache/coyote/http2/Stream.java
b/java/org/apache/coyote/http2/Stream.java
index 2c9021e..2facca3 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -586,7 +586,12 @@ public class Stream extends AbstractStream implements
HeaderEmitter {
}
- void sentEndOfStream() {
+ final void sentHeaders() {
+ state.sentStartOfHeaders();
+ }
+
+
+ final void sentEndOfStream() {
streamOutputBuffer.endOfStreamSent = true;
state.sentEndOfStream();
}
diff --git a/java/org/apache/coyote/http2/StreamStateMachine.java
b/java/org/apache/coyote/http2/StreamStateMachine.java
index 7b2d7be..e076395 100644
--- a/java/org/apache/coyote/http2/StreamStateMachine.java
+++ b/java/org/apache/coyote/http2/StreamStateMachine.java
@@ -181,7 +181,7 @@ public class StreamStateMachine {
Http2Error.PROTOCOL_ERROR, FrameType.PRIORITY,
FrameType.RST,
FrameType.WINDOW_UPDATE),
- RESERVED_REMOTE (false, false, true, true,
+ RESERVED_REMOTE (false, true, true, true,
Http2Error.PROTOCOL_ERROR, FrameType.HEADERS,
FrameType.PRIORITY,
FrameType.RST),
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 64b2d07..29f5fc6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -164,6 +164,10 @@
Correct an error in the request validation that meant that HTTP/2 push
requests always resulted in a 400 response. (markt)
</fix>
+ <fix>
+ <bug>63223</bug>: Correctly account for push requests when tracking
+ currently active HTTP/2 streams. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]