[commit: Cabal] : Add an extra note about the http proxy decompression issue (38bd5ef)
Ian Lynagh
igloo at earth.li
Fri Jun 24 02:06:56 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch :
http://hackage.haskell.org/trac/ghc/changeset/38bd5efb2d6bffd638e0f94eeb16a6abab4ff1c1
>---------------------------------------------------------------
commit 38bd5efb2d6bffd638e0f94eeb16a6abab4ff1c1
Author: Duncan Coutts <duncan at haskell.org>
Date: Wed Oct 27 09:50:34 2010 +0000
Add an extra note about the http proxy decompression issue
>---------------------------------------------------------------
cabal-install/Distribution/Client/GZipUtils.hs | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/cabal-install/Distribution/Client/GZipUtils.hs b/cabal-install/Distribution/Client/GZipUtils.hs
index c969c11..e4ce1aa 100644
--- a/cabal-install/Distribution/Client/GZipUtils.hs
+++ b/cabal-install/Distribution/Client/GZipUtils.hs
@@ -25,11 +25,17 @@ import Codec.Compression.Zlib.Internal
-- that it is already decompressed. Caller should make sanity checks
-- to verify that it is not, in fact, garbage.
--
+-- This is to deal with http proxies that lie to us and transparently
+-- decompress without removing the content-encoding header. See:
+-- <http://hackage.haskell.org/trac/hackage/ticket/686>
+--
maybeDecompress :: ByteString -> ByteString
maybeDecompress bytes = foldStream $ decompressWithErrors gzipOrZlibFormat defaultDecompressParams bytes
where
-- DataError at the beginning of the stream probably means that stream is not compressed.
-- Returning it as-is.
+ -- TODO: alternatively, we might consider looking for the two magic bytes
+ -- at the beginning of the gzip header.
foldStream (StreamError DataError _) = bytes
foldStream somethingElse = doFold somethingElse
More information about the Cvs-libraries
mailing list