This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new b7d9b2f Use a constant for the data size b7d9b2f is described below commit b7d9b2fb4e73a2fb79ee2879e2191df6c6745e7f Author: remm <r...@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 ae23179..15dcea8 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 { 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org