-
Notifications
You must be signed in to change notification settings - Fork 4
Set default accept-encoding to compression algorithms supported by the client #71
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
Conversation
…e client Signed-off-by: Achille Roussel <[email protected]>
anuraaga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This indeed looks like a bug
src/connectrpc/_compression.py
Outdated
| This excludes 'identity' since it's an implicit fallback, and returns | ||
| only compressions that are actually available (i.e., their dependencies are installed). | ||
| """ | ||
| preferred_order = ["gzip", "br", "zstd"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this out of the function, maybe DEFAULT_ACCEPT_ENCODING_COMPRESSIONS
src/connectrpc/_compression.py
Outdated
| only compressions that are actually available (i.e., their dependencies are installed). | ||
| """ | ||
| preferred_order = ["gzip", "br", "zstd"] | ||
| return [name for name in preferred_order if name in _compressions] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about returning the joined string without the intermediate list? A microoptimization, but the list is only benefiting the unit test currently IIUC
Signed-off-by: Achille Roussel <[email protected]>
|
Thanks for the review @anuraaga, I addressed your feedback! |
Signed-off-by: Anuraag Agrawal <[email protected]>
|
Thanks as always @achille-roussel - will see how it goes with the holidays but will try to get this released soon |
I observed content encoding negotiation issues that I believe was caused by the connect-python client having a hardcoded list of supported encodings despite not necessarily having the corresponding modules loaded. This PR should address it by generating the default Accept-Encoding header based on what the client supports, as detected dynamically at run time.