diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java index 298f5286a3a..aa2873a2f68 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java @@ -29,11 +29,14 @@ import org.eclipse.jetty.client.api.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.ProcessorUtils; import org.eclipse.jetty.util.Promise; +import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @ManagedObject("The HTTP/1.1 client transport") public class HttpClientTransportOverHTTP extends AbstractConnectorHttpClientTransport { + private int headerCacheSize = 1024; + public HttpClientTransportOverHTTP() { this(Math.max(1, ProcessorUtils.availableProcessors() / 2)); @@ -67,4 +70,15 @@ public class HttpClientTransportOverHTTP extends AbstractConnectorHttpClientTran { return new HttpConnectionOverHTTP(endPoint, destination, promise); } + + @ManagedAttribute("The maximum allowed size in bytes for an HTTP header field cache") + public int getHeaderCacheSize() + { + return headerCacheSize; + } + + public void setHeaderCacheSize(int headerCacheSize) + { + this.headerCacheSize = headerCacheSize; + } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java index e8093086d66..a8db9534162 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java @@ -245,8 +245,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res @Override public int getHeaderCacheSize() { - // TODO get from configuration - return 4096; + HttpClientTransportOverHTTP transport = (HttpClientTransportOverHTTP)getHttpDestination().getHttpClient().getTransport(); + return transport.getHeaderCacheSize(); } @Override diff --git a/jetty-deploy/src/test/resources/jetty.xml b/jetty-deploy/src/test/resources/jetty.xml index c780fdfea5b..576d20a7d2f 100644 --- a/jetty-deploy/src/test/resources/jetty.xml +++ b/jetty-deploy/src/test/resources/jetty.xml @@ -64,7 +64,7 @@ 8192 true false - 4096 + 1024 @@ -61,7 +61,7 @@ - + diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty.xml index 43e978db7f0..b0b36e50012 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty.xml +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty.xml @@ -50,7 +50,7 @@ - + diff --git a/jetty-server/src/main/config/etc/jetty.xml b/jetty-server/src/main/config/etc/jetty.xml index a09928522af..03e916b9d27 100644 --- a/jetty-server/src/main/config/etc/jetty.xml +++ b/jetty-server/src/main/config/etc/jetty.xml @@ -47,7 +47,7 @@ - + diff --git a/jetty-server/src/main/config/modules/server.mod b/jetty-server/src/main/config/modules/server.mod index 55ad19b9bec..ca5a2258120 100644 --- a/jetty-server/src/main/config/modules/server.mod +++ b/jetty-server/src/main/config/modules/server.mod @@ -55,7 +55,7 @@ patch-module: servlet.api=lib/jetty-schemas-3.1.jar # jetty.httpConfig.sendDateHeader=false ## Max per-connection header cache size (in nodes) -# jetty.httpConfig.headerCacheSize=4096 +# jetty.httpConfig.headerCacheSize=1024 ## Whether, for requests with content, delay dispatch until some content has arrived # jetty.httpConfig.delayDispatchUntilContent=true diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java index e5bd93fde16..42aa19d9de9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java @@ -59,7 +59,7 @@ public class HttpConfiguration implements Dumpable private int _outputAggregationSize = _outputBufferSize / 4; private int _requestHeaderSize = 8 * 1024; private int _responseHeaderSize = 8 * 1024; - private int _headerCacheSize = 4 * 1024; + private int _headerCacheSize = 1024; private int _securePort; private long _idleTimeout = -1; private long _blockingTimeout = -1; diff --git a/tests/test-integration/src/test/resources/DefaultHandler.xml b/tests/test-integration/src/test/resources/DefaultHandler.xml index 78e31d05a4a..671af8b5735 100644 --- a/tests/test-integration/src/test/resources/DefaultHandler.xml +++ b/tests/test-integration/src/test/resources/DefaultHandler.xml @@ -13,7 +13,7 @@ 8192 true false - 4096 + 1024