Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions client/conf/server.properties.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions client/src/main/java/org/apache/cloudstack/ServerDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 ///////////////////
Expand All @@ -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;
Expand Down Expand Up @@ -140,6 +143,7 @@ public void init(final DaemonContext context) {
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 {
Expand Down Expand Up @@ -191,6 +195,7 @@ public void start() throws Exception {
// 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);
Expand Down Expand Up @@ -263,6 +268,7 @@ private Pair<SessionHandler,HandlerCollection> createHandlers() {
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();
Expand Down Expand Up @@ -365,4 +371,8 @@ public void setSessionTimeout(int sessionTimeout) {
public void setMaxFormContentSize(int maxFormContentSize) {
this.maxFormContentSize = maxFormContentSize;
}

public void setMaxFormKeys(int maxFormKeys) {
this.maxFormKeys = maxFormKeys;
}
}