You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a ranged request, Chrome sends the accept-encoding header as identity;q=1, *;q=0
While the *;q=0 is redundant with identity;q=1 since identity is always acceptable, it causes flask-compress to fallback to any and improperly compress the response, resulting in ERR_CONTENT_DECODING_FAILED in Chrome.
A simple fix would be to simply if algo=='*' and not quality: continue or also require quality for fallback_to_any in _choose_compress_algorithm.
A more robust/proper approach would be to add identity as an enabled algorithm and then also check for chosen_algorithm == 'identity' in after_request to skip compression.
Hello, thanks for the PR! Indeed a few small things are wrong the current code:
we should not allow fallback_to_any when the associated q=0
algo = '*' should not be passed to algos_by_quality
identity is not handled
I pushed a few commits that fix this. I did not merge your PR since it broke a few tests. Can you please confirm this works for you? I will make a release then.
For a ranged request, Chrome sends the accept-encoding header as
identity;q=1, *;q=0
While the
*;q=0
is redundant withidentity;q=1
since identity is always acceptable, it causes flask-compress to fallback to any and improperly compress the response, resulting in ERR_CONTENT_DECODING_FAILED in Chrome.A simple fix would be to simply
if algo=='*' and not quality: continue
or also requirequality
forfallback_to_any
in_choose_compress_algorithm
.https://github.com/colour-science/flask-compress/blob/master/flask_compress.py#L118-L136
A more robust/proper approach would be to add
identity
as an enabled algorithm and then also check forchosen_algorithm == 'identity'
inafter_request
to skip compression.https://github.com/colour-science/flask-compress/blob/master/flask_compress.py#L167-L174
The text was updated successfully, but these errors were encountered: