spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Add setStrictServletCompliance parameter to config for StandardServletMultipartResolver

Open Gleydar opened this issue 3 years ago • 1 comments

Hi,

I am using multipart/mixed requests in my spring project and needed to configure the StandardServletMultipartResolver to have setStrictServletCompliance to be set to "true" to avoid it trying to parse the parts of the request. Parsing would cause a timeout/empty body when accessing via the InputStream due to the missing "name" field, depending on the circumstances.

I think this should be a good solution, as setResolveLazily wouldn't prevent access to the parts of the request and then causing the timeout later.

Would it possibly be a good idea to add the paramter to the config? I have prepared a fork including this change here, however, I'm unsure if I have added the parameter at the right place in the code.

Gleydar avatar Sep 15 '22 10:09 Gleydar

@Gleydar Thanks for raising this. Your changes look go to me so far. Would you like to update MultipartAutoConfigurationTests.java to test the new property and then open a pull request?

wilkinsona avatar Sep 16 '22 15:09 wilkinsona

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Sep 23 '22 15:09 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Sep 30 '22 15:09 spring-projects-issues

Sorry for not commenting sooner, I was kinda busy the last few weeks. I have added the test https://github.com/Gleydar/spring-boot/commit/96d6f1149152648601dc82af3c4cb5a37b1e28d1 here, but still have to validate that it actually works on my linux machine at home. Would you recommend more tests, or do you suppose that this method should suffice?

Gleydar avatar Oct 04 '22 14:10 Gleydar

Thanks for the update. I think that test will suffice.

wilkinsona avatar Oct 04 '22 14:10 wilkinsona

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Oct 11 '22 14:10 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Oct 18 '22 14:10 spring-projects-issues