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 2015/03/07 16:18:10 UTC

svn commit: r1664864 - /tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java

Author: markt
Date: Sat Mar  7 15:18:10 2015
New Revision: 1664864

URL: http://svn.apache.org/r1664864
Log:
Header names are case-insensitive.
If the request is a PUT, include the size of the request body in the response.

Modified:
    tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java

Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1664864&r1=1664863&r2=1664864&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Sat Mar  7 15:18:10 2015
@@ -60,6 +60,7 @@ import org.apache.catalina.valves.Access
 import org.apache.catalina.webresources.StandardRoot;
 import org.apache.coyote.http11.Http11NioProtocol;
 import org.apache.tomcat.util.buf.ByteChunk;
+import org.apache.tomcat.websocket.CaseInsensitiveKeyMap;
 
 /**
  * Base test case that provides a Tomcat instance for each test - mainly so we
@@ -242,7 +243,7 @@ public abstract class TomcatBaseTest ext
         private final Map<String, String> requestInfo = new HashMap<>();
         private final Map<String, String> contextInitParameters = new HashMap<>();
         private final Map<String, String> contextAttributes = new HashMap<>();
-        private final Map<String, String> headers = new HashMap<>();
+        private final Map<String, String> headers = new CaseInsensitiveKeyMap<>();
         private final Map<String, String> attributes = new HashMap<>();
         private final Map<String, String> params = new HashMap<>();
         private final Map<String, String> sessionAttributes = new HashMap<>();
@@ -555,6 +556,20 @@ public abstract class TomcatBaseTest ext
                                 (attribute != null ? attribute : "(null)"));
                 }
             }
+
+            int bodySize = 0;
+            if ("PUT".equalsIgnoreCase(request.getMethod())) {
+                InputStream is = request.getInputStream();
+                int read = 0;
+                byte[] buffer = new byte[8192];
+                while (read != -1) {
+                    read = is.read(buffer);
+                    if (read > -1) {
+                        bodySize += read;
+                    }
+                }
+            }
+            out.println("REQUEST-BODY-SIZE: " + bodySize);
         }
     }
 



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