@@ -82,6 +82,8 @@ public class ServerDaemon implements Daemon {
8282 private static final String ACCESS_LOG = "access.log" ;
8383 private static final String REQUEST_CONTENT_SIZE_KEY = "request.content.size" ;
8484 private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576 ;
85+ private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys" ;
86+ private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000 ;
8587
8688 ////////////////////////////////////////////////////////
8789 /////////////// Server Configuration ///////////////////
@@ -94,6 +96,7 @@ public class ServerDaemon implements Daemon {
9496 private int httpsPort = 8443 ;
9597 private int sessionTimeout = 10 ;
9698 private int maxFormContentSize = DEFAULT_REQUEST_CONTENT_SIZE ;
99+ private int maxFormKeys = DEFAULT_REQUEST_MAX_FORM_KEYS ;
97100 private boolean httpsEnable = false ;
98101 private String accessLogFile = "access.log" ;
99102 private String bindInterface = null ;
@@ -141,6 +144,7 @@ public void init(final DaemonContext context) {
141144 setAccessLogFile (properties .getProperty (ACCESS_LOG , "access.log" ));
142145 setSessionTimeout (Integer .valueOf (properties .getProperty (SESSION_TIMEOUT , "10" )));
143146 setMaxFormContentSize (Integer .valueOf (properties .getProperty (REQUEST_CONTENT_SIZE_KEY , String .valueOf (DEFAULT_REQUEST_CONTENT_SIZE ))));
147+ setMaxFormKeys (Integer .valueOf (properties .getProperty (REQUEST_MAX_FORM_KEYS_KEY , String .valueOf (DEFAULT_REQUEST_MAX_FORM_KEYS ))));
144148 } catch (final IOException e ) {
145149 logger .warn ("Failed to read configuration from server.properties file" , e );
146150 } finally {
@@ -192,6 +196,7 @@ public void start() throws Exception {
192196 // Extra config options
193197 server .setStopAtShutdown (true );
194198 server .setAttribute (ContextHandler .MAX_FORM_CONTENT_SIZE_KEY , maxFormContentSize );
199+ server .setAttribute (ContextHandler .MAX_FORM_KEYS_KEY , maxFormKeys );
195200
196201 // HTTPS Connector
197202 createHttpsConnector (httpConfig );
@@ -264,6 +269,7 @@ private Pair<SessionHandler,HandlerCollection> createHandlers() {
264269 webApp .setContextPath (contextPath );
265270 webApp .setInitParameter ("org.eclipse.jetty.servlet.Default.dirAllowed" , "false" );
266271 webApp .setMaxFormContentSize (maxFormContentSize );
272+ webApp .setMaxFormKeys (maxFormKeys );
267273
268274 // GZIP handler
269275 final GzipHandler gzipHandler = new GzipHandler ();
@@ -366,4 +372,8 @@ public void setSessionTimeout(int sessionTimeout) {
366372 public void setMaxFormContentSize (int maxFormContentSize ) {
367373 this .maxFormContentSize = maxFormContentSize ;
368374 }
375+
376+ public void setMaxFormKeys (int maxFormKeys ) {
377+ this .maxFormKeys = maxFormKeys ;
378+ }
369379}
0 commit comments