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 2026/06/20 10:49:08 UTC
(httpcomponents-core) branch HTTPCORE-796 created (now 791cc67bd)
This is an automated email from the ASF dual-hosted git repository.
ok2c pushed a change to branch HTTPCORE-796
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
at 791cc67bd HTTPCORE-796: abort redirected requests during the expect-continue handshake the same way as errors
This branch includes the following new commits:
new 791cc67bd HTTPCORE-796: abort redirected requests during the expect-continue handshake the same way as errors
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(httpcomponents-core) 01/01: HTTPCORE-796: abort redirected requests during the expect-continue handshake the same way as errors
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ok2c pushed a commit to branch HTTPCORE-796
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit 791cc67bdc8089060cc82b76bf0c08a703769ee3
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Jun 20 12:48:34 2026 +0200
HTTPCORE-796: abort redirected requests during the expect-continue handshake the same way as errors
---
.../java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java | 2 +-
.../apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
index 5208c0fc9..84400643a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
@@ -183,7 +183,7 @@ public ClassicHttpResponse execute(
}
response = null;
continue;
- } else if (status >= HttpStatus.SC_CLIENT_ERROR) {
+ } else if (status >= HttpStatus.SC_REDIRECTION) {
conn.terminateRequest(request);
} else {
conn.sendRequestEntity(request);
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
index b54c603db..eb335a648 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
@@ -230,11 +230,14 @@ void consumeHeader(final HttpResponse response, final EntityDetails entityDetail
keepAlive = false;
}
}
+ boolean abort = false;
if (requestState.get() == MessageState.ACK) {
if (status == HttpStatus.SC_CONTINUE || status >= HttpStatus.SC_SUCCESS) {
outputChannel.setSocketTimeout(timeout);
requestState.set(MessageState.BODY);
- if (status < HttpStatus.SC_CLIENT_ERROR) {
+ if (status >= HttpStatus.SC_REDIRECTION) {
+ abort = true;
+ } else {
exchangeHandler.produce(internalDataChannel);
}
}
@@ -243,7 +246,7 @@ void consumeHeader(final HttpResponse response, final EntityDetails entityDetail
return;
}
if (requestState.get() == MessageState.BODY) {
- if (status >= HttpStatus.SC_CLIENT_ERROR) {
+ if (abort || status >= HttpStatus.SC_CLIENT_ERROR) {
requestState.set(MessageState.COMPLETE);
if (!outputChannel.abortGracefully()) {
keepAlive = false;