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/10/21 16:42:06 UTC
(httpcomponents-client) branch 5.5.x updated: HTTPCLIENT-2403: Mutual authentication check not performed for proxies (#745)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.5.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
The following commit(s) were added to refs/heads/5.5.x by this push:
new eb2a831ce HTTPCLIENT-2403: Mutual authentication check not performed for proxies (#745)
eb2a831ce is described below
commit eb2a831ceb989930f984a9c22b3ce5ea792ebe5b
Author: Istvan Toth <st...@apache.org>
AuthorDate: Tue Oct 21 17:19:01 2025 +0200
HTTPCLIENT-2403: Mutual authentication check not performed for proxies (#745)
---
.../apache/hc/client5/http/impl/async/AsyncProtocolExec.java | 11 +++++------
.../hc/client5/http/impl/auth/AuthenticationHandler.java | 4 ++--
.../org/apache/hc/client5/http/impl/classic/ProtocolExec.java | 11 +++++------
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
index 0d8c50462..1b35f8cb3 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
@@ -334,26 +334,25 @@ private boolean needAuthentication(
}
}
+ boolean targetNeedsAuth = false;
+ boolean proxyNeedsAuth = false;
if (targetAuthRequested || targetMutualAuthRequired) {
- final boolean updated = authenticator.handleResponse(target, ChallengeType.TARGET, response,
+ targetNeedsAuth = authenticator.handleResponse(target, ChallengeType.TARGET, response,
targetAuthStrategy, targetAuthExchange, context);
if (authCacheKeeper != null) {
authCacheKeeper.updateOnResponse(target, pathPrefix, targetAuthExchange, context);
}
-
- return updated;
}
if (proxyAuthRequested || proxyMutualAuthRequired) {
- final boolean updated = authenticator.handleResponse(proxy, ChallengeType.PROXY, response,
+ proxyNeedsAuth = authenticator.handleResponse(proxy, ChallengeType.PROXY, response,
proxyAuthStrategy, proxyAuthExchange, context);
if (authCacheKeeper != null) {
authCacheKeeper.updateOnResponse(proxy, null, proxyAuthExchange, context);
}
-
- return updated;
}
+ return targetNeedsAuth || proxyNeedsAuth;
}
return false;
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthenticationHandler.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthenticationHandler.java
index 8d38ec8e7..fc7e4a22d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthenticationHandler.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthenticationHandler.java
@@ -121,8 +121,8 @@ public boolean isChallenged(
}
/**
- * Determines whether the given response represents an authentication challenge, without
- * changing the {@link AuthExchange} state.
+ * Determines whether the given response represents an authentication challenge
+ * of challangeType, without changing the {@link AuthExchange} state.
*
* @param challengeType the challenge type (target or proxy).
* @param response the response message head.
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
index fe3d35281..b927dbc79 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
@@ -295,26 +295,25 @@ private boolean needAuthentication(
}
}
+ boolean targetNeedsAuth = false;
+ boolean proxyNeedsAuth = false;
if (targetAuthRequested || targetMutualAuthRequired) {
- final boolean updated = authenticator.handleResponse(target, ChallengeType.TARGET, response,
+ targetNeedsAuth = authenticator.handleResponse(target, ChallengeType.TARGET, response,
targetAuthStrategy, targetAuthExchange, context);
if (authCacheKeeper != null) {
authCacheKeeper.updateOnResponse(target, pathPrefix, targetAuthExchange, context);
}
-
- return updated;
}
if (proxyAuthRequested || proxyMutualAuthRequired) {
- final boolean updated = authenticator.handleResponse(proxy, ChallengeType.PROXY, response,
+ proxyNeedsAuth = authenticator.handleResponse(proxy, ChallengeType.PROXY, response,
proxyAuthStrategy, proxyAuthExchange, context);
if (authCacheKeeper != null) {
authCacheKeeper.updateOnResponse(proxy, null, proxyAuthExchange, context);
}
-
- return updated;
}
+ return targetNeedsAuth || proxyNeedsAuth;
}
return false;
}