This plugin provides another solution to the problem of handling gzip-encoded pages. Our first solution was to pre-install the NoGizpPlugin in WBI by default, which simply strips the outgoing requests of any indication that the browser can handle compressed responses. By contrast, the CompressedEncodingPlugin handles compressed data on the response side by simply uncompressing and recompressing the stream at the start and end of the Meg chain, respectively.
Compressed Encoding Plugin
Try It Out
What It DoesThe Compressed Plugin merely decompresses GZIP-encoded data if a server happens to provide some. Obviously, if you try to use a WBI document editor on compressed data, it will become garbled. Our first solution to this problem was to pre-install the NoGZipPlugin with WBI version 4.4. This plugin uses a request editor to strip lines like "accept-content-encoding: gzip" from outgoing headers. In this case, the server is less likely to actually send back compressed data.
The benefit of diabling the NoGZipEncodingPlugin and relying on the new CompressedPlugin is that you save network bandwidth and downloads might be quicker. Of course, the CompressedPlugin actually does the work of decompressing and recompressing the data, and so it might not actually be faster. In fact, if you are running WBI locally on your client machine, you might want to comment out the recompressing editor in the CompressedPlugin to save time.
How It Works
There are two document editors, one to decompress the data stream and the other to recompress it. The DecompressEditor is tied to a rule that keys on responses that have a header field like "content-encoding: gzip". This editor then changes the content-encoding of the response to "identity" and decompresses the data stream as it passes the data along. It also sets and extra rule key on the DocumentInfo of the response to indicate that this decompression has been performed.
The RecompressEditor keys on the extra rule key set by the DecompressEditor. The RecompressEditor simply sets the content-encoding back to "gzip" and compresses that data as it passes it along.
The DecompressEditor has the highest rule priority, 100, so that it is likely to run before other editors, whereas the RecompressEditor has the lowest priority, 1, so that it is likely to runmafter all other editors.
Some key WBI classes that were used: