Allow maximum HTTP header size to be configured when using Jetty 8
Closes gh-6190
This commit is contained in:
parent
5b688de8da
commit
5e4f84cf46
|
|
@ -1005,13 +1005,18 @@ public class ServerProperties
|
|||
public void customize(Server server) {
|
||||
for (org.eclipse.jetty.server.Connector connector : server
|
||||
.getConnectors()) {
|
||||
for (ConnectionFactory connectionFactory : connector
|
||||
.getConnectionFactories()) {
|
||||
if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) {
|
||||
customize(
|
||||
(HttpConfiguration.ConnectionFactory) connectionFactory);
|
||||
try {
|
||||
for (ConnectionFactory connectionFactory : connector
|
||||
.getConnectionFactories()) {
|
||||
if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) {
|
||||
customize(
|
||||
(HttpConfiguration.ConnectionFactory) connectionFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
customizeOnJetty8(connector, maxHttpHeaderSize);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1022,6 +1027,20 @@ public class ServerProperties
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
server.compression.enabled: true
|
||||
server.compression.min-response-size: 1
|
||||
server.max-http-header-size: 4096
|
||||
|
|
|
|||
Loading…
Reference in New Issue