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

Internal downloader throws ContentLengthError #1055

Open
hasufell opened this issue May 1, 2024 · 2 comments · May be fixed by #1077
Open

Internal downloader throws ContentLengthError #1055

hasufell opened this issue May 1, 2024 · 2 comments · May be fixed by #1077

Comments

@hasufell
Copy link
Member

hasufell commented May 1, 2024

$ ghcup --downloader=internal tui
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.8.yaml as file /home/hasufell/.ghcup/cache/ghcup-0.0.8.yaml
[============================================================================================================================================] 141%
ghcup: ContentLengthError Nothing (Just 98256) 69674
@dfordivam
Copy link
Contributor

The issue here is that the file is being sent as gzipped (content-encoding gzip), and the size comparison happens with the gzipped sized (specified in content-length), and the uncompressed size.

This check may be removed as the receiveResponse does uncompress internally (as described in haddocks of receiveResponseRaw)

receiveResponseRaw :: Connection -> (Response -> InputStream ByteString -> IO β) -> IO β

This is a specialized variant of receiveResponse that explicitly does not handle the content encoding of the response body stream (it will not decompress anything). Unless you really want the raw gzipped content coming down from the server, use receiveResponse.

@hasufell
Copy link
Member Author

hasufell commented Jun 4, 2024

Nice catch. Can you provide a PR?

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