[Haskell-cafe] Decompressing and http-enumerator
michael at snoyman.com
Mon Aug 29 10:08:39 CEST 2011
Erik just opened an issue on Github that affected me very recently
as well when writing some automated Hackage checking code. The
issue is that http-enumerator sees the content-encoding header and
decompresses the tarball, returning an uncompressed tarfile. I can
avoid this with rawBody = False, but that's not a real solution, since
that also disables chunked response handling.
So one possible solution is to just add an option to never decompress
response bodies, but that's a bit of a hack. The real question is:
what's the correct way to handle these tarballs? Web browsers seem to
know not to decompress them, but AFAICT http-enumerator is correctly
following the spec by decompressing. Another possibility is to
determine whether or not to decompress based on the content type,
using either a white or black list (e.g., never compress TAR files,
always decompress HTML files, etc).
I'm open to suggestions here.
More information about the Haskell-Cafe