-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: add auto_encoding
and improve send_compressed
behavior
#2058
Open
m62624
wants to merge
7
commits into
hyperium:master
Choose a base branch
from
m62624:feature/compression-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Nov 19, 2024
-
feat(fix): added auto_encoding and corrected default compression beha…
…vior The service was initially configured to send compressed data only in Gzip format. Different clients requested varying compression algorithms (e.g., Gzip and Zstd). Logs showed the following behavior: 1. Client 1 requested Gzip: ``` Server received request: data="gzip", headers=MetadataMap { headers: {"te": "trailers", "content-type": "application/grpc", "grpc-encoding": "gzip", "grpc-accept-encoding": "gzip,identity", "user-agent": "tonic/0.13.0"} } Server sending response: gzip Responding with gzip compression ``` 2. Client 2 requested Zstd: ``` Server received request: data="zstd", headers=MetadataMap { headers: {"te": "trailers", "content-type": "application/grpc", "grpc-encoding": "gzip", "grpc-accept-encoding": "zstd,identity", "user-agent": "tonic/0.13.0"} } ``` It is clear that clients requested different encoders using `grpc-accept-encoding`. **Expected behavior:** - The server should select a compression algorithm from the intersection of the supported algorithms from the server and the client. - If the client requests a compression algorithm not supported by the server, the server should either use `identity` (no compression) or return a `UNIMPLEMENTED` status. **Actual behavior:** If any `send_compressed` configuration was set for the service, the `from_accept_encoding_header` method was triggered regardless of the `grpc-accept-encoding` header provided by the client. The function responsible for compression selection on the server did not respect `send_compression_encodings`. The server defaulted to the first supported compression algorithm from `grpc-accept-encoding` without checking if the algorithm was allowed by `send_compression_encodings`. **Resolution:** - If `send_compressed` is not specified, the server defaults to `identity`. - If `send_compressed` is specified, the server only compresses responses for clients explicitly requesting a supported algorithm. **Feature:** The `auto_encoding` mechanism was added. This allows the server to automatically select a compression algorithm supported by the client without requiring explicit configuration of `send_compressed` on the server. The server dynamically adjusts compression behavior, ensuring compatibility with client preferences for efficient communication.
Configuration menu - View commit details
-
Copy full SHA for b094032 - Browse repository at this point
Copy the full SHA b094032View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3872fcf - Browse repository at this point
Copy the full SHA 3872fcfView commit details -
Configuration menu - View commit details
-
Copy full SHA for df50a79 - Browse repository at this point
Copy the full SHA df50a79View commit details
Commits on Nov 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e1a86e1 - Browse repository at this point
Copy the full SHA e1a86e1View commit details
Commits on Nov 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7c4559f - Browse repository at this point
Copy the full SHA 7c4559fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e681d4 - Browse repository at this point
Copy the full SHA 0e681d4View commit details
Commits on Nov 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b1d7088 - Browse repository at this point
Copy the full SHA b1d7088View commit details
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.