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

Support cases where the request is done with transfer-encoding chunked #589

Merged
merged 3 commits into from Apr 18, 2018

Conversation

jacksontj
Copy link
Contributor

PR #527 was put in place to fix an issue where an empty request body
would cause an empty message to be sent down to the GRPC service
(instead of failing). The fix at the time was to check that the
ContentLength was >0, but this doesn't take into consideration
transfer-encoding chunked POSTs. Since this patch all chunked POSTs
no longer unmarshal the message (as the content-length was 0).

My proposed fix is instead to always call Decode and simply ignore EOF
errors (as we still want to pass the un-filled struct down). I have
tested that things such as partial json blobs (something like '{') don'
t return EOF (they have their own json error).

@jacksontj
Copy link
Contributor Author

Looking at the CI failure it seems unrelated?

@achew22
Copy link
Collaborator

achew22 commented Apr 14, 2018

@jacksontj, yep. I fixed the CI just now. Could you rebase please?

@jacksontj
Copy link
Contributor Author

@achew22 rebased

@achew22
Copy link
Collaborator

achew22 commented Apr 15, 2018

This looks like a reasonable way to approach it. Do you think you could add some tests to that would have failed in the old system that pass in the new one?

@jacksontj
Copy link
Contributor Author

Added a test case for it, and rebased again (someone changed the template file ;) )

@jacksontj
Copy link
Contributor Author

@achew22 test added, CI is passing

@jacksontj
Copy link
Contributor Author

@achew22 ping (in case the last one got lost in the inbox :) )

@achew22
Copy link
Collaborator

achew22 commented Apr 18, 2018

I'm terribly sorry, would you be willing to rebase this change to master?

I made some significant changes to the Travis CI config I want to make sure this passes with them.

PR grpc-ecosystem#527 was put in place to fix an issue where an empty request body
would cause an empty message to be sent down to the GRPC service
(instead of failing). The fix at the time was to check that the
ContentLength was >0, but this doesn't take into consideration
transfer-encoding chunked POSTs. Since this patch all chunked POSTs
no longer unmarshal the message (as the content-length was 0).

My proposed fix is instead to always call Decode and simply ignore EOF
errors (as we still want to pass the un-filled struct down). I have
tested that things such as partial json blobs (something like '{') don'
t return EOF (they have their own json error).
@achew22
Copy link
Collaborator

achew22 commented Apr 18, 2018

It most definitely got lost in my inbox. Thanks so much for rebasing

@achew22 achew22 merged commit a5bcd11 into grpc-ecosystem:master Apr 18, 2018
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
grpc-ecosystem#589)

* Support cases where the request is done with transfer-encoding chunked

PR grpc-ecosystem#527 was put in place to fix an issue where an empty request body
would cause an empty message to be sent down to the GRPC service
(instead of failing). The fix at the time was to check that the
ContentLength was >0, but this doesn't take into consideration
transfer-encoding chunked POSTs. Since this patch all chunked POSTs
no longer unmarshal the message (as the content-length was 0).

My proposed fix is instead to always call Decode and simply ignore EOF
errors (as we still want to pass the un-filled struct down). I have
tested that things such as partial json blobs (something like '{') don'
t return EOF (they have their own json error).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants