Skip to content

Maximum Request Size handling support for Undertow in StandardMultipartHttpServletRequest #32549

@ghost

Description

Affects: <Spring Framework version> 6.1.5


Dear collegues I was following the discussions in 26096 and 31850 , but not see if we are going to have a support for Request Size (In CommonsMultipartResolver was FileUploadBase.SizeLimitExceededException).

It throws now Caused by: java.lang.IllegalStateException: io.undertow.server.RequestTooBigException: UT000020: Connection terminated as request was larger than 31457280. In case if the similiar check something in message which maybe not best idea can have some similiar check agains words 'request' and 'larger' and throws MaxUploadSizeExceededException as was in CommonsMultipartResolver

protected void handleParseFailure(Throwable ex) {	Throwable cause = ex;	do {	String msg = cause.getMessage();	if (msg != null) {	msg = msg.toLowerCase(); // checks against file maximum size	if (msg.contains("exceed") && (msg.contains("size") || msg.contains("length"))) {	throw new MaxUploadSizeExceededException(-1, ex);	} // checks against request maximum size if (msg.contains("request") && (msg.contains("larger")) { throw new MaxUploadSizeExceededException(-1, ex);	}	}	cause = cause.getCause();	}	while (cause != null);	// General MultipartException	throw new MultipartException("Failed to parse multipart servlet request", ex);	} 

Thanks in advance

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions