This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push: new 6defa8b Fix long content-length handling for doHead() 6defa8b is described below commit 6defa8be6908110a0f78126c55ccb3a9b1a7ce63 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jun 3 18:57:02 2021 +0100 Fix long content-length handling for doHead() --- java/jakarta/servlet/http/HttpServlet.java | 6 +++--- webapps/docs/changelog.xml | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/java/jakarta/servlet/http/HttpServlet.java b/java/jakarta/servlet/http/HttpServlet.java index 77e8c62..86a5a7b 100644 --- a/java/jakarta/servlet/http/HttpServlet.java +++ b/java/jakarta/servlet/http/HttpServlet.java @@ -823,7 +823,7 @@ public abstract class HttpServlet extends GenericServlet { if (writer != null) { writer.flush(); } - super.setContentLength(noBody.getContentLength()); + super.setContentLengthLong(noBody.getContentLength()); } } @@ -899,13 +899,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 e25ae94..07f3e5b 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -143,6 +143,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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org