You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ds...@apache.org on 2026/04/01 11:19:11 UTC
(tomcat) branch 11.0.x updated (d243012c04 -> 9a2b839ef6)
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a change to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from d243012c04 Refactor. Simplify. escapeAndAppend() includes null handling
new 5d3ce35cdb Add testCustomCloseCode() in TestClose
new 9a2b839ef6 Section 5.2.2 of Jakarta WebSocket specification requires that all errors arising during the functioning of a WebSocket endpoint must be reported via the error handling method, onError(). A TCP reset causes an IOException when the server attempts to read from the connection, which qualifies as such an error.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/tomcat/websocket/server/TestClose.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/02: Section 5.2.2 of Jakarta WebSocket specification requires that all errors arising during the functioning of a WebSocket endpoint must be reported via the error handling method, onError(). A TCP reset causes an IOException when the server attempts to read from the connection, which qualifies as such an error.
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 9a2b839ef69eb380351af829a5dee569deed7719
Author: Dimitris Soumis <ji...@gmail.com>
AuthorDate: Wed Apr 1 13:32:37 2026 +0300
Section 5.2.2 of Jakarta WebSocket specification requires that all errors arising during the functioning of a WebSocket endpoint must be reported via the error handling method, onError(). A TCP reset causes an IOException when the server attempts to read from the connection, which qualifies as such an error.
---
test/org/apache/tomcat/websocket/server/TestClose.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/tomcat/websocket/server/TestClose.java b/test/org/apache/tomcat/websocket/server/TestClose.java
index fadb39e801..da516623cb 100644
--- a/test/org/apache/tomcat/websocket/server/TestClose.java
+++ b/test/org/apache/tomcat/websocket/server/TestClose.java
@@ -46,7 +46,7 @@ import org.apache.tomcat.websocket.WebSocketBaseTest;
*/
public class TestClose extends WebSocketBaseTest {
- private static Log log = LogFactory.getLog(TestClose.class);
+ private static final Log log = LogFactory.getLog(TestClose.class);
// These are static because it is simpler than trying to inject them into
// the endpoint
@@ -132,7 +132,9 @@ public class TestClose extends WebSocketBaseTest {
client.httpUpgrade(BaseEndpointConfig.PATH);
client.forceCloseSocket();
- // TODO: I'm not entirely sure when onError should be called
+ // A TCP reset causes an IOException when the server reads from
+ // the connection. Per WSC-5.2.2-2, errors arising during the
+ // functioning of the endpoint must be reported via onError.
awaitOnError(IOException.class);
awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/02: Add testCustomCloseCode() in TestClose
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 5d3ce35cdb14905b914907b22f2e0bcfa19b7985
Author: Dimitris Soumis <ji...@gmail.com>
AuthorDate: Wed Apr 1 13:10:01 2026 +0300
Add testCustomCloseCode() in TestClose
---
test/org/apache/tomcat/websocket/server/TestClose.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/test/org/apache/tomcat/websocket/server/TestClose.java b/test/org/apache/tomcat/websocket/server/TestClose.java
index 618a60221d..fadb39e801 100644
--- a/test/org/apache/tomcat/websocket/server/TestClose.java
+++ b/test/org/apache/tomcat/websocket/server/TestClose.java
@@ -186,6 +186,19 @@ public class TestClose extends WebSocketBaseTest {
awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
}
+ @Test
+ public void testCustomCloseCode() throws Exception {
+ startServer(TestEndpointConfig.class);
+
+ TesterWsClient client = new TesterWsClient("localhost", getPort());
+ client.httpUpgrade(BaseEndpointConfig.PATH);
+ client.sendCloseFrame(CloseCodes.getCloseCode(3500));
+ client.closeSocket();
+
+ awaitLatch(events.onCloseCalled, "onClose not called");
+ Assert.assertEquals(3500, events.closeReason.getCloseCode().getCode());
+ }
+
@Test
public void testTcpResetInOnMessage() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org