SDCH #

"SDCH" stands for "Shared Dictionary Compression over HTTP". It is a protocol for compressing URL responses used when the server and the client share a dictionary that can be referred to for compression/encoding and decompression/decoding. The details of the SDCH protocol are specified in the spec (soon to be moved to github) but in brief:

  1. If the client supports SDCH decoding, it advertises "sdch" in the "Accept-Encoding" header.
  2. If the server could have encoded a response with a dictionary (but didn't, because the client didn't have the dictionary), it includes an advisory "Get-Dictionary: " header in its response.
  3. If the client has a dictionary that the server has previously advertised as being usable for encoding a particular requests, it advertises that dictionary as being available via an "Avail-Dictionary: " header in the request.
  4. If the server chooses to encode a response with a dictionary, it includes "sdch" in a "Content-Encoding" header, in which case the body will reference the dictionary to be used for decoding (which must be one the client advertised in the original request). Encodings may be chained; often responses are SDCH encoded, and then gzip encoded.

SDCH in Chromium: Overview #

The SDCH implementation in Chromium is spread across several classes in several different directories:

A net/ embedder should instantiate an SdchManager and an SdchOwner, and guarantee that the SdchManager outlive the SdchOwner.

Note the layering of the above classes:

  1. The SdchManager class has no knowledge of URLRequests. URLRequest is dependent on that class, not the reverse.
  2. SdchDictionaryFetcher is dependent on URLRequest, but is still a utility class exported by the net/ library for use by higher levels.
  3. SdchOwner manages the entire system on behalf of the embedder. The intent is that the embedder can change policies through methods on SdchOwner, while letting the SdchOwner class take care of policy implementation.

SDCH in Chromium: Debugging #

Data that is useful in debugging SDCH problems:

SDCH in Chromium: Gotchas and corner cases #

There are a couple of known issues in SDCH in Chromium that developers in this space should be aware of: