Repository: knox Updated Branches: refs/heads/master fa56190a3 -> 5a08e3742
KNOX-632: Oozie dispatch failing for secure clusters Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/5a08e374 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/5a08e374 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/5a08e374 Branch: refs/heads/master Commit: 5a08e3742da32b75820d22b0acaf37a485d3df65 Parents: fa56190 Author: Kevin Minder <[email protected]> Authored: Mon Nov 23 14:49:29 2015 -0500 Committer: Kevin Minder <[email protected]> Committed: Mon Nov 23 14:49:29 2015 -0500 ---------------------------------------------------------------------- .../org/apache/hadoop/gateway/dispatch/DefaultDispatch.java | 5 +++++ .../gateway/dispatch/PartiallyRepeatableHttpEntity.java | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/5a08e374/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 6cd9461..a71d56a 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 @@ -191,6 +191,11 @@ public class DefaultDispatch extends AbstractGatewayDispatch { } else { entity = new InputStreamEntity(contentStream, contentLength, ContentType.parse(contentType)); } + GatewayConfig config = + (GatewayConfig)request.getServletContext().getAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE ); + if( config.isHadoopKerberosSecured() ) { + entity = new PartiallyRepeatableHttpEntity( entity, config.getHttpServerRequestBuffer() ); + } return entity; } http://git-wip-us.apache.org/repos/asf/knox/blob/5a08e374/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/PartiallyRepeatableHttpEntity.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/PartiallyRepeatableHttpEntity.java b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/PartiallyRepeatableHttpEntity.java index 0bc89c6..fef05f2 100644 --- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/PartiallyRepeatableHttpEntity.java +++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/PartiallyRepeatableHttpEntity.java @@ -56,7 +56,7 @@ public class PartiallyRepeatableHttpEntity extends HttpEntityWrapper { @Override public boolean isRepeatable() { - return true; + return finalStream == null; } @Override @@ -83,7 +83,7 @@ public class PartiallyRepeatableHttpEntity extends HttpEntityWrapper { return wrappedEntity.getContent(); // Else if the buffer has overflowed } else if( finalStream != null ) { - throw new IOException( "TODO - Existing stream already past replay buffer capacity" ); + throw new IOException( "Existing stream already past replay buffer capacity." ); } else { if( wrappedStream == null ) { wrappedStream = wrappedEntity.getContent(); @@ -111,7 +111,7 @@ public class PartiallyRepeatableHttpEntity extends HttpEntityWrapper { public int read() throws IOException { int b; if( finalStream != null && finalStream != this ) { - throw new IOException( "TODO - Replay stream taken over by another consumer." ); + throw new IOException( "Replay stream taken over by another consumer." ); } // If we can read from the buffer do so. if( replayReadIndex < replayWriteIndex ) { @@ -134,7 +134,7 @@ public class PartiallyRepeatableHttpEntity extends HttpEntityWrapper { public int read( byte buffer[], int offset, int limit ) throws IOException { int count = -1; if( finalStream != null && finalStream != this ) { - throw new IOException( "TODO - Replay stream taken over by another consumer." ); + throw new IOException( "Replay stream taken over by another consumer." ); } // If we can read from the buffer do so. if( replayReadIndex < replayWriteIndex ) {
