Re: [hybi] Payload only compression extension, again

Greg Wilkins <gregw@intalio.com> Mon, 02 May 2011 09:27 UTC

Return-Path: <gregw@intalio.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CB0F0E070D for <hybi@ietfa.amsl.com>; Mon, 2 May 2011 02:27:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.918
X-Spam-Level:
X-Spam-Status: No, score=-2.918 tagged_above=-999 required=5 tests=[AWL=0.059, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SKRH3mmYRSQj for <hybi@ietfa.amsl.com>; Mon, 2 May 2011 02:27:33 -0700 (PDT)
Received: from mail-vx0-f172.google.com (mail-vx0-f172.google.com [209.85.220.172]) by ietfa.amsl.com (Postfix) with ESMTP id 42BDBE0680 for <hybi@ietf.org>; Mon, 2 May 2011 02:27:32 -0700 (PDT)
Received: by vxg33 with SMTP id 33so4795044vxg.31 for <hybi@ietf.org>; Mon, 02 May 2011 02:27:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.52.0.236 with SMTP id 12mr8251645vdh.223.1304328451889; Mon, 02 May 2011 02:27:31 -0700 (PDT)
Received: by 10.52.116.102 with HTTP; Mon, 2 May 2011 02:27:31 -0700 (PDT)
In-Reply-To: <4DB8D3B2.8090002@mozilla.com>
References: <AANLkTik2LqCC2-ZLLdWNNaQ18ypcQU_5djJobkYtYk6T@mail.gmail.com> <AANLkTik+uh98b0n7U=xrE0Aaa7MyBfZVXSwj+8wfVTKW@mail.gmail.com> <AANLkTinCtDepu+wDt4=8GyXqhfn=SQ7v2SjJhKzP2Mzr@mail.gmail.com> <AANLkTinhw0j5U_tvfCCrcEx=J6b7wBua4XzhWkvthUjL@mail.gmail.com> <BANLkTi=SjQwGQu-3v2wjniyp9DrQ1ZcQdA@mail.gmail.com> <BANLkTi=dqFN-57GV3rYDv4feTAaZFQko1g@mail.gmail.com> <BANLkTikWFwfs0FOuET5ZS1HEzjweNO0_CA@mail.gmail.com> <BANLkTikHXtVM+7nfz60toKTJCXBuMwMC1g@mail.gmail.com> <BANLkTinsMu+Znbg7Fe7+9HZeZg=Q8SwDHg@mail.gmail.com> <4DB8D3B2.8090002@mozilla.com>
Date: Mon, 02 May 2011 19:27:31 +1000
Message-ID: <BANLkTimE9qYEvBVLGbOsU7YDVGDwHpGjgA@mail.gmail.com>
From: Greg Wilkins <gregw@intalio.com>
To: Patrick McManus <pmcmanus@mozilla.com>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Payload only compression extension, again
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 02 May 2011 09:27:33 -0000

In jetty trunk I have an implementation of an extension I've called
x-deflate-frame for now.

It uses 1 reserve bit to indicate if the payload is compressed.
If the payload is compressed, then it is sent as:

    uncompressed-length  deflated-data

The uncompressed-length is encoded in the same format as the websocket
frame length.  The uncompressed length is sent so that a buffer may be
allocated before starting to inflate the data.

The extension supports a minLength parameter (default 64) and will not
attempt to compress payloads that are smaller than that length.

When compressing the data, if the combined uncompressed-length and
deflated-data is longer than the original data, then the original data
frame is sent instead.

Currently I'm just using the standard java Inflater/Deflater  gzip
classes with a reset between frames.  Not exactly sure what that means
with regards to the algorithm details that Takeshi has specified, but
I think they are close.

cheers