-
Notifications
You must be signed in to change notification settings - Fork 40.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a configuration property for configuring Jetty's max form keys #42448
base: main
Are you sure you want to change the base?
Conversation
@qingbozhang Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@qingbozhang Thank you for signing the Contributor License Agreement! |
Hi I’d appreciate a review when you have a moment. Thanks! |
We're a small team with many different priorities. Expecting a review within two days of opening a PR isn't realistic. Someone will review this when we have time. Thank you for your patience in the meantime. |
OK, thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, please review the comments when time permits.
@@ -1148,6 +1148,11 @@ public static class Jetty { | |||
*/ | |||
private DataSize maxHttpFormPostSize = DataSize.ofBytes(200000); | |||
|
|||
/** | |||
* Maximum size of the form keys. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really a size, is it? How about "Maximum number of form keys."
@@ -1180,6 +1185,14 @@ public void setMaxHttpFormPostSize(DataSize maxHttpFormPostSize) { | |||
this.maxHttpFormPostSize = maxHttpFormPostSize; | |||
} | |||
|
|||
public int getMaxFormKeys() { | |||
return maxFormKeys; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing this.
@@ -122,7 +127,7 @@ private void customizeIdleTimeout(ConfigurableJettyWebServerFactory factory, Dur | |||
}); | |||
} | |||
|
|||
private void customizeMaxHttpFormPostSize(ConfigurableJettyWebServerFactory factory, int maxHttpFormPostSize) { | |||
private void customizeServletContextHandler(ConfigurableJettyWebServerFactory factory, Consumer<ServletContextHandler> customFunc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before your change this method adds a customizer that is very much specific to maxHttpFormPostSize. The private method is still named setHandlerMaxHttpFormPostSize
so that should change so that it is more clear that the intent is to customize the ServletContextHandler
.
.to((maxHttpFormPostSize) -> customizeMaxHttpFormPostSize(factory, maxHttpFormPostSize)); | ||
.to((maxHttpFormPostSize) -> customizeServletContextHandler(factory, contextHandler -> contextHandler.setMaxFormContentSize(maxHttpFormPostSize))); | ||
map.from(properties::getMaxFormKeys) | ||
.when(this::isPositive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a copy/paste of the mapping above. I am not sure it applies equally for this property.
I encountered an issue in the project related to form submissions, where the number of keys exceeded Jetty's default limit of 1000. I found that there's no way to configure this parameter in the Spring Boot configuration file.
Although I achieved my goal by setting
org.eclipse.jetty.server.Request.maxFormKeys
, it doesn't feel like an ideal solution.May I submit a PR to add this configuration option?