Spock icon indicating copy to clipboard operation
Spock copied to clipboard

Limiting the request size

Open dunnl opened this issue 8 years ago • 2 comments

requestSizeCheck modifies a request to embed size-checking inside the responseBody instead of performing the check immediately. (And I presume this is on purpose.)

My concern is the error handling suggests that the exception could be thrown at this line in handleRequest' but I don't think makeActionEnvironment forces the evaluation of the request body either. If it does though, then getErrorHandler config status413 is fed into respStateToResponse, which throw an error.

Thoughts?

dunnl avatar Mar 01 '17 18:03 dunnl

(Changed the title because initially I thought requestSizeCheck was the problem)

dunnl avatar Mar 01 '17 18:03 dunnl

The size check will be executed when the body is actually consumed and that's when the exception will trigger. It seems that you are correct that the exception will never be thrown at the line you mentioned. This was the case before as we already parsed the body there strictly before actually needing it. I guess one could remove the handler there.

agrafix avatar Mar 01 '17 20:03 agrafix