Skip to content

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

Description

@juanpablo-santos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions