Skip to content

Stoping compression running twice#28

Open
rhysrevans3 wants to merge 2 commits intofullonic:masterfrom
rhysrevans3:prevent_multi_compression
Open

Stoping compression running twice#28
rhysrevans3 wants to merge 2 commits intofullonic:masterfrom
rhysrevans3:prevent_multi_compression

Conversation

@rhysrevans3
Copy link

@rhysrevans3 rhysrevans3 commented Apr 24, 2023

Prevent the compression from being run multiple times.

closes #29

@rhysrevans3 rhysrevans3 marked this pull request as draft April 24, 2023 10:29
@rhysrevans3 rhysrevans3 marked this pull request as ready for review April 24, 2023 10:41
@fullonic
Copy link
Owner

Hi @rhysrevans3! Thanks for your PR. I will review it as soon as I can. Cheers 👍

@z0z0r4
Copy link

z0z0r4 commented Jul 6, 2024

plz review it!

@fullonic
Copy link
Owner

I apologize for the delay. I forgot this PR. I will review it and release a new version next week

@jrobbins-LiveData
Copy link

Hi, I was wondering about the status of this?

@z0z0r4
Copy link

z0z0r4 commented Nov 29, 2024

I apologize for the delay. I forgot this PR. I will review it and release a new version next week

ping

await self.send(self.initial_message)
await self.send(message)
headers = MutableHeaders(raw=self.initial_message["headers"])
if "br" in headers.get("Content-Encoding", ""):
Copy link

@keul keul Feb 13, 2025

Choose a reason for hiding this comment

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

@rhysrevans3 I'm wondering: is OK here to check if there is the br compression explicitly, or should the middleware to prevent compressing again if there is any other compression? ("Content-Encoding" in headers)?

Copy link
Owner

Choose a reason for hiding this comment

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

This is a valid point. Because the main idea of this library is to be a drop-in replacement for the GZipMiddleware shipped with Starlette, I need to review the current state of the GZipMiddleware

https://github.com/Kludex/starlette/blob/main/starlette/middleware/gzip.py

@XChikuX
Copy link

XChikuX commented Sep 18, 2025

@fullonic Are you still active on this repo?

@fullonic
Copy link
Owner

I apologize for the delay and lack of communication. For personal reasons, I have not been able to dedicate more time to coding outside of my daily work. This has not changed much, but at work we are now using this library, and I will be able to maintain it as part of our stack if there are major issues. Adding support for 3.13 and 3.14 will be done as well.
I need to refresh myself on this issue, review possible updates in the library used by this one, and finally release a new version on PyPI.

@fullonic
Copy link
Owner

I have released a new version with support for the new Python version and dropped support for versions not supported by Starlette.

This one was left out of this new release because I couldn't pass the tests. I'm not sure in which scenarios it is doing double compression.

Also, when looking at the GZipResponder, I don't see this kind of safeguard against double compression.

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.

Multiple compressions when mounting with FastAPI

6 participants