mirror of https://github.com/apache/cloudstack.git
Configure org.eclipse.jetty.server.Request.maxFormKeys from server.properties and increase the default value (#10214)
This commit is contained in:
parent
00c659b7a7
commit
0b8076c38c
|
|
@ -32,6 +32,9 @@ session.timeout=30
|
|||
# Max allowed API request payload/content size in bytes
|
||||
request.content.size=1048576
|
||||
|
||||
# Max allowed API request form keys
|
||||
request.max.form.keys=5000
|
||||
|
||||
# Options to configure and enable HTTPS on the management server
|
||||
#
|
||||
# For the management server to pick up these configuration settings, the configured
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ public class ServerDaemon implements Daemon {
|
|||
private static final String ACCESS_LOG = "access.log";
|
||||
private static final String REQUEST_CONTENT_SIZE_KEY = "request.content.size";
|
||||
private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576;
|
||||
private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys";
|
||||
private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/////////////// Server Configuration ///////////////////
|
||||
|
|
@ -93,6 +95,7 @@ public class ServerDaemon implements Daemon {
|
|||
private int httpsPort = 8443;
|
||||
private int sessionTimeout = 30;
|
||||
private int maxFormContentSize = DEFAULT_REQUEST_CONTENT_SIZE;
|
||||
private int maxFormKeys = DEFAULT_REQUEST_MAX_FORM_KEYS;
|
||||
private boolean httpsEnable = false;
|
||||
private String accessLogFile = "access.log";
|
||||
private String bindInterface = null;
|
||||
|
|
@ -140,6 +143,7 @@ public class ServerDaemon implements Daemon {
|
|||
setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));
|
||||
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
|
||||
setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE))));
|
||||
setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY, String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS))));
|
||||
} catch (final IOException e) {
|
||||
LOG.warn("Failed to read configuration from server.properties file", e);
|
||||
} finally {
|
||||
|
|
@ -191,6 +195,7 @@ public class ServerDaemon implements Daemon {
|
|||
// Extra config options
|
||||
server.setStopAtShutdown(true);
|
||||
server.setAttribute(ContextHandler.MAX_FORM_CONTENT_SIZE_KEY, maxFormContentSize);
|
||||
server.setAttribute(ContextHandler.MAX_FORM_KEYS_KEY, maxFormKeys);
|
||||
|
||||
// HTTPS Connector
|
||||
createHttpsConnector(httpConfig);
|
||||
|
|
@ -263,6 +268,7 @@ public class ServerDaemon implements Daemon {
|
|||
webApp.setContextPath(contextPath);
|
||||
webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
|
||||
webApp.setMaxFormContentSize(maxFormContentSize);
|
||||
webApp.setMaxFormKeys(maxFormKeys);
|
||||
|
||||
// GZIP handler
|
||||
final GzipHandler gzipHandler = new GzipHandler();
|
||||
|
|
@ -365,4 +371,8 @@ public class ServerDaemon implements Daemon {
|
|||
public void setMaxFormContentSize(int maxFormContentSize) {
|
||||
this.maxFormContentSize = maxFormContentSize;
|
||||
}
|
||||
|
||||
public void setMaxFormKeys(int maxFormKeys) {
|
||||
this.maxFormKeys = maxFormKeys;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue