IBM Research

Compressed Encoding Plugin

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.

Try It Out

  1. Set up the Plugin
    • Start WBI. Set up your web browser to use WBI as a proxy.
    • Register the Compressed Encoding plugin. At the WBI console, type (on one line)
      Alternatively you can register it using the Graphical User Interface.
    • You must also disable the NoGZip Plugin that is installed in WBI by default. You can do this at the WBI console with the disable command, or through the GUI with "disable" menu option.
    • Check to see whether the new plugin is registered and enabled and that the old one is disabled. Go to the WBI Setup page. The Compressed Encoding plugin should be listed in the table with a checkmark next to its name (and the NoGzip Plugin should not be checked). If the plugin is not listed, try registering it again. If the checkmark is not there, click on the box to the left of the plugin name.
    • Open another browser window. Use that window to try out the plugin, and use this window to display the documentation. (To open another window using Microsoft Internet Explorer, go to File -> New -> Window. To open a window using Netscape Navigator, go to File -> New -> Navigator Window.)

  2. Having Trouble?

What It Does

The 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.

Known Problems

  1. If you are adding your own plugins that have document editors with priority 100, these might not actually run before the DecompressEditor, and so you might win up with garbled data. The solution is to give your Megs priorities no higher than 99.
  2. We have seen this plugin not work on older version of Netscape (e.g., v. 4.06). It has been tested and works on Netscape 4.6 and above, and on Internet Explorer 5.

Some key WBI classes that were used:

HttpEditor Both the decompressor and the recompressor extend HttpEditor.
HttpResponse To do their jobs, the editors modify the response headers using this class.

The Source
Contains the entire plugin source.
Contains the necessary code to register the plugin with WBI. Registration is done through WBI during runtime.