Skip to content

Commit 50a762a

Browse files
abh1sarGlover, Rene (rg9975)
authored andcommitted
Configure org.eclipse.jetty.server.Request.maxFormKeys from server.properties and increase the default value (apache#10214)
1 parent 6604105 commit 50a762a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

client/conf/server.properties.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ session.timeout=30
3232
# Max allowed API request payload/content size in bytes
3333
request.content.size=1048576
3434

35+
# Max allowed API request form keys
36+
request.max.form.keys=5000
37+
3538
# Options to configure and enable HTTPS on the management server
3639
#
3740
# For the management server to pick up these configuration settings, the configured

client/src/main/java/org/apache/cloudstack/ServerDaemon.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public class ServerDaemon implements Daemon {
8181
private static final String ACCESS_LOG = "access.log";
8282
private static final String REQUEST_CONTENT_SIZE_KEY = "request.content.size";
8383
private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576;
84+
private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys";
85+
private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000;
8486

8587
////////////////////////////////////////////////////////
8688
/////////////// Server Configuration ///////////////////
@@ -93,6 +95,7 @@ public class ServerDaemon implements Daemon {
9395
private int httpsPort = 8443;
9496
private int sessionTimeout = 30;
9597
private int maxFormContentSize = DEFAULT_REQUEST_CONTENT_SIZE;
98+
private int maxFormKeys = DEFAULT_REQUEST_MAX_FORM_KEYS;
9699
private boolean httpsEnable = false;
97100
private String accessLogFile = "access.log";
98101
private String bindInterface = null;
@@ -140,6 +143,7 @@ public void init(final DaemonContext context) {
140143
setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));
141144
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
142145
setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE))));
146+
setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY, String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS))));
143147
} catch (final IOException e) {
144148
LOG.warn("Failed to read configuration from server.properties file", e);
145149
} finally {
@@ -191,6 +195,7 @@ public void start() throws Exception {
191195
// Extra config options
192196
server.setStopAtShutdown(true);
193197
server.setAttribute(ContextHandler.MAX_FORM_CONTENT_SIZE_KEY, maxFormContentSize);
198+
server.setAttribute(ContextHandler.MAX_FORM_KEYS_KEY, maxFormKeys);
194199

195200
// HTTPS Connector
196201
createHttpsConnector(httpConfig);
@@ -263,6 +268,7 @@ private Pair<SessionHandler,HandlerCollection> createHandlers() {
263268
webApp.setContextPath(contextPath);
264269
webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
265270
webApp.setMaxFormContentSize(maxFormContentSize);
271+
webApp.setMaxFormKeys(maxFormKeys);
266272

267273
// GZIP handler
268274
final GzipHandler gzipHandler = new GzipHandler();
@@ -365,4 +371,8 @@ public void setSessionTimeout(int sessionTimeout) {
365371
public void setMaxFormContentSize(int maxFormContentSize) {
366372
this.maxFormContentSize = maxFormContentSize;
367373
}
374+
375+
public void setMaxFormKeys(int maxFormKeys) {
376+
this.maxFormKeys = maxFormKeys;
377+
}
368378
}

0 commit comments

Comments
 (0)