ETags plus gzip compression equals trouble

Bug #261619 reported by Leonard Richardson
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Undecided
Leonard Richardson

Bug Description

launchpadlib requests gzipped representations by putting "gzip" in Accept-Encoding. Apache automatically compresses the representations and puts "gzip" in Content-Encoding. So far, so good. BUT, Apache also messes with the ETag.

ETag: "foo"

becomes

ETag: "foo"-gzip

On the second request, launchpadlib sends a conditional GET request with '"foo"-gzip' as If-None-Match. Launchpad doesn't recognize the "gzip" that Apache slapped on there, and so the conditional GET fails. The whole representation is served again, needlessly.

Bizarre as it sounds, Apache is almost totally compliant with the HTTP standard here. (The one violation is that "-gzip" should be inside the quotes: the modified ETag should be '"foo-gzip"'.) What we want to do on the client side is put "gzip" in the TE header, not Accept-Encoding. And we want the server to put "gzip" in the Transfer-Encoding header, not Content-Encoding. Only then is it okay to leave the ETag alone. But Apache doesn't support this.

There are a number of options for resolving this but we're not sure which to use.

Revision history for this message
Barry Warsaw (barry) wrote :

One thing we talked about was just turning off compression. I think this is most significant for the wadl file where Leonard reports we got 186k:15k compression ratio. Is that such a big deal?

Revision history for this message
Leonard Richardson (leonardr) wrote :

I've filed an RT request to turn off Apache's mod_compress on the api vhost, because none of the solutions we like involve mod_compress.

I'm going to implement compression inside LAZR, using the TE and Transfer-Encoding headers instead of the Accept-Encoding and Content-Encoding that mod_compress uses. Since the transfer encoding isn't part of the representation, you don't have to change the ETag when you apply it. It would be nice if mod_compress did this, since what it does now makes ETags useless for web service purposes, but it doesn't.

There's a chicken and egg problem with use of TE and Transfer-Encoding. But we control the server and the primary client, so we can afford to do it right.

Changed in launchpad:
status: New → Triaged
Revision history for this message
Leonard Richardson (leonardr) wrote :

Released a while ago.

Changed in launchpad-foundations:
assignee: nobody → leonardr
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.