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 2025/02/12 13:56:42 UTC
(httpcomponents-core) 01/03: Bug fix: ServerHttp1StreamHandler causes an NPE when attempting to handle a corrupt / invalid incoming request message head
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 bdbf3288df2d4aa6c5ba9d8843e7277e66600140
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Feb 12 11:52:01 2025 +0100
Bug fix: ServerHttp1StreamHandler causes an NPE when attempting to handle a corrupt / invalid incoming request message head
---
.../org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
index d8fec2744..d6f5a42e8 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
@@ -331,7 +331,7 @@ void dataEnd(final List<? extends Header> trailers) throws HttpException, IOExce
}
void failed(final Exception cause) {
- if (!done.get()) {
+ if (!done.get() && exchangeHandler != null) {
exchangeHandler.failed(cause);
}
}
@@ -341,7 +341,9 @@ public void releaseResources() {
if (done.compareAndSet(false, true)) {
requestState = MessageState.COMPLETE;
responseState = MessageState.COMPLETE;
- exchangeHandler.releaseResources();
+ if (exchangeHandler != null) {
+ exchangeHandler.releaseResources();
+ }
}
}