Commit 5e4f84cf authored by Andy Wilkinson's avatar Andy Wilkinson

Allow maximum HTTP header size to be configured when using Jetty 8

Closes gh-6190
parent 5b688de8
...@@ -1005,13 +1005,18 @@ public class ServerProperties ...@@ -1005,13 +1005,18 @@ public class ServerProperties
public void customize(Server server) { public void customize(Server server) {
for (org.eclipse.jetty.server.Connector connector : server for (org.eclipse.jetty.server.Connector connector : server
.getConnectors()) { .getConnectors()) {
for (ConnectionFactory connectionFactory : connector try {
.getConnectionFactories()) { for (ConnectionFactory connectionFactory : connector
if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) { .getConnectionFactories()) {
customize( if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) {
(HttpConfiguration.ConnectionFactory) connectionFactory); customize(
(HttpConfiguration.ConnectionFactory) connectionFactory);
}
} }
} }
catch (NoSuchMethodError ex) {
customizeOnJetty8(connector, maxHttpHeaderSize);
}
} }
} }
...@@ -1022,6 +1027,20 @@ public class ServerProperties ...@@ -1022,6 +1027,20 @@ public class ServerProperties
configuration.setResponseHeaderSize(maxHttpHeaderSize); configuration.setResponseHeaderSize(maxHttpHeaderSize);
} }
private void customizeOnJetty8(
org.eclipse.jetty.server.Connector connector,
int maxHttpHeaderSize) {
try {
connector.getClass().getMethod("setRequestHeaderSize", int.class)
.invoke(connector, maxHttpHeaderSize);
connector.getClass().getMethod("setResponseHeaderSize", int.class)
.invoke(connector, maxHttpHeaderSize);
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}); });
} }
......
server.compression.enabled: true server.compression.enabled: true
server.compression.min-response-size: 1 server.compression.min-response-size: 1
server.max-http-header-size: 4096
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment