You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/04/06 14:53:06 UTC
[tomcat] branch 8.5.x updated: Use a constant for the data size
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 6d2d07d Use a constant for the data size
6d2d07d is described below
commit 6d2d07d74c9471818d4cfc327df176a55a197e29
Author: remm <re...@apache.org>
AuthorDate: Mon Apr 6 16:50:36 2020 +0200
Use a constant for the data size
---
test/org/apache/tomcat/util/net/TestSsl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index b072106..4acbaec 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -78,6 +78,8 @@ public class TestSsl extends TomcatBaseTest {
TesterSupport.getLastClientAuthRequestedIssuerCount() == 0);
}
+ private static final int POST_DATA_SIZE = 16 * 1024 * 1024;
+
@Test
public void testPost() throws Exception {
final SocketFactory socketFactory = TesterSupport.configureClientSsl();
@@ -102,7 +104,7 @@ public class TestSsl extends TomcatBaseTest {
OutputStream os = socket.getOutputStream();
- byte[] bytes = new byte[16 * 1024 * 1024]; // 16MB
+ byte[] bytes = new byte[POST_DATA_SIZE]; // 16MB
Arrays.fill(bytes, (byte) 1);
os.write("POST /post HTTP/1.1\r\n".getBytes());
@@ -283,7 +285,7 @@ public class TestSsl extends TomcatBaseTest {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(POST_DATA_SIZE);
byte[] in = new byte[1500];
InputStream input = req.getInputStream();
while (true) {
@@ -295,6 +297,7 @@ public class TestSsl extends TomcatBaseTest {
}
}
byte[] out = baos.toByteArray();
+ // Set the content-length to avoid having to parse chunked
resp.setContentLength(out.length);
resp.getOutputStream().write(out);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org