Release | Date | By | Comment |
---|---|---|---|
R1.01.147 | 2002-04-25 | U.Margull | First documentation of FlatCompression Filter |
R1.10.171 | 2002-06-20 | U.Margull | Preparing the FlatCompression for Open Source |
Thanks to 1 mal 1 Software GmbH, Fürth, Germay, who developed and donated the original filter software. The filter was developed for the FLATCAST video/audio streaming portal.
Design and programming was done by Uli Margull, with thanks to Johannes Welck, Martin Miller and the 20kBit Michael!
The FlatCompression filter is used to compress the entity of the http response.
The compression itself is done with the zlib library (www.zlib.org).
IMPORTANT: The ISAPI filter FlatComp.dll has to be installed as a IIS-wide ISAPI filter. This means, it can not used on a single virtual web presence, but only system-wide.
For default mode, no registry settings are necessary. The filter should work out-of-the-box. In the default mode, all responses with Content-Type: text/html are compressed.
Some of the filter behaviour can be changed by registry settings. These settings are found unter HKLM->Software->FlatCompression. The settings are:
Name | Type | Default | Description |
Flags | REG_DWORD | 0 | Special flags for filter behaviour. Right now the following
bitmasks are defined:
Bit 0: If set: Log each compression |
mime | REG_MULTISZ | text/ | Mime types that will be compressed. All entries that match
are compressed. The default value compresses all text/* mime types, e.g.
text/html, text/plain, text/css, etc.
A maximum of 5 entries will be used by the filter. |
The parameters are loaded when the filter starts (i.e. when IIS starts). A reload of the parameters can be forced by calling the following URL: /FlatCompression/InitFilter (case sensitive!). No http response is returned, the browser looks like hanged up afterwards.
Here are some of the questions I have already answered:
Yes, when compressing a static html page, one could cache the compressed response. The IIS5 does this, and it works pretty fine. If you need this feature, use the IIS5 compression filter (can be used additionally to the FlatCompression filter).
However, dynamic content cannot be cached since, well, its dynamic. The primary use of this filter is with dynamic content, and therefor no caching was implemented. Adding caching would involve be a complete redesign of the software, and at the moment, its not even on the to-do list. But this is open source, and if theres a demand, it will probably be done one day or another.
Well, if You dont know how to do this, better be careful and check the IIS manuals first.
Since the filter has to be installed as a system wide filter, heres a short description of how its done:
The filter looks at the incoming request. If the Accept-Encoding header contains 'gzip' or 'deflate', then the compression is activated. When the response is prepared by the server, the filter looks at the response, especially at the Content-Type. If the mime type of the response should be compressed, then a special header Content-Encoding: is added. The entity of the response then is compressed and the compressed entity is sent to the browser.
When sending a response to the browser, the content length has to be known. This is not known at first. Therefor, the complete header and the complete answer is cached in the filter. When the complete answer is available, it is compressed, the compressed size is added to the header, and the header as well as the compressed entity are sent to the browser.