This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 24441f289a03582967ee344b222eedba1520dc80 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Nov 8 20:29:32 2023 +0000 Only close the connection for client disconnects not bad requests --- java/org/apache/catalina/connector/Request.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 111599a7b3..7883212a1c 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -3043,12 +3043,14 @@ public class Request implements HttpServletRequest { try { readPostBodyFully(formData, len); } catch (IOException e) { - // Client disconnect Context context = getContext(); if (context != null && context.getLogger().isDebugEnabled()) { context.getLogger().debug(sm.getString("coyoteRequest.parseParameters"), e); } - response.getCoyoteResponse().action(ActionCode.CLOSE_NOW, null); + if (e instanceof ClientAbortException) { + // Client has disconnected. Close immediately. + response.getCoyoteResponse().action(ActionCode.CLOSE_NOW, null); + } if (e instanceof BadRequestException) { parametersParseException = new InvalidParameterException(e); } else { @@ -3065,12 +3067,14 @@ public class Request implements HttpServletRequest { parametersParseException = ise; return; } catch (IOException e) { - // Client disconnect Context context = getContext(); if (context != null && context.getLogger().isDebugEnabled()) { context.getLogger().debug(sm.getString("coyoteRequest.parseParameters"), e); } - response.getCoyoteResponse().action(ActionCode.CLOSE_NOW, null); + if (e instanceof ClientAbortException) { + // Client has disconnected. Close immediately. + response.getCoyoteResponse().action(ActionCode.CLOSE_NOW, null); + } if (e instanceof BadRequestException) { parametersParseException = new InvalidParameterException(e); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org