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

invalid header check when Content-Encoding: deflate and it's raw deflate. #34

Closed
danielgindi opened this issue Nov 22, 2021 · 3 comments · Fixed by #35
Closed

invalid header check when Content-Encoding: deflate and it's raw deflate. #34

danielgindi opened this issue Nov 22, 2021 · 3 comments · Fixed by #35

Comments

@danielgindi
Copy link
Contributor

Should be using zlib.createInflateRaw.

@sindresorhus
Copy link
Owner

Why?


Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header.

@danielgindi
Copy link
Contributor Author

danielgindi commented Nov 22, 2021

Why?


Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header.

Because this method detects based on the binary header.
But I encountered deflate responses without headers, which only inflateRaw could parse.
If the Content-Encoding says deflate, then we do not need to auto-detect, we already know the answer.

@sindresorhus
Copy link
Owner

The problem is that you cannot always trust the content encoding either (internet reality is messy). It's generally safer to rely on the binary header. But I guess the code could fall back to inflatRaw if Content-Encoding: deflate and unzip fails.

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

Successfully merging a pull request may close this issue.

2 participants