knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject knox git commit: KNOX-546 Consuming intermediate response during kerberos request dispatching
Date Thu, 21 May 2015 20:11:24 GMT
Repository: knox
Updated Branches:
  refs/heads/master 801e821a1 -> 5416a7c1d


KNOX-546 Consuming intermediate response during kerberos request dispatching


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/5416a7c1
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/5416a7c1
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/5416a7c1

Branch: refs/heads/master
Commit: 5416a7c1d5081aa6739cabf6db1177794bb10b44
Parents: 801e821
Author: Sumit Gupta <sumit@apache.org>
Authored: Thu May 21 16:10:07 2015 -0400
Committer: Sumit Gupta <sumit@apache.org>
Committed: Thu May 21 16:10:07 2015 -0400

----------------------------------------------------------------------
 .../org/apache/hadoop/gateway/dispatch/DefaultDispatch.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/5416a7c1/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
index 1ee9e49..ad6894a 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
@@ -43,8 +43,8 @@ import org.apache.http.client.methods.HttpPut;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.InputStreamEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.message.BasicHeader;
+import org.apache.http.util.EntityUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -210,10 +210,12 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
          Header[] wwwAuthHeaders = inboundResponse.getHeaders(WWW_AUTHENTICATE);
          if (wwwAuthHeaders != null && wwwAuthHeaders.length != 0 &&
                wwwAuthHeaders[0].getValue().trim().startsWith(NEGOTIATE)) {
+            //need to consume the previous inbound response first
+            EntityUtils.consume(inboundResponse.getEntity());
+
             appCookie = appCookieManager.getAppCookie(outboundRequest, true);
             outboundRequest.removeHeaders(COOKIE);
             outboundRequest.addHeader(new BasicHeader(COOKIE, appCookie));
-            client = new DefaultHttpClient();
             inboundResponse = client.execute(outboundRequest);
          } else {
             // no supported authentication type found


Mime
View raw message