Skip to content

Deflator option to enable custom ones like zstd#2399

Merged
ioquatix merged 1 commit into
rack:mainfrom
alexanderadam:feat/deflater_option_for_custom_deflaters
Oct 31, 2025
Merged

Deflator option to enable custom ones like zstd#2399
ioquatix merged 1 commit into
rack:mainfrom
alexanderadam:feat/deflater_option_for_custom_deflaters

Conversation

@alexanderadam

@alexanderadam alexanderadam commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

I deleted my fork by accident and therefore I closed #2393 🫣
Here it is again:


Hi folks,

I hope that it is okay that I gave it a try? 🫣
Basically this is how I understood Jeremy's comment in the issue 2168.

The basic usage with Zstd would be

use Rack::Deflater, deflaters: {
  "zstd" => lambda { |headers, body| ZstdStream.new(body) }
}

Thank you so much for maintaining Rack! 🙏

PS: I'm looking for a new adventure in case anybody is looking to hire someone or in case someone would like to work with a Ruby/Rails/Crystal dev

@jeremyevans jeremyevans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still looks good, one minor simplification recommended.

Comment thread lib/rack/deflater.rb Outdated
@jeremyevans jeremyevans requested a review from ioquatix October 23, 2025 14:27
@alexanderadam alexanderadam force-pushed the feat/deflater_option_for_custom_deflaters branch from 0cf3206 to 31416dc Compare October 23, 2025 21:01

@ioquatix ioquatix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please update the changelog.

See also Jeremy's comment in the issue:

rack#2168 (comment)

Basic usage with Zstd (https://github.com/SpringMT/zstd-ruby)

use Rack::Deflater, deflaters: {
  "zstd" => lambda { |headers, body| ZstdStream.new(body) }
}

Multiple custom deflaters:

use Rack::Deflater, deflaters: {
  "zstd" => zstd_deflater,
  "br"   => brotli_deflater
}

refs rack#2168
@alexanderadam alexanderadam force-pushed the feat/deflater_option_for_custom_deflaters branch from 31416dc to 1965f18 Compare October 24, 2025 08:46
@alexanderadam

Copy link
Copy Markdown
Contributor Author

ah, right. ✔️ </done> 😉

Comment thread lib/rack/deflater.rb
@ioquatix ioquatix merged commit a133d18 into rack:main Oct 31, 2025
17 checks passed
@alexanderadam alexanderadam deleted the feat/deflater_option_for_custom_deflaters branch October 31, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants