This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 4e983e8915 Stabilize TestSwallowAbortedUploads.testChunkedPUTLimit
4e983e8915 is described below
commit 4e983e8915d3546e360ad48b428dfebd9623c67b
Author: Dimitrios Soumis <[email protected]>
AuthorDate: Fri Sep 19 21:06:53 2025 +0300
Stabilize TestSwallowAbortedUploads.testChunkedPUTLimit
The test assumed write would fail once the server stopped swallowing, but
the client could finish buffering data before the close was observed, so no
SocketException was thrown during the write and the assertion failed.
---
.../apache/catalina/core/TestSwallowAbortedUploads.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
index c3ac752598..a00647d2cd 100644
--- a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
+++ b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
@@ -23,6 +23,7 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.net.Socket;
+import java.net.SocketException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
@@ -423,7 +424,7 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
tomcat.start();
- Exception writeEx = null;
+ SocketException writeEx = null;
Exception readEx = null;
String responseLine = null;
@@ -442,7 +443,8 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
writer.write("10\r\n");
writer.write("0123456789ABCDEF\r\n");
}
- } catch (Exception e) {
+ writer.flush();
+ } catch (SocketException e) {
writeEx = e;
}
@@ -454,6 +456,17 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
} catch (IOException ioe) {
readEx = ioe;
}
+
+ // If no exception was thrown during the big write,
+ // write once more because the close may have not been observed
+ if (limit && writeEx == null) {
+ try {
+ writer.write("1\r\n");
+ writer.flush();
+ } catch (SocketException e) {
+ writeEx = e;
+ }
+ }
}
if (limit) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]