This is an automated email from the ASF dual-hosted git repository. remm 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 16d3cbf Ignore exception getting content length 16d3cbf is described below commit 16d3cbff99d57045af93d6d95e3fec5050d897b6 Author: remm <r...@apache.org> AuthorDate: Fri Jun 5 14:21:39 2020 +0200 Ignore exception getting content length If the value is invalid, there will be another attempt to convert the number with no really easy way out. Ignore the exception which already happened in prepareRequest. --- java/org/apache/coyote/http11/Http11Processor.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 4d48d92..f467f15 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -528,8 +528,16 @@ public class Http11Processor extends AbstractProcessor { private void checkMaxSwallowSize() { - if (request.getContentLengthLong() > 0 && - (request.getContentLengthLong() - request.getBytesRead() > protocol.getMaxSwallowSize())) { + // Parse content-length header + long contentLength = -1; + try { + contentLength = request.getContentLengthLong(); + } catch (Exception e) { + // Ignore, an error here is already processed in prepareRequest + // but is done again since the content length is still -1 + } + if (contentLength > 0 && + (contentLength - request.getBytesRead() > protocol.getMaxSwallowSize())) { // There is more data to swallow than Tomcat will accept so the // connection is going to be closed. Disable keep-alive which will // trigger adding the "Connection: close" header if not already --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org