tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1354866 - in /tomcat/tc7.0.x/trunk: ./ java/javax/servlet/http/HttpServlet.java test/javax/servlet/http/ test/org/apache/catalina/startup/TomcatBaseTest.java webapps/docs/changelog.xml
Date Thu, 28 Jun 2012 08:57:33 GMT
Author: markt
Date: Thu Jun 28 08:57:31 2012
New Revision: 1354866

URL: http://svn.apache.org/viewvc?rev=1354866&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53454
Return correct content-length header for HEAD requests when value is > 2GB

Added:
    tomcat/tc7.0.x/trunk/test/javax/servlet/http/
      - copied from r1354847, tomcat/trunk/test/javax/servlet/http/
Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1354847,1354856

Modified: tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java?rev=1354866&r1=1354865&r2=1354866&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java (original)
+++ tomcat/tc7.0.x/trunk/java/javax/servlet/http/HttpServlet.java Thu Jun 28 08:57:31 2012
@@ -758,6 +758,36 @@ class NoBodyResponse extends HttpServlet
     }
 
     @Override
+    public void setHeader(String name, String value) {
+        super.setHeader(name, value);
+        checkHeader(name);
+    }
+
+    @Override
+    public void addHeader(String name, String value) {
+        super.addHeader(name, value);
+        checkHeader(name);
+    }
+
+    @Override
+    public void setIntHeader(String name, int value) {
+        super.setIntHeader(name, value);
+        checkHeader(name);
+    }
+
+    @Override
+    public void addIntHeader(String name, int value) {
+        super.addIntHeader(name, value);
+        checkHeader(name);
+    }
+
+    private void checkHeader(String name) {
+        if ("content-length".equalsIgnoreCase(name)) {
+            didSetContentLength = true;
+        }
+    }
+
+    @Override
     public ServletOutputStream getOutputStream() throws IOException {
         return noBody;
     }

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1354866&r1=1354865&r2=1354866&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Thu Jun 28 08:57:31
2012
@@ -200,6 +200,11 @@ public abstract class TomcatBaseTest ext
         return getUrl(path, out, null, resHead);
     }
 
+    public static int headUrl(String path, ByteChunk out,
+            Map<String, List<String>> resHead) throws IOException {
+        return methodUrl(path, out, 1000000, null, resHead, "HEAD");
+    }
+
     public static int getUrl(String path, ByteChunk out,
             Map<String, List<String>> reqHead,
             Map<String, List<String>> resHead) throws IOException {
@@ -209,12 +214,20 @@ public abstract class TomcatBaseTest ext
     public static int getUrl(String path, ByteChunk out, int readTimeout,
             Map<String, List<String>> reqHead,
             Map<String, List<String>> resHead) throws IOException {
+        return methodUrl(path, out, readTimeout, reqHead, resHead, "GET");
+    }
+
+    public static int methodUrl(String path, ByteChunk out, int readTimeout,
+            Map<String, List<String>> reqHead,
+            Map<String, List<String>> resHead,
+            String method) throws IOException {
 
         URL url = new URL(path);
         HttpURLConnection connection =
             (HttpURLConnection) url.openConnection();
         connection.setUseCaches(false);
         connection.setReadTimeout(readTimeout);
+        connection.setRequestMethod(method);
         if (reqHead != null) {
             for (Map.Entry<String, List<String>> entry : reqHead.entrySet())
{
                 StringBuilder valueList = new StringBuilder();

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1354866&r1=1354865&r2=1354866&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Jun 28 08:57:31 2012
@@ -180,6 +180,10 @@
         implementations used with JMX to <code>jmxaccessor.tasks</code> file.
         (kkolinko)
       </scode>
+      <fix>
+        <bug>53454</bug>: Return correct content-length header for HEAD requests
+        when content length is greater than 2GB. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>



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


Mime
View raw message