From 19c4939ede25e3fcbafe7e69490bc24bfea744af Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 10 Jun 2014 13:05:28 +0200 Subject: [PATCH] flip encode buffer --- .../eclipse/jetty/http2/hpack/HpackEncoder.java | 14 ++++++++++++++ .../org/eclipse/jetty/http2/hpack/HpackTest.java | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java index 7e513e8f076..94fff2c348a 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java @@ -93,9 +93,23 @@ public class HpackEncoder ByteBuffer buffer = lease.acquire(8*1024,false); // TODO make size configurable // TODO handle multiple buffers if large size configured. + BufferUtil.clearToFill(buffer); encode(buffer,metadata); + BufferUtil.flipToFlush(buffer,0); } + public void encodeMaxHeaderTableSize(ByteBuffer buffer, int maxHeaderTableSize) + { + // TODO + _context.resize(maxHeaderTableSize); + } + + public void encodeClearReferenceSet(ByteBuffer buffer) + { + // TODO + _context.clearReferenceSet(); + } + public void encode(ByteBuffer buffer, MetaData metadata) { // Add Request/response meta fields diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java index ab5937e87d9..b6c039848c9 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java @@ -52,7 +52,6 @@ public class HpackTest BufferUtil.flipToFlush(buffer,0); Response decoded0 = (Response)decoder.decode(buffer); - System.err.println(decoded0); Assert.assertEquals(original0,decoded0); // Same again? @@ -61,7 +60,6 @@ public class HpackTest BufferUtil.flipToFlush(buffer,0); Response decoded0b = (Response)decoder.decode(buffer); - System.err.println(decoded0b); Assert.assertEquals(original0,decoded0b); @@ -78,7 +76,6 @@ public class HpackTest BufferUtil.flipToFlush(buffer,0); Response decoded1 = (Response)decoder.decode(buffer); - System.err.println(decoded1); Assert.assertEquals(original1,decoded1);