From 78cbed12363ee1d9f6f66496195e410c316373e1 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 11 Jun 2014 13:36:52 +0200 Subject: [PATCH] Added headerTableSize parameter. --- .../eclipse/jetty/http2/generator/Generator.java | 4 ++-- .../http2/server/HTTP2ServerConnectionFactory.java | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java index dda42dc0065..c326e8da3c5 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java @@ -29,12 +29,12 @@ public class Generator private final ByteBufferPool byteBufferPool; private final FrameGenerator[] generators; - public Generator(ByteBufferPool byteBufferPool) + public Generator(ByteBufferPool byteBufferPool, int headerTableSize) { this.byteBufferPool = byteBufferPool; HeaderGenerator headerGenerator = new HeaderGenerator(); - HpackEncoder encoder = new HpackEncoder(); + HpackEncoder encoder = new HpackEncoder(headerTableSize); this.generators = new FrameGenerator[FrameType.values().length]; this.generators[FrameType.DATA.getType()] = new DataGenerator(headerGenerator); diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnectionFactory.java index 2d2a581dc0f..e844c33ce41 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnectionFactory.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnectionFactory.java @@ -43,6 +43,7 @@ public class HTTP2ServerConnectionFactory extends AbstractConnectionFactory private static final String CHANNEL_ATTRIBUTE = HttpChannelOverHTTP2.class.getName(); private final HttpConfiguration httpConfiguration; + private int headerTableSize = 4096; public HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration) { @@ -50,12 +51,22 @@ public class HTTP2ServerConnectionFactory extends AbstractConnectionFactory this.httpConfiguration = httpConfiguration; } + public int getHeaderTableSize() + { + return headerTableSize; + } + + public void setHeaderTableSize(int headerTableSize) + { + this.headerTableSize = headerTableSize; + } + @Override public Connection newConnection(Connector connector, EndPoint endPoint) { Session.Listener listener = new HTTPServerSessionListener(connector, httpConfiguration, endPoint); - Generator generator = new Generator(connector.getByteBufferPool()); + Generator generator = new Generator(connector.getByteBufferPool(), getHeaderTableSize()); HTTP2ServerSession session = new HTTP2ServerSession(endPoint, generator, listener); Parser parser = new ServerParser(connector.getByteBufferPool(), session);