This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new ded0285b96 Improve handling of unexpected errors during HTTP/2
processing
ded0285b96 is described below
commit ded0285b96b4d3f5560dfc8856ad5ec4a9b50ba9
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 823addd6f3..81dd7cdd82 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -48,6 +48,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;
@@ -441,6 +442,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 780b6b04c9..b6e20ce003 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -166,6 +166,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 d621936e78..e66dd5b260 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -140,6 +140,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>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]