You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/08/27 13:28:28 UTC
svn commit: r1517791 -
/tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
Author: markt
Date: Tue Aug 27 11:28:27 2013
New Revision: 1517791
URL: http://svn.apache.org/r1517791
Log:
Add a unit test for chunked encoding
Modified:
tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
Modified: tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java?rev=1517791&r1=1517790&r2=1517791&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java Tue Aug 27 11:28:27 2013
@@ -60,7 +60,7 @@ public class TestAbstractHttp11Processor
"Content-Length: 9" + SimpleHttpClient.CRLF +
"Content-Type: application/x-www-form-urlencoded" +
SimpleHttpClient.CRLF +
- SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
"test=data";
Client client = new Client(tomcat.getConnector().getLocalPort());
@@ -71,6 +71,7 @@ public class TestAbstractHttp11Processor
assertTrue(client.isResponse501());
}
+
@Test
public void testWithTEBuffered() throws Exception {
Tomcat tomcat = getTomcatInstance();
@@ -88,7 +89,7 @@ public class TestAbstractHttp11Processor
"Content-Length: 9" + SimpleHttpClient.CRLF +
"Content-Type: application/x-www-form-urlencoded" +
SimpleHttpClient.CRLF +
- SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
"test=data";
Client client = new Client(tomcat.getConnector().getLocalPort());
@@ -101,6 +102,39 @@ public class TestAbstractHttp11Processor
@Test
+ public void testWithTEChunked() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+
+ // Use the normal Tomcat ROOT context
+ File root = new File("test/webapp");
+ tomcat.addWebapp("", root.getAbsolutePath());
+
+ tomcat.start();
+
+ String request =
+ "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
+ "Host: any" + SimpleHttpClient.CRLF +
+ "Transfer-encoding: chunked" + SimpleHttpClient.CRLF +
+ "Content-Type: application/x-www-form-urlencoded" +
+ SimpleHttpClient.CRLF +
+ "Connection: close" + SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
+ "9" + SimpleHttpClient.CRLF +
+ "test=data" + SimpleHttpClient.CRLF +
+ "0" + SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF;
+
+ Client client = new Client(tomcat.getConnector().getLocalPort());
+ client.setRequest(new String[] {request});
+
+ client.connect();
+ client.processRequest();
+ assertTrue(client.isResponse200());
+ assertTrue(client.getResponseBody().contains("test - data"));
+ }
+
+
+ @Test
public void testWithTEIdentity() throws Exception {
Tomcat tomcat = getTomcatInstance();
@@ -118,7 +152,7 @@ public class TestAbstractHttp11Processor
"Content-Type: application/x-www-form-urlencoded" +
SimpleHttpClient.CRLF +
"Connection: close" + SimpleHttpClient.CRLF +
- SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
"test=data";
Client client = new Client(tomcat.getConnector().getLocalPort());
@@ -148,7 +182,7 @@ public class TestAbstractHttp11Processor
"Content-Length: 9" + SimpleHttpClient.CRLF +
"Content-Type: application/x-www-form-urlencoded" +
SimpleHttpClient.CRLF +
- SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
"test=data";
Client client = new Client(tomcat.getConnector().getLocalPort());
@@ -177,7 +211,7 @@ public class TestAbstractHttp11Processor
"Content-Length: 9" + SimpleHttpClient.CRLF +
"Content-Type: application/x-www-form-urlencoded" +
SimpleHttpClient.CRLF +
- SimpleHttpClient.CRLF +
+ SimpleHttpClient.CRLF +
"test=data";
Client client = new Client(tomcat.getConnector().getLocalPort());
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org