You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StripesRequestWrapper ignores request's body when there is a "Transfer-Encoding: chunked" header instead of "Content-Length" when deciding to build the JsonContentTypeRequestWrapper
#74
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).
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
The text was updated successfully, but these errors were encountered:
Issue #51 <#51> stated StripesRequestWrapper
asumes that a request with json content-type should always have a body,
with pull #52 <#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
<9c13f96#diff-84fade24cb7c31fd8f98aa004bae573a>
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
<https://github.com/StripesFramework/stripes/blob/1.7.0-beta4/stripes/src/main/java/net/sourceforge/stripes/controller/StripesRequestWrapper.java#L126>
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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#74?email_source=notifications&email_token=AB4G64EYPAALCNIR3CF3BT3QCAH7LA5CNFSM4IH2WVKKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HCIIHHQ>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB4G64AJRCRSQJPG2WU2KK3QCAH7LANCNFSM4IH2WVKA>
.
Issue #51 stated
StripesRequestWrapper asumes that a request with json content-type should always have a body
, with pull #52 containing andinitial 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:
to:
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
The text was updated successfully, but these errors were encountered: