This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new caa925b Ignore exception getting content length caa925b is described below commit caa925b0b918530d758699e0503df3ea3d37cd95 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 409cd8c..0ba6597 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -770,8 +770,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