This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 6669bb9881 Remove the useAcceptRanges init parameter
6669bb9881 is described below
commit 6669bb9881d1a4ecfb8798efeee29a7603afdb41
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Dec 4 10:28:11 2024 +0000
Remove the useAcceptRanges init parameter
It has been effectively hard-coded to true
---
conf/web.xml | 6 ------
java/org/apache/catalina/servlets/DefaultServlet.java | 19 ++-----------------
webapps/docs/changelog.xml | 5 +++++
webapps/docs/default-servlet.xml | 7 -------
4 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/conf/web.xml b/conf/web.xml
index 05ad4e64b2..698cd97db7 100644
--- a/conf/web.xml
+++ b/conf/web.xml
@@ -82,12 +82,6 @@
<!-- 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] -->
- <!-- Deprecated. This option will be removed -->
- <!-- without replacement in Tomcat 12 onwards where -->
- <!-- it will effectively be hard coded to true. -->
- <!-- -->
<!-- For directory listing customization. Checks localXsltFile, then -->
<!-- globalXsltFile, then defaults to original behavior. -->
<!-- -->
diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 5eaa7297dd..e5dff13949 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -235,15 +235,6 @@ public class DefaultServlet extends HttpServlet {
*/
protected int sendfileSize = 48 * 1024;
- /**
- * Should the Accept-Ranges: bytes header be send with static resources?
- *
- * @deprecated This option will be removed without replacement in Tomcat
12 onwards where it will effectively be
- * hard coded to {@code true}.
- */
- @Deprecated
- protected boolean useAcceptRanges = true;
-
/**
* Flag to determine if server information is presented.
*/
@@ -357,10 +348,6 @@ public class DefaultServlet extends HttpServlet {
localXsltFile = getServletConfig().getInitParameter("localXsltFile");
readmeFile = getServletConfig().getInitParameter("readmeFile");
- if (getServletConfig().getInitParameter("useAcceptRanges") != null) {
- useAcceptRanges =
Boolean.parseBoolean(getServletConfig().getInitParameter("useAcceptRanges"));
- }
-
// Prevent the use of buffer sizes that are too small
if (input < 256) {
input = 256;
@@ -900,10 +887,8 @@ public class DefaultServlet extends HttpServlet {
contentType = "text/html;charset=UTF-8";
} else {
if (!isError) {
- if (useAcceptRanges) {
- // Accept ranges header
- response.setHeader("Accept-Ranges", "bytes");
- }
+ // Accept ranges header
+ response.setHeader("Accept-Ranges", "bytes");
// Parse range specifier
ranges = parseRange(request, response, resource);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2813a7a04a..8fc94db851 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -128,6 +128,11 @@
<code>AccessLog</code> and was not implemented in a scalable way.
(remm)
</update>
+ <fix>
+ Remove the <code>useAcceptRanges</code> initialisation parameter for
+ the default servlet. It is now effectively hard coded to
+ <code>true</code>. (markt)
+ </fix>
<!-- Entries for backport and removal before 12.0.0-M1 below this line
-->
<fix>
Add special handling for the <code>protocols</code> attribute of
diff --git a/webapps/docs/default-servlet.xml b/webapps/docs/default-servlet.xml
index 8b906081c9..3e98eaa7da 100644
--- a/webapps/docs/default-servlet.xml
+++ b/webapps/docs/default-servlet.xml
@@ -191,13 +191,6 @@ Tomcat.</p>
file size in KiB for which sendfile will be used. Use a negative value
to always disable sendfile. [48]
</property>
- <property name="useAcceptRanges">
- If true, the Accept-Ranges header will be set when appropriate for the
- response. [true]
- <br/>
- Deprecated. This option will be removed without replacement in Tomcat
- 12 onwards where it will effectively be hard coded to
<code>true</code>.
- </property>
<property name="showServerInfo">
Should server information be presented in the response sent to clients
when directory listing is enabled. [true]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]