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

StripesRequestWrapper ignores request's body when there is a "Transfer-Encoding: chunked" header instead of "Content-Length" when deciding to build the JsonContentTypeRequestWrapper #74

Open
juanpablo-santos opened this issue Jul 30, 2019 · 1 comment

Comments

@juanpablo-santos
Copy link
Contributor

Issue #51 stated StripesRequestWrapper asumes that a request with json content-type should always have a body, with pull #52 containing and
initial fix, which consisted in peeking into request.getReader() to see if the request contained a body or not.

Later on, this code was simplified to use instead request.getContentLength() to determine the request wrapper to use.

Fast-forward ~couple of years, we've stumbled upon a case in which there is a json body but there isn't a content-length header, which is when the Transfer-Enconding: chunked header is present on the request (i.e. a json structure with a base64 image exceding 8K size).

Suggested fix is to change line 126 on StripesRequestWrapper from:

} else if (contentType.toLowerCase().contains("json") && request.getContentLength() > 0) {

to:

} else if (contentType.toLowerCase().contains("json") && ( request.getContentLength() > 0 || "chunked".equals( request.getHeader( "Transfer-Encoding" ) ) ) ) {

I'd gladly prepare a PR with that, and would thank a lot if a new 1.7.0-beta5 release follows up with this, but don't know if it makes sense, as the Stripes' development seems to be staled :-?

thx in advance

@iluvtr
Copy link

iluvtr commented Jul 30, 2019 via email

juanpablo-santos added a commit to juanpablo-santos/stripes that referenced this issue Aug 6, 2019
juanpablo-santos added a commit to juanpablo-santos/stripes that referenced this issue Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants