Skip to content

Prevent FilteredCompressHandler from compressing an already compressed response#5337

Closed
syeopite wants to merge 1 commit intoiv-org:masterfrom
syeopite:fix-filtered-compress-handler
Closed

Prevent FilteredCompressHandler from compressing an already compressed response#5337
syeopite wants to merge 1 commit intoiv-org:masterfrom
syeopite:fix-filtered-compress-handler

Conversation

@syeopite
Copy link
Copy Markdown
Member

@syeopite syeopite commented Jun 4, 2025

This changes its behavior to align with the stdlib variant in that compression is now delayed till the moment that the server begins to send a response.

This allows the handler to avoid compressing empty responses,and safeguards against any double compression of content that may occur if another handler decides to compressi ts response.

This does however come at the drawback(?) of it now removing content-length headers on requests if it exists; since compression makes the value inaccurate anyway.

See: crystal-lang/crystal#9625

This changes its behavior to align with the stdlib variant in that
compression is now delayed till the moment that the server begins to
send a response.

This allows the handler to avoid compressing empty responses,and
safeguards against any double compression of content that may occur
if another handler decides to compressi ts response.

This does however come at the drawback(?) of it now removing
`content-length` headers on requests if it exists; since compression
makes the value inaccurate anyway.

See: crystal-lang/crystal#9625
Comment on lines 65 to 66
exclude ["/videoplayback", "/videoplayback/*", "/vi/*", "/sb/*", "/ggpht/*", "/api/v1/auth/notifications"]
exclude ["/api/v1/auth/notifications", "/data_control"], "POST"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Its pretty weird that we're excluding the notification streams endpoints and /data_control from having their responses compressed

@syeopite syeopite changed the title Refactor FilteredCompressHandler to inherit from stdlib Prevent FilteredCompressHandler from compressing an already compressed response Jul 18, 2025
@unixfox unixfox closed this in #5266 Sep 8, 2025
@syeopite syeopite deleted the fix-filtered-compress-handler branch September 11, 2025 23:33
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.

1 participant