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 x-gzip as Accept-Encoding in Compression (#466) #467

Merged

Conversation

privettoli
Copy link
Contributor

Implements #466

Motivation

From #466

As developers migrate existing applications to Rust, ensuring seamless backward compatibility is crucial. Many of these applications already recognize "x-gzip" as a valid encoding for gzip. Adhering to RFC9110, which advises treating "x-gzip" as synonymous with "gzip", we can facilitate a smoother transition for these applications. This change streamlines the migration process and ensures that our Rust-based solutions remain backward compatible, fostering wider adoption and minimizing potential integration issues.

Solution

Added || s.eq_ignore_ascii_case("x-gzip") to content_encoding.rs:64 with additional tests:
1.
Should compress response with gzip
And return content-type: gzip
When accept-encoding is x-gzip
2.
Should compress response with gzip
When accept-encoding has both x-gzip and deflate
(to test that it's treated the same as gzip for ordering)

@privettoli
Copy link
Contributor Author

privettoli commented Feb 14, 2024

CI failures are due to changes in EmbarkStudios/cargo-deny-action#73

@privettoli
Copy link
Contributor Author

After fixing the CI action, the checks pass.

Copy link
Collaborator

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@jplatte jplatte merged commit e0192a3 into tower-rs:main Feb 15, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants