You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by km...@apache.org on 2013/09/05 00:09:03 UTC

git commit: KNOX-107: Disable redirects for GET to allow URL rewrite to occur.

Updated Branches:
  refs/heads/master d33d044fc -> 6e52be00a


KNOX-107: Disable redirects for GET to allow URL rewrite to occur.


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

Branch: refs/heads/master
Commit: 6e52be00a1393f94beea8ffe0e6277c81b24102d
Parents: d33d044
Author: Kevin Minder <ke...@hortonworks.com>
Authored: Wed Sep 4 18:08:52 2013 -0400
Committer: Kevin Minder <ke...@hortonworks.com>
Committed: Wed Sep 4 18:08:52 2013 -0400

----------------------------------------------------------------------
 gateway-release/home/samples/ExampleHdfs.groovy                    | 2 +-
 .../org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/6e52be00/gateway-release/home/samples/ExampleHdfs.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/ExampleHdfs.groovy b/gateway-release/home/samples/ExampleHdfs.groovy
index 56066b4..56d9f43 100644
--- a/gateway-release/home/samples/ExampleHdfs.groovy
+++ b/gateway-release/home/samples/ExampleHdfs.groovy
@@ -31,7 +31,7 @@ Hdfs.put( session ).file( dataFile ).to( "/tmp/example/README" ).now()
 text = Hdfs.ls( session ).dir( "/tmp/example" ).now().string
 json = (new JsonSlurper()).parseText( text )
 println json.FileStatuses.FileStatus.pathSuffix
-text = Hdfs.get( session ).from( "tmp/example/README" ).now().string
+text = Hdfs.get( session ).from( "/tmp/example/README" ).now().string
 println text
 Hdfs.rm( session ).file( "/tmp/example" ).recursive().now()
 session.shutdown()

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/6e52be00/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
index 67bf412..25fede5 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
@@ -210,6 +210,8 @@ public class HttpClientDispatch extends AbstractGatewayDispatch {
   public void doGet( URI url, HttpServletRequest request, HttpServletResponse response )
       throws IOException, URISyntaxException {
     HttpGet method = new HttpGet( url );
+    // https://issues.apache.org/jira/browse/KNOX-107 - Service URLs not rewritten for WebHDFS GET redirects
+    method.getParams().setBooleanParameter( "http.protocol.handle-redirects", false );
     copyRequestHeaderFields( method, request );
     executeRequest( method, request, response );
   }