Navigation Menu

Skip to content
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

It is unclear that server.tomcat.max-http-post-size and server.jetty.max-http-post-size only apply to POSTed form content #18521

Closed
fg8dgrdh opened this issue Oct 6, 2019 · 16 comments
Labels
status: superseded An issue that has been superseded by another type: bug A general bug

Comments

@fg8dgrdh
Copy link

fg8dgrdh commented Oct 6, 2019

The documentation describes the following:

server.tomcat.max-http-post-size=2MB # Maximum size of the HTTP post content.

However this setting only affects post requests with FORM content, not all post requests. This can lead to confusion for myself and others (as per stackoverflow questions). A more precise description would be helpful, such as:

server.tomcat.max-http-post-size=2MB # Maximum size of the FORM content in an HTTP post request. Non-FORM post requests are unaffected by this property.
@sbrannen
Copy link
Member

sbrannen commented Oct 6, 2019

@fg8dgrdh, this is the issue tracker for the core Spring Framework.

For Spring Boot, please use the following issue tracker: https://github.com/spring-projects/spring-boot/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc

Or perhaps @snicoll or @philwebb can transfer this issue.

@sbrannen sbrannen closed this as completed Oct 6, 2019
@snicoll
Copy link
Member

snicoll commented Oct 6, 2019

Or perhaps @snicoll or @philwebb can transfer this issue.

Yes we can but please give us a bit of time to act on it before closing.

@snicoll snicoll reopened this Oct 6, 2019
@snicoll snicoll transferred this issue from spring-projects/spring-framework Oct 6, 2019
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 6, 2019
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 6, 2019
@wilkinsona wilkinsona added this to the 2.1.x milestone Oct 6, 2019
@rhamedy
Copy link
Contributor

rhamedy commented Oct 6, 2019

@snicoll can I make a PR for this?

@snicoll
Copy link
Member

snicoll commented Oct 6, 2019

Thanks for the offer. The issue has been triaged and isn't assigned at the moment so feel free to do it

@rhamedy
Copy link
Contributor

rhamedy commented Oct 6, 2019

Updated the Javadoc in the ServerProperties.java, not sure if there is anything else that needs to be done.

rhamedy added a commit to rhamedy/spring-boot that referenced this issue Oct 7, 2019
Changed the javadoc for server.tomcat.max-http-post-size to clarify that
the 2MB maximum size limit only applies to POST request with FORM content.

Fixes spring-projectsgh-18521
@wilkinsona
Copy link
Member

wilkinsona commented Oct 7, 2019

We have a similar problem with Jetty. The property, server.jetty.max-http-post-size, is described as "Maximum size of the HTTP post or put content" but it maps onto setMaxFormContentSize and is specific to POSTed form content. As far as I can tell, content sent as a PUT is not affected.

Undertow is also affected but the problem is different. The property, server.undertow.max-http-post-size, is described as "Maximum size of the HTTP post content. When the value is -1, the default, the size is unlimited". It maps onto Undertow.MAX_ENTITY_SIZE which isn't limited to form content but also isn't limited to POST requests. The property would be better named something like server.undertow.max-http-entity-size.

Given that we need to deprecate server.undertow.max-http-post-size and provide a replacement, I wonder if we should do similar for server.jetty.max-http-post-size and server.tomcat.max-http-post-size. max-http-form-post-size would perhaps be a more accurate name.

@wilkinsona wilkinsona added the for: team-attention An issue we'd like other members of the team to review label Oct 7, 2019
@fg8dgrdh
Copy link
Author

fg8dgrdh commented Oct 9, 2019

@sbrannen Sorry about opening the issue in the wrong project, I'll try and be more careful next time.

@snicoll Thanks for transferring the ticket, I appreciate it.

@rhamedy Thanks for the PR!

@wilkinsona I like the max-http-form-post-size idea

@rhamedy
Copy link
Contributor

rhamedy commented Oct 9, 2019

IMO, deprecation seem to be the more suiting fix based on wikinsona’s explanation.

Regardless, I would be happy to re-purpose the PR should the scope of this issue change 👌

@wilkinsona
Copy link
Member

#18555 is related to, or maybe even a duplicate of, the Undertow aspects of this.

@philwebb philwebb added type: bug A general bug and removed for: team-attention An issue we'd like other members of the team to review type: documentation A documentation update labels Oct 11, 2019
@wilkinsona
Copy link
Member

wilkinsona commented Oct 11, 2019

We're going to introduce new properties in 2.1.x:

  • server.jetty.max-http-form-post-size
  • server.tomcat.max-http-form-post-size

We'll deprecate the old, misleadingly named properties at the same time.

We'll use #18555 to figure out the Undertow side of this once we know if the multipart config element behaviour is intentional or a bug.

@rhamedy
Copy link
Contributor

rhamedy commented Oct 12, 2019

@wilkinsona aren't they already named that way? 😕

// server.jetty.max-http-post-size
private DataSize maxHttpPostSize = DataSize.ofBytes(200000);

// server.tomcat.max-http-post-size
private DataSize maxHttpPostSize = DataSize.ofMegabytes(2); //tomcat

I could update my PR and base it off 2.1.x branch 🙂

@wilkinsona
Copy link
Member

Sorry, I meant to include form in the new names. I've updated my comment above.

@wilkinsona wilkinsona changed the title Imprecise description of server.tomcat.max-http-post-size It is unclear that server.tomcat.max-http-post-size and server.jetty.max-http-post-size only apply to POSTed form content Oct 14, 2019
@wilkinsona
Copy link
Member

Closing in favour of #18566.

@wilkinsona wilkinsona removed this from the 2.1.x milestone Oct 14, 2019
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Oct 14, 2019
rhamedy added a commit to rhamedy/spring-boot that referenced this issue Oct 16, 2019
…ments

Due to the unclarity that properties server.tomcat.max-http-post-size 
and server.jetty.max-http-post-size only apply to POSTed form content, the 
two properties are deprecated in favor of newly introduced server properties 
server.tomcat.max-http-form-post-size & server.jetty.max-http-form-post-size.

Fixes spring-projectsgh-18521
rhamedy added a commit to rhamedy/spring-boot that referenced this issue Oct 17, 2019
Due to the unclarity that properties server.tomcat.max-http-post-size 
and server.jetty.max-http-post-size only apply to POSTed form content, the 
two properties are deprecated in favor of newly introduced server properties 
server.tomcat.max-http-form-post-size & server.jetty.max-http-form-post-size.

Fixes spring-projectsgh-18521
@HimanshuChugh2
Copy link

Hello,

i have tried writing this

@Bean  
    public TomcatServletWebServerFactory tomcatEmbedded() {  

		TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();  

        tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {  
            if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<?>)) {  
                //-1 means unlimited  
                ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(100000000);  
                
                ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSavePostSize(100000000);
            }  
        });  

        return tomcat;  
    }
	

and this in application.properties file

# Server properties
server.tomcat.max-http-post-size=100000000
server.tomcat.max-swallow-size=100000000

it is still not passing text(json which includes base64 text too) of more then 2MB from html to controller.

Why is this happening?

Please help

@wilkinsona
Copy link
Member

Unfortunately, I can't say why it's happening from a couple of code snippets. We need to see more of your application – for example exactly how the browser is sending the information to the controller – but a closed issue isn't the right place. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. If you believe that you've found a bug, and you would like us to spend some more time investigating, please open a new issue and spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to the issue that you open.

@HimanshuChugh2
Copy link

Hello sir @wilkinsona ,

i have created a new issue(#22724), kindly requesting you to take a look.

Thank you so much in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants