This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new e1cde6f020 Work around available tricks
e1cde6f020 is described below
commit e1cde6f02080d4d9346d3e401f1e3c5c739eb14e
Author: remm <[email protected]>
AuthorDate: Wed Jan 29 10:56:09 2025 +0100
Work around available tricks
available() needs to be called even though the first read returned 0
bytes.
Going through everything it seems "normal" and there is no real
workaround.
---
.../http11/filters/TestChunkedInputFilter.java | 33 +++++++++++-----------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
index 225a84fee7..86071ad20d 100644
--- a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
+++ b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
@@ -839,22 +839,23 @@ public class TestChunkedInputFilter extends
TomcatBaseTest {
byte[] buf = new byte[1024];
do {
int n = is.read(buf);
- if (n <= 0) {
+ if (n < 0) {
break;
+ } else if (n > 0) {
+ String line = new String(buf, 0, n,
StandardCharsets.UTF_8);
+ Assert.assertTrue(line.length() > 0);
+ long thisRead = System.nanoTime();
+ if (lineCount > 0) {
+ /*
+ * After the first line, look for a pause of
at least 800ms between reads.
+ */
+ if ((thisRead - lastRead) >
TimeUnit.MILLISECONDS.toNanos(800)) {
+ pauseCount++;
+ }
+ }
+ lastRead = thisRead;
+ lineCount++;
}
- String line = new String(buf, 0, n,
StandardCharsets.UTF_8);
- Assert.assertTrue(line.length() > 0);
- long thisRead = System.nanoTime();
- if (lineCount > 0) {
- /*
- * After the first line, look for a pause of at
least 800ms between reads.
- */
- if ((thisRead - lastRead) >
TimeUnit.MILLISECONDS.toNanos(800)) {
- pauseCount++;
- }
- }
- lastRead = thisRead;
- lineCount++;
} while (is.isReady());
}
@@ -965,7 +966,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
SimpleHttpClient.CRLF +
"7" + SimpleHttpClient.CRLF +
"DATA01\n", SimpleHttpClient.CRLF +
- "7"/*, */ + SimpleHttpClient.CRLF +
+ "7", SimpleHttpClient.CRLF +
"DATA02\n" + SimpleHttpClient.CRLF,
"7" + SimpleHttpClient.CRLF +
// Split the CRLF between writes
@@ -973,7 +974,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
SimpleHttpClient.LF +
"7" + SimpleHttpClient.CRLF +
"DATA04\n", SimpleHttpClient.CRLF +
- "13" + SimpleHttpClient.CRLF/*, */ +
+ "13" + SimpleHttpClient.CRLF,
"DATA05DATA05DATA05\n" + SimpleHttpClient.CRLF +
"0" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]