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/04/07 06:41:16 UTC

[httpcomponents-client] branch 5.0.x updated: HTTPCLIENT-2147: fixed broken preemptive auth in HC Fluent

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/5.0.x by this push:
     new d65d21d  HTTPCLIENT-2147: fixed broken preemptive auth in HC Fluent
d65d21d is described below

commit d65d21d38d7bb497ece89ca42b40f93129b3d0b4
Author: rrodewald <ro...@kopsis.com>
AuthorDate: Tue Apr 6 18:12:49 2021 +0200

    HTTPCLIENT-2147: fixed broken preemptive auth in HC Fluent
---
 .../src/main/java/org/apache/hc/client5/http/fluent/Executor.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java
index c1d8b7d..29b7023 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java
@@ -127,7 +127,7 @@ public class Executor {
     public Executor authPreemptive(final HttpHost host) {
         if (this.credentialsStore != null) {
             final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(host), null);
-            if (credentials == null) {
+            if (credentials != null) {
                 final BasicScheme basicScheme = new BasicScheme();
                 basicScheme.initPreemptive(credentials);
                 this.authCache.put(host, basicScheme);
@@ -152,7 +152,7 @@ public class Executor {
     public Executor authPreemptiveProxy(final HttpHost proxy) {
         if (this.credentialsStore != null) {
             final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(proxy), null);
-            if (credentials == null) {
+            if (credentials != null) {
                 final BasicScheme basicScheme = new BasicScheme();
                 basicScheme.initPreemptive(credentials);
                 this.authCache.put(proxy, basicScheme);