Skip to content

Conversation

@bartvanandel
Copy link

@bartvanandel bartvanandel commented Mar 3, 2025

Rebase middleware on current GzipMiddleware from Django 5.1.

This includes Heal The Breach (HTB), a guard against HTTPS BREACH attacks, and adds support for async responses.

With some minor changes to ensure backward compatibility with older Django versions. The earliest tested versions are Python 3.9 (current oldest non-EOL Python version) and Django 4.0 (which is actually already EOL).

Fixes #18

@bartvanandel bartvanandel changed the title Support async response Backport upstream changes from GzipMiddleware Mar 3, 2025
@bartvanandel
Copy link
Author

@friedelwolff Would you have time to take a look?

- Re-align CompressionMiddleware code with GzipMiddleware from Django 5.1. This adds support for async responses, and implements Heal The Breach (HTB), a guard against HTTPS BREACH attack - Apply some checks to ensure backward compatibility with older Django versions
@bartvanandel
Copy link
Author

Note: this will break support for ancient Django 3, but that one has been EOL for so long it doesn't even show up on endoflife.data/django by default. Hint: support for 3.2 LTS ended on 01 April 2024.

There's a PR regarding version support (#14) but at the moment this still includes Django 3.2. I'd suggest removing this as a supported version, updating django-compression-middleware won't be the highest priority for users who are still stuck with that version anyway.

@bartvanandel
Copy link
Author

@friedelwolff Are you still maintaining this package?

@mhindery
Copy link

mhindery commented Sep 10, 2025

I'm interested in having the async-compatible and up-to-date version as well. Since it does not look like @friedelwolff is maintaining this anymore, would it be an option to fork it and apply the open PR's to that new version? In the longer term, the project could be transfered to https://jazzband.co/ in order to hopefully make it easier for people to contribute? What do you think @bartvanandel , if you are still interested in contributing?

@bartvanandel
Copy link
Author

Absolutely, be my guest and take advantage of the code I've contributed, it was always intended to be used!

Personally, I'm not using this package at the moment. Lack of maintenance of various packages (and lack of responsiveness after contributing PRs etc) has been one of the reasons for us to move away from Django and Python in general. So, sounds to me like Jazzband could be a good initiative to actually keep things afloat.

@mhindery
Copy link

I have forked the project, and applied your diff to it (together with some other updates like in the other PR to bump some versions of Django and Python). Thanks!

It can be found on https://github.com/mhindery/dj-compression-middleware and is published on Pypi on https://pypi.org/project/dj-compression-middleware/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants