You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/11/08 20:30:13 UTC
(tomcat) 01/02: Only close the connection for client disconnects not bad requests
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org