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/03/04 21:34:25 UTC

[tomcat] branch 9.0.x updated (6e0ae64 -> b896830)

This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from 6e0ae64  Provide an accessor for inProgressAsyncCount. Helps embedded scenarios.
     new 489d07c  Add test for BZ64195
     new b896830  Jakarta to javax

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:
 test/org/apache/tomcat/util/net/TestSsl.java | 78 ++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/02: Jakarta to javax

Posted by re...@apache.org.
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

commit b896830c9035b044d2b0b1274b4737b07a40da31
Author: remm <re...@apache.org>
AuthorDate: Wed Mar 4 22:33:46 2020 +0100

    Jakarta to javax
---
 test/org/apache/tomcat/util/net/TestSsl.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index 03fe357..1a691d7 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -32,10 +32,10 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServlet;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
 import org.junit.Assume;


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Add test for BZ64195

Posted by re...@apache.org.
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

commit 489d07c6150746f8e30cc680d0a8128fb964905e
Author: remm <re...@apache.org>
AuthorDate: Wed Mar 4 19:07:39 2020 +0100

    Add test for BZ64195
    
    It works for me, will see on CI.
---
 test/org/apache/tomcat/util/net/TestSsl.java | 78 ++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index b777f2c..03fe357 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -16,19 +16,27 @@
  */
 package org.apache.tomcat.util.net;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Reader;
+import java.util.Arrays;
 
+import javax.net.SocketFactory;
 import javax.net.ssl.HandshakeCompletedEvent;
 import javax.net.ssl.HandshakeCompletedListener;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
@@ -70,6 +78,52 @@ public class TestSsl extends TomcatBaseTest {
     }
 
     @Test
+    public void testPost() throws Exception {
+        SocketFactory socketFactory = TesterSupport.configureClientSsl();
+
+        Tomcat tomcat = getTomcatInstance();
+        TesterSupport.initSsl(tomcat);
+
+        Context ctxt = tomcat.addContext("", null);
+        Tomcat.addServlet(ctxt, "post", new SimplePostServlet());
+        ctxt.addServletMappingDecoded("/post", "post");
+        tomcat.start();
+
+        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost",
+                getPort());
+
+        OutputStream os = socket.getOutputStream();
+
+        byte[] bytes = new byte[1024 * 1024]; // 1MB
+        Arrays.fill(bytes, (byte) 1);
+
+        os.write("POST /post HTTP/1.1\r\n".getBytes());
+        os.write("Host: localhost\r\n".getBytes());
+        os.write("Content-Length: 1048576\r\n\r\n".getBytes());
+        os.write(bytes);
+        os.flush();
+
+        InputStream is = socket.getInputStream();
+
+        // Skip to the end of the headers
+        byte[] endOfHeaders = "\r\n\r\n".getBytes();
+        int found = 0;
+        while (found != endOfHeaders.length) {
+            if (is.read() == endOfHeaders[found]) {
+                found++;
+            } else {
+                found = 0;
+            }
+        }
+
+        for (byte c : bytes) {
+            int read = is.read();
+            Assert.assertEquals(c, read);
+        }
+
+    }
+
+    @Test
     public void testKeyPass() throws Exception {
         TesterSupport.configureClientSsl();
 
@@ -195,4 +249,28 @@ public class TestSsl extends TomcatBaseTest {
             return complete;
         }
     }
+
+    public class SimplePostServlet extends HttpServlet {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            byte[] in = new byte[1500];
+            InputStream input = req.getInputStream();
+            while (true) {
+                int n = input.read(in);
+                if (n > 0) {
+                    baos.write(in, 0, n);
+                } else {
+                    break;
+                }
+            }
+            byte[] out = baos.toByteArray();
+            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