First steps

17 views
Skip to first unread message

Dave

unread,
Mar 17, 2009, 11:27:37 AM3/17/09
to SDCH
How do I decompress a HTTP response buffer encoded with SDCH? The
resposne was generated using IE7 and the Google Toolbar. Unzipping
the buffer I see the server ID as well as the response, but when I
pass that to vcdiff I'm getting a number of different errors depending
on what I try. For one, the dictionary specified appears to be
embedded in an archive, indexed with dictionaries.txt. Passing in
what seems to be the entire cached archive generates the following
error:

ERROR: Target data does not match checksum; this could mean that the
wrong dictionary was used

I assume I need to remove the 8 byte server ID and terminating null.
Do I also need to extract a subset dictionary from the archive?

Any help would be appreciated


Lincoln

unread,
Mar 17, 2009, 12:00:04 PM3/17/09
to SDCH
Hi Dave:

On Mar 17, 8:27 am, Dave <test1...@gmail.com> wrote:
> How do I decompress a HTTP response buffer encoded with SDCH?  The
> response was generated using IE7 and the Google Toolbar.  Unzipping
> the buffer I see the server ID as well as the response, but when I
> pass that to vcdiff I'm getting a number of different errors depending
> on what I try.  For one, the dictionary specified appears to be
> embedded in an archive, indexed with dictionaries.txt.  Passing in
> what seems to be the entire cached archive generates the following
> error:
>
> ERROR: Target data does not match checksum; this could mean that the
> wrong dictionary was used
>
> I assume I need to remove the 8 byte server ID and terminating null.

Yes, you need to remove the first nine bytes (the server ID and
terminating null character) from the response.

> Do I also need to extract a subset dictionary from the archive?

Yes. You will see that the first few lines of the dictionary file
contain SDCH headers such as "Domain:" and "Path:". After the last of
these headers, there will be a blank line. If you are trying to
decode the response by hand, you should remove all the headers plus
the blank line, and use the remaining file contents as the
dictionary. It is better to use a command like "tail --lines=+4" to
remove the first few lines rather than using a text editor, because a
text editor will sometimes try to add or remove line-feed characters
and so corrupt the dictionary.

lincoln

Jim Roskind

unread,
Mar 17, 2009, 12:56:51 PM3/17/09
to SD...@googlegroups.com
If you read C++, you can also look at the chromium implementation which is built atop Lincoln's Open-VCDIFF.  For example, take a look at the following to see a series of calls to process data (after it is gunzipped):


Pay especially close attention to:

Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
                                                  int* dest_len) {... }
which translates data from a pre-filled buffer in a member variable and puts the decoded results into the supplied dest_buffer.

There is some related support code in:


Finally, there is some support code for handling dictionaries in:


Hopefully those URLs will give you enough insight that you'll be able navigate further as needed in the codebase.

Hope that helps,

Jim
Reply all
Reply to author
Forward
0 new messages