hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1557068 - in /httpcomponents/httpasyncclient/trunk: RELEASE_NOTES.txt httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
Date Fri, 10 Jan 2014 09:51:32 GMT
Author: olegk
Date: Fri Jan 10 09:51:32 2014
New Revision: 1557068

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

Modified:
    httpcomponents/httpasyncclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java

Modified: httpcomponents/httpasyncclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/RELEASE_NOTES.txt?rev=1557068&r1=1557067&r2=1557068&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpasyncclient/trunk/RELEASE_NOTES.txt Fri Jan 10 09:51:32 2014
@@ -1,6 +1,10 @@
 Changes since 4.0
 -------------------
 
+* [HTTPCLIENT-1446] NTLM proxy + BASIC target auth fails with 'Unexpected state:
+  MSG_TYPE3_GENERATED'.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPASYNC-63] ConnectionShutdownException thrown in case of out-of-sequence response.
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java?rev=1557068&r1=1557067&r2=1557068&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
Fri Jan 10 09:51:32 2014
@@ -638,15 +638,24 @@ class MainClientExec implements Internal
                         target.getSchemeName());
             }
             final AuthState targetAuthState = localContext.getTargetAuthState();
-            if (this.authenticator.isAuthenticationRequested(target, currentResponse,
-                    this.targetAuthStrategy, targetAuthState, localContext)) {
+            final AuthState proxyAuthState = localContext.getProxyAuthState();
+
+            final boolean targetAuthRequested = this.authenticator.isAuthenticationRequested(
+                    target, currentResponse, this.targetAuthStrategy, targetAuthState, localContext);
+
+            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, currentResponse, this.proxyAuthStrategy, proxyAuthState, localContext);
+
+            if (targetAuthRequested) {
                 return this.authenticator.handleAuthChallenge(target, currentResponse,
                         this.targetAuthStrategy, targetAuthState, localContext);
             }
-            final HttpHost proxy = route.getProxyHost();
-            final AuthState proxyAuthState = localContext.getProxyAuthState();
-            if (this.authenticator.isAuthenticationRequested(proxy, currentResponse,
-                    this.proxyAuthStrategy, proxyAuthState, localContext)) {
+            if (proxyAuthRequested) {
                 return this.authenticator.handleAuthChallenge(proxy, currentResponse,
                         this.proxyAuthStrategy, proxyAuthState, localContext);
             }



Mime
View raw message