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 2021/06/03 17:57:53 UTC
[tomcat] branch 9.0.x updated: Fix long content-length handling for
doHead()
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 92b8be7 Fix long content-length handling for doHead()
92b8be7 is described below
commit 92b8be7031ff23a47d4b22e1a6b8bbe7c962fb9d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 3 18:57:02 2021 +0100
Fix long content-length handling for doHead()
---
java/javax/servlet/http/HttpServlet.java | 6 +++---
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/java/javax/servlet/http/HttpServlet.java b/java/javax/servlet/http/HttpServlet.java
index 16c346d..3b5b6ad 100644
--- a/java/javax/servlet/http/HttpServlet.java
+++ b/java/javax/servlet/http/HttpServlet.java
@@ -779,7 +779,7 @@ public abstract class HttpServlet extends GenericServlet {
if (writer != null) {
writer.flush();
}
- super.setContentLength(noBody.getContentLength());
+ super.setContentLengthLong(noBody.getContentLength());
}
}
@@ -855,13 +855,13 @@ public abstract class HttpServlet extends GenericServlet {
private final HttpServletResponse response;
private boolean flushed = false;
- private int contentLength = 0;
+ private long contentLength = 0;
private NoBodyOutputStream(HttpServletResponse response) {
this.response = response;
}
- private int getContentLength() {
+ private long getContentLength() {
return contentLength;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b2074d0..9c525d6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,12 @@
Refactor principal handling in <code>UserDatabaseRealm</code> using
an inner class that extends <code>GenericPrincipal</code>. (remm)
</update>
+ <fix>
+ Enable the default <code>doHead())</code> implementation in
+ <code>HttpServlet</code> to correctly handle responses where the content
+ length needs to be represented as a long since it is larger than the
+ maximum value that can be represented by an int. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org