From: remm Date: Tue, 19 Dec 2006 01:44:02 +0000 (+0000) Subject: - Modify the code so that it doesn't log client disconnects unless debug is on, and... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6932945e51bb5369cc95cd0c0b482f260ad6843b;p=tomcat7.0 - Modify the code so that it doesn't log client disconnects unless debug is on, and make behavior in front of runtime exceptions more transparent. - Also, if failing to read or parse parameters doesn't throw an ISE, then a post too large shouldn't be an ISE. Or the opposite should be done, but IMO this would be excessive logging. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@488498 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index b6bedd428..11706f41b 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -2426,27 +2426,31 @@ public class Request if (len > 0) { int maxPostSize = connector.getMaxPostSize(); if ((maxPostSize > 0) && (len > maxPostSize)) { - context.getLogger().info - (sm.getString("coyoteRequest.postTooLarge")); - throw new IllegalStateException("Post too large"); + if (context.getLogger().isDebugEnabled()) { + context.getLogger().debug("Post too large"); + } + return; + } + byte[] formData = null; + if (len < CACHED_POST_LEN) { + if (postData == null) + postData = new byte[CACHED_POST_LEN]; + formData = postData; + } else { + formData = new byte[len]; } try { - byte[] formData = null; - if (len < CACHED_POST_LEN) { - if (postData == null) - postData = new byte[CACHED_POST_LEN]; - formData = postData; - } else { - formData = new byte[len]; + if (readPostBody(formData, len) != len) { + return; } - int actualLen = readPostBody(formData, len); - if (actualLen == len) { - parameters.processParameters(formData, 0, len); + } catch (IOException e) { + // Client disconnect + if (context.getLogger().isDebugEnabled()) { + context.getLogger().debug( + sm.getString("coyoteRequest.parseParameters"), e); } - } catch (Throwable t) { - context.getLogger().warn( - sm.getString("coyoteRequest.parseParameters"), t); } + parameters.processParameters(formData, 0, len); } }