hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1557063 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Date Fri, 10 Jan 2014 09:23:47 GMT
Author: olegk
Date: Fri Jan 10 09:23:46 2014
New Revision: 1557063

URL: http://svn.apache.org/r1557063
Log:
HTTPCLIENT-1446:  NTLM proxy + BASIC target auth fails with 'Unexpected state: MSG_TYPE3_GENERATED

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=1557063&r1=1557062&r2=1557063&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Fri Jan 10 09:23:46 2014
@@ -1066,22 +1066,26 @@ public class DefaultRequestDirector impl
                 Scheme scheme = connManager.getSchemeRegistry().getScheme(target);
                 target = new HttpHost(target.getHostName(), scheme.getDefaultPort(), target.getSchemeName());
             }
-            if (this.authenticator.isAuthenticationRequested(target, response,
-                    this.targetAuthStrategy, this.targetAuthState, context)) {
+
+            final boolean targetAuthRequested = this.authenticator.isAuthenticationRequested(
+                    target, response, this.targetAuthStrategy, targetAuthState, context);
+
+            HttpHost proxy = route.getProxyHost();
+            // if proxy is not set use target host instead
+            if (proxy == null) {
+                proxy = route.getTargetHost();
+            }
+            final boolean proxyAuthRequested = this.authenticator.isAuthenticationRequested(
+                    proxy, response, this.proxyAuthStrategy, proxyAuthState, context);
+
+            if (targetAuthRequested) {
                 if (this.authenticator.authenticate(target, response,
                         this.targetAuthStrategy, this.targetAuthState, context)) {
                     // Re-try the same request via the same route
                     return roureq;
                 }
             }
-
-            HttpHost proxy = route.getProxyHost();
-            if (this.authenticator.isAuthenticationRequested(proxy, response,
-                    this.proxyAuthStrategy, this.proxyAuthState, context)) {
-                // if proxy is not set use target host instead
-                if (proxy == null) {
-                    proxy = route.getTargetHost();
-                }
+            if (proxyAuthRequested) {
                 if (this.authenticator.authenticate(proxy, response,
                         this.proxyAuthStrategy, this.proxyAuthState, context)) {
                     // Re-try the same request via the same route



Mime
View raw message