Use response headers x-grpc-request-type and x-grpc-gateway-body to etermine when to close the request writer #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a preliminary PR suggesting a method of detecting which type of method (Unary, ServerStreaming, ClientStreaming, DuplexStreaming) grpc-gateway is serving, and whether or not it expects a body.
The grpc-gateway implementation was very liberal with the data it accepted.
In case of Unary and ClientStreaming messages:
body
annotation is definedbody
annotation is not definedThis caused a context leak when clients sent more data than was expected by the gateway.
Then grpc-gateway added a blocking connection drain for Unary method with no
body
annotation defined, which broke grpc-websocket-proxy - since it never closed thereq.Body
, the method never triggered at all.There is work underway to do implement stricter request checking for Unary and ClientStreaming messages in general, which would break grpc-websocket-proxy as-is.
A possible solution would be to add the following metadata in response headers:
Then, grpc-websocket-proxy could do the following:
Before this is merged, this PR needs to be merged, and grpc-gateway version updated in go.mod: