tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r781546 - in /tomcat/container/tc5.5.x: catalina/src/conf/web.xml catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java webapps/docs/changelog.xml webapps/docs/default-servlet.xml
Date Wed, 03 Jun 2009 21:02:01 GMT
Author: markt
Date: Wed Jun  3 21:02:01 2009
New Revision: 781546

URL: http://svn.apache.org/viewvc?rev=781546&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45996
Set the Accept-Ranges header on content served from the DefaultServlet. This can be disabled
via configuration if required.

Modified:
    tomcat/container/tc5.5.x/catalina/src/conf/web.xml
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/container/tc5.5.x/webapps/docs/default-servlet.xml

Modified: tomcat/container/tc5.5.x/catalina/src/conf/web.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/conf/web.xml?rev=781546&r1=781545&r2=781546&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/conf/web.xml (original)
+++ tomcat/container/tc5.5.x/catalina/src/conf/web.xml Wed Jun  3 21:02:01 2009
@@ -70,6 +70,9 @@
   <!--                       which sendfile will be used. Use a negative    -->
   <!--                       value to always disable sendfile.  [48]        -->
   <!--                                                                      -->
+  <!--   useAcceptRanges     Should the Accept-Ranges header be included    -->
+  <!--                       in responses where appropriate? [true]         -->
+  <!--                                                                      -->
   <!--  For directory listing customization. Checks localXsltFile, then     -->
   <!--  globalXsltFile, then defaults to original behavior.                 -->
   <!--                                                                      -->

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java?rev=781546&r1=781545&r2=781546&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
Wed Jun  3 21:02:01 2009
@@ -153,7 +153,11 @@
      */
     protected int sendfileSize = 48 * 1024;
     
-    
+    /**
+     * Should the Accept-Ranges: bytes header be send with static resources?
+     */
+    protected boolean useAcceptRanges = true;
+
     /**
      * Full range marker.
      */
@@ -285,6 +289,9 @@
         localXsltFile = getServletConfig().getInitParameter("localXsltFile");
         readmeFile = getServletConfig().getInitParameter("readmeFile");
 
+        if (getServletConfig().getInitParameter("useAcceptRanges") != null)
+            useAcceptRanges = Boolean.parseBoolean(getServletConfig().getInitParameter("useAcceptRanges"));
+
         // Sanity check on the specified buffer sizes
         if (input < 256)
             input = 256;
@@ -825,9 +832,12 @@
             contentType = "text/html;charset=UTF-8";
 
         } else {
+            if (useAcceptRanges) {
+                // Accept ranges header
+                response.setHeader("Accept-Ranges", "bytes");
+            }
 
             // Parse range specifier
-
             ranges = parseRange(request, response, cacheEntry.attributes);
 
             // ETag header

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=781546&r1=781545&r2=781546&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Jun  3 21:02:01 2009
@@ -80,6 +80,10 @@
         TLD files. (markt) 
       </fix>
       <fix>
+        <bug>45996</bug>: Add Accept-Ranges header to responses from the
+        DefaultServlet with an option to disable it. (markt)
+      </fix>
+      <fix>
         <bug>46597</bug>: Port all cookie handling changes from Tomcat 6.0.x.
         (markt)
       </fix>

Modified: tomcat/container/tc5.5.x/webapps/docs/default-servlet.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/default-servlet.xml?rev=781546&r1=781545&r2=781546&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/default-servlet.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/default-servlet.xml Wed Jun  3 21:02:01 2009
@@ -179,6 +179,13 @@
         to always disable sendfile. [48]
     </td>
   </tr>
+  <tr>
+    <th valign='top'>useAcceptRanges</th>
+    <td valign='top'>
+        If true, the Accept-Ranges header will be set when appropriate for the
+        response. [true]
+    </td>
+  </tr>
 
 </table>
 </section>



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


Mime
View raw message