Windows Server - Compression, and disabling transfer-encoding of chunks

Asked By bill on 07-Nov-07 04:38 PM
The quick version of my question: Is there a way I can prevent IIS 6
from doing chunked transfer encoding?  I'm aware of the
AspEnableChunkedEncoding metabase property, and I've set it to FALSE
at several places in the server/site hierarchy in metabase.xml, yet I
still get chunked encoding (with response header Tranfer-Encoding:
chunked) and I'd like to disable that.

The long version: I have IIS 6 built-in compression working very
nicely... except when I put a Squid proxy between the browser and
IIS.  At first IIS stopped giving compression altogether because it
got http 1.0 requests from Squid, so I set both
HcNoCompressionForHttp10 and HcNoCompressionForProxies to FALSE.  IIS
then resumed sending compressed data back to Squid (I can see this in
Wireshark), but (I think) Squid mucks it up and by the time it gets
back to the browser it's useless (IE7 shows a server error, whereas
Firefox just displays nothing at all).  By sniffing between IIS and
Squid on the return trip, I can see the Transfer-encoding: chunked
header.  My understanding from Squid folks is that it's incapable of
handling Transfer-encoding.  So it would be nice to be able to test a
scenario wherein IIS6 still serves up compressed data, but does it
without chunking it.

Any ideas?

Thank you,

Anthony Jones replied on 07-Nov-07 05:05 PM
Hmm... weird.  Transfer-encoding: chunked is a HTTP/1.1 feature so it
shouldn't be used in a response to a HTTP/1.0 request.   The
AspEnableChunkedEncoding property applies to asp generated content so I
doubt it would affect other parts of IIS that may choose to use chunked
encoding when servicing a http/1.1 request.

Anthony Jones - MVP ASP/ASP.NET
David Wang replied on 08-Nov-07 05:43 AM
This just sounds like a bug in Squid.

How IIS sends compressed data depends on the type of compression
applied to it.
- Static Compression will send Content-Length + compressed data
(optionally cached on disk)
- Dynamic/Application Compression will send Transfer-Encoding: chunked
+ compressed data (and not cached).

You want to enable static compression and request a .htm file

The reason that IIS sends chunked encoding for Dynamic Compression --
IIS does not buffer application responses, so in order for it to
transparently compress application responses, it has to compress each
chunk on-the-fly as it is sent by the application, and only chunked
encoding handles this behavior.

Meanwhile, static compression applies to static, non-changing files --
where IIS can determine the content-length of the response which will
not dynamically change -- so IIS can cache these results to disk as
well as use content-length to indicate length of compressed response.