-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
client: set grpc-accept-encoding header based on outgoing compressor #3139
Conversation
|
@jiacai2050 this is only a partial fix of #2786. It only addresses the client-side, and only on the outbound path (i.e. it does not respect the server's accept-encoding headers). Also it only presents the compression method used when sending the RPC. The client may support other codecs, however: everything registered with the Are you seeing problems when this header is not set (before this change)? |
Yes, but this is the original logic. How can we get the accept-encoding sent by server's last response?
Yes, but it seems there is no way to get all codecs since registeredCodecs is package-private.
If this header isn't set, then the server will never send compressed response. |
This would have to be a new feature.
Correct. We could make this available to grpc's transport via the
That makes sense - you mean for interop with other grpc languages, right? I think the grpc-go server is missing the implementation to not send compressed if the client doesn't set this header. |
Yes, the server is built in rust. After digging into how grpc-go client receive msg, I find it use compression set for outbound msg to decompress response, Is there anything I'm missing?
|
I believe the code you found is fine. We set the decompressor based on the stream's header here: Lines 872 to 876 in 347a6b4
I will merge this PR as a short-term workaround for this issue, but we should not close #2786 yet as there are several more things needed. |
Apply this PR, the server will response with grpc-encoding whatever the client set. test via wireshark.
update #2786