You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gi...@apache.org on 2018/08/31 18:36:50 UTC

[incubator-druid] branch 0.12.3 updated: BytesFullResponseHandler should only consume readableBytes of ChannelBuffer #6270 (#6277)

This is an automated email from the ASF dual-hosted git repository.

gian pushed a commit to branch 0.12.3
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.12.3 by this push:
     new 56129e2  BytesFullResponseHandler should only consume readableBytes of ChannelBuffer #6270 (#6277)
56129e2 is described below

commit 56129e23f935eb9815260e028248f2b93acd3088
Author: Jonathan Wei <jo...@users.noreply.github.com>
AuthorDate: Fri Aug 31 11:36:47 2018 -0700

    BytesFullResponseHandler should only consume readableBytes of ChannelBuffer #6270 (#6277)
---
 .../basic/authentication/BytesFullResponseHandler.java       | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/BytesFullResponseHandler.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/BytesFullResponseHandler.java
index c548cfc..a6d9971 100644
--- a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/BytesFullResponseHandler.java
+++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/BytesFullResponseHandler.java
@@ -22,6 +22,7 @@ package io.druid.security.basic.authentication;
 import io.druid.java.util.http.client.response.ClientResponse;
 import io.druid.java.util.http.client.response.FullResponseHolder;
 import io.druid.java.util.http.client.response.HttpResponseHandler;
+import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.handler.codec.http.HttpChunk;
 import org.jboss.netty.handler.codec.http.HttpResponse;
 
@@ -36,7 +37,7 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons
         null
     );
 
-    holder.addChunk(response.getContent().array());
+    holder.addChunk(getContentBytes(response.getContent()));
 
     return ClientResponse.unfinished(
         holder
@@ -55,7 +56,7 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons
       return ClientResponse.finished(null);
     }
 
-    holder.addChunk(chunk.getContent().array());
+    holder.addChunk(getContentBytes(chunk.getContent()));
     return response;
   }
 
@@ -72,4 +73,11 @@ public class BytesFullResponseHandler implements HttpResponseHandler<FullRespons
   {
     // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished
   }
+
+  private byte[] getContentBytes(ChannelBuffer content)
+  {
+    byte[] contentBytes = new byte[content.readableBytes()];
+    content.readBytes(contentBytes);
+    return contentBytes;
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org