You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/02/27 09:57:48 UTC
[httpcomponents-core] 01/02: `ServerSupport#toStatusCode` to handle
MisdirectedRequestException as status 421
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit e14f8df5085c8e9c68f774bf3a8cc029320514b5
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Feb 27 10:42:49 2021 +0100
`ServerSupport#toStatusCode` to handle MisdirectedRequestException as status 421
---
.../src/main/java/org/apache/hc/core5/http/impl/ServerSupport.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ServerSupport.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ServerSupport.java
index df6bc12..85b1ee0 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ServerSupport.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/ServerSupport.java
@@ -32,6 +32,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.MethodNotSupportedException;
+import org.apache.hc.core5.http.MisdirectedRequestException;
import org.apache.hc.core5.http.NotImplementedException;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.RequestHeaderFieldsTooLargeException;
@@ -73,6 +74,8 @@ public class ServerSupport {
code = HttpStatus.SC_NOT_IMPLEMENTED;
} else if (ex instanceof RequestHeaderFieldsTooLargeException) {
code = HttpStatus.SC_REQUEST_HEADER_FIELDS_TOO_LARGE;
+ } else if (ex instanceof MisdirectedRequestException) {
+ code = HttpStatus.SC_MISDIRECTED_REQUEST;
} else if (ex instanceof ProtocolException) {
code = HttpStatus.SC_BAD_REQUEST;
} else {