This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new b767478267 Improve handling of unexpected errors during HTTP/2
processing
b767478267 is described below
commit b7674782679e1514a0d154166b1d04d38aaac4a9
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Mar 19 03:47:11 2025 +0000
Improve handling of unexpected errors during HTTP/2 processing
---
java/org/apache/coyote/http2/Http2UpgradeHandler.java | 8 ++++++++
java/org/apache/coyote/http2/LocalStrings.properties | 1 +
webapps/docs/changelog.xml | 3 +++
3 files changed, 12 insertions(+)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 54e119b3f3..38a81309a6 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -47,6 +47,7 @@ import org.apache.coyote.http2.Http2Parser.Input;
import org.apache.coyote.http2.Http2Parser.Output;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.ExceptionUtils;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.http.parser.Priority;
import org.apache.tomcat.util.log.UserDataHelper;
@@ -439,6 +440,13 @@ class Http2UpgradeHandler extends AbstractStream
implements InternalHttpUpgradeH
log.debug(sm.getString("upgradeHandler.ioerror",
connectionId), ioe);
}
close();
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("upgradeHandler.throwable",
connectionId), t);
+ }
+ // Unexpected errors close the connection.
+ close();
}
if (log.isTraceEnabled()) {
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties
b/java/org/apache/coyote/http2/LocalStrings.properties
index 114f546017..61cb8497bf 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -160,6 +160,7 @@ upgradeHandler.stream.error=Connection [{0}], Stream [{1}]
Closed due to error
upgradeHandler.stream.even=A new remote stream ID of [{0}] was requested but
all remote streams must use odd identifiers
upgradeHandler.stream.notWritable=Connection [{0}], Stream [{1}], This stream
is in state [{2}] and is not writable
upgradeHandler.stream.old=A new remote stream ID of [{0}] was requested but
the most recent stream was [{1}]
+upgradeHandler.throwable=Connection [{0}]
upgradeHandler.tooManyRemoteStreams=The client attempted to use more than
[{0}] active streams
upgradeHandler.tooMuchOverhead=Connection [{0}], Too much overhead so the
connection will be closed
upgradeHandler.unexpectedAck=Connection [{0}], Stream [{1}], A settings
acknowledgement was received when not expected
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3126404639..6e8aa763f8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -134,6 +134,9 @@
<bug>69614</bug>: HTTP/2 priority frames with an invalid priority field
value should be ignored. (markt)
</fix>
+ <fix>
+ Improve handling of unexpected errors during HTTP/2 processing. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]