Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport of #424 (was: deflate'd response: use RFC compliant decompression by default) #426

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

d70-t
Copy link
Contributor

@d70-t d70-t commented Feb 11, 2021

This is a backport of #424 onto the 1.8-branch as suggested in #425

RFC7230 specifies
that

The "deflate" coding is a "zlib" data format RFC1950 containing a
"deflate" compressed data stream RFC1951 that uses a combination of
the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.

but also

  Note: Some non-conformant implementations send the "deflate"
  compressed data without the zlib wrapper.

Thus deflate coded data should be expected to be received within a
"zlib" container, however if no container is present, the data shouldn't
be rejected.

This patch tries to decode that data using RFC7230 conformant decoding
and falls back to unwrapped decoding only if the previous attempt didn't
work.

[RFC7230](https://tools.ietf.org/html/rfc7230#section-4.2.2) specifies
that

>   The "deflate" coding is a "zlib" data format [RFC1950](https://tools.ietf.org/html/rfc1950) containing a
>   "deflate" compressed data stream [RFC1951](https://tools.ietf.org/html/rfc1951) that uses a combination of
>   the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.

but also

>       Note: Some non-conformant implementations send the "deflate"
>       compressed data without the zlib wrapper.

Thus deflate coded data should be expected to be received within a
"zlib" container, however if no container is present, the data shouldn't
be rejected.

This patch tries to decode that data using RFC7230 conformant decoding
and falls back to unwrapped decoding only if the previous attempt didn't
work.
Copy link
Member

@mmerickel mmerickel left a comment

Choose a reason for hiding this comment

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

@d70-t This looks great. Could you please add a note to the changelog?

@d70-t
Copy link
Contributor Author

d70-t commented Feb 11, 2021

Sure, thanks for the reminder.

@digitalresistor digitalresistor merged commit be7f33f into Pylons:1.8-branch Feb 11, 2021
@digitalresistor
Copy link
Member

Thanks, will cut a release in the next couple of days.

@d70-t d70-t deleted the 424_backport branch February 11, 2021 23:44
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.

None yet

3 participants