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

Proposal: add brotli middleware #1257

Open
justlorain opened this issue Jan 6, 2025 · 2 comments
Open

Proposal: add brotli middleware #1257

justlorain opened this issue Jan 6, 2025 · 2 comments
Assignees

Comments

@justlorain
Copy link
Member

justlorain commented Jan 6, 2025

Is your feature request related to a problem? Please describe.

  • Currently Hertz does not support brotli yet.
  • Brotli offers higher compression rates and better static content optimization compared to Gzip.

Describe the solution you'd like

Add brotli middleware

Additional context

A possible implementation: https://github.com/justlorain/brotli-hz

@xiaost
Copy link
Contributor

xiaost commented Jan 7, 2025

@justlorain sounds great and appreciate your effort!

would you like to share issues you found when implementing the package?
we're planning to extend our APIs for better integration with 3rd party encoding packages (like github.com/intel/fastgo, github.com/facebook/zstd etc.)
meanwhile, would like to keep hertz repo clean without introducing a new package.

@justlorain
Copy link
Member Author

justlorain commented Jan 7, 2025

@justlorain sounds great and appreciate your effort!

would you like to share issues you found when implementing the package? we're planning to extend our APIs for better integration with 3rd party encoding packages (like github.com/intel/fastgo, github.com/facebook/zstd etc.) meanwhile, would like to keep hertz repo clean without introducing a new package.

During the implementation, I referenced the gzip middleware implementation and maintained a consistent API as much as possible. My idea is to make brotli available as an optional middleware repo under hertz-contrib (just like gzip).

Or perhaps we need a higher-level package to integrate all compression algorithms supported by hertz (and dynamically select based on requests and settings), including gzip, brotli, and the zstd you mentioned.

@xiaost xiaost self-assigned this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants