First, let's define some commonly confused terms:
deflate = compression_algorithm;
zlib = header + deflate + trailer;
gzip = header + deflate + trailer;
I'm looking for a library that will basically let me do the following:
if(method == "gzip"){
Response.Filter = new CompressionLibrary.OutputStream(Response.Filter, CompressionLibrary.Formats.GZIP);
}
else if(method == "deflate"){
Response.Filter = new CompressionLibrary.OutputStream(Response.Filter, CompressionLibrary.Formats.DEFLATE);
}
else if(method == "zlib"){
Response.Filter = new CompressionLibrary.OutputStream(Response.Filter, CompressionLibrary.Formats.ZLIB);
}
I'm looking for a way to comparably test the 3 compression formats for use on the web. I would like for the deflate compression algorthims for each format to be the same exact implementation. I've already hacked away at zlib.net to force it to give me raw deflate on command (via an "undocumented feature")...however, adding the gzip header and trailer are little out of my league.
Anyone know of a .net library that does this?
Clarification:
HTTP 1.1's deflate compression format is actually the zlib compression format. Zlib is a wrapper around the deflate; it has a 2 byte header and a 4 byte trailer, always (when the compression methods and levels are identical).
Gzip uses the same compressed data format internally as zlib...which is deflate (raw deflate, not HTTP 1.1 deflate [which is zlib]). From my own preliminary testing, gzipped data is 11 out of 12 times larger than zlib.
deflate is a compression algorithm that is used to compress data. When there are no wrapper methods (e.g., headers or trailers) around deflated data, I call it "deflate" - perhaps I should have called it "raw deflate" instead.
I am doing an analysis of these compression methods and their support within web browsers and need to use a single compression method for all three types.