<p><br>
On Aug 29, 2011 9:39 PM, &quot;Michael Snoyman&quot; &lt;<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Mon, Aug 29, 2011 at 2:21 PM, Gregory Collins<br>
&gt; &lt;<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>&gt; wrote:<br>
&gt; &gt; On Mon, Aug 29, 2011 at 10:08 AM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>&gt; wrote:<br>
&gt; &gt;&gt; Hi all,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Erik just opened an issue on Github[1] that affected me very recently<br>
&gt; &gt;&gt; as well when writing some automated Hackage checking code[2]. The<br>
&gt; &gt;&gt; issue is that http-enumerator sees the content-encoding header and<br>
&gt; &gt;&gt; decompresses the tarball, returning an uncompressed tarfile. I can<br>
&gt; &gt;&gt; avoid this with rawBody = False, but that&#39;s not a real solution, since<br>
&gt; &gt;&gt; that also disables chunked response handling.<br>
&gt; &gt;<br>
&gt; &gt; A web server should not be setting &quot;Content-encoding: gzip&quot; on a<br>
&gt; &gt; .tar.gz file. I agree that http-enumerator is correctly following the<br>
&gt; &gt; spec by decompressing.<br>
&gt; &gt;<br>
&gt; &gt; If you decide to implement a workaround for this, the only reasonable<br>
&gt; &gt; thing I can think of is adding a &quot;ignoreContentEncoding&quot; knob the user<br>
&gt; &gt; can twiddle to violate spec.<br>
&gt;<br>
&gt; I&#39;m wondering what the most appropriate way to handle this is. Maybe a<br>
&gt; dontDecompress record, looking like:<br>
&gt;<br>
&gt;    type ContentType = ByteString<br>
&gt;    dontDecompress :: ContentType -&gt; Bool<br>
&gt;<br>
&gt; Then browser behavior would be:<br>
&gt;<br>
&gt;    browserDecompress = (== &quot;application/x-tar&quot;)<br>
&gt;<br>
&gt; and current behavior would be:<br>
&gt;<br>
&gt;    defaultDecompress = const False<br>
&gt;<br>
&gt; I don&#39;t have any strong opinions here...<br>
&gt;</p>
<p>I agree with Gregory&#39;s suggestion of an API that allows an application to see the data prior to decoding the Content-Encoding. It could be tagged with the name of the content-coding, and there could be a generic decode function (ie. the library already knows what needs to be done to decode, so there&#39;s no need for the application to go looking up the decode  function by name).</p>



<p>Conrad.</p>