RE: Header compression: buffer management

RUELLAN Herve <Herve.Ruellan@crf.canon.fr> Fri, 22 March 2013 13:55 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3A12921F8C7D for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Mar 2013 06:55:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.1
X-Spam-Level:
X-Spam-Status: No, score=-10.1 tagged_above=-999 required=5 tests=[AWL=0.149, BAYES_00=-2.599, HELO_EQ_FR=0.35, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sCZz-zJl4e-d for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Mar 2013 06:55:34 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 6EB9621F8B80 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 22 Mar 2013 06:55:34 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UJ2Qb-0003CQ-Uy for ietf-http-wg-dist@listhub.w3.org; Fri, 22 Mar 2013 13:54:41 +0000
Resent-Date: Fri, 22 Mar 2013 13:54:41 +0000
Resent-Message-Id: <E1UJ2Qb-0003CQ-Uy@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <Herve.Ruellan@crf.canon.fr>) id 1UJ2QQ-0003AN-RH for ietf-http-wg@listhub.w3.org; Fri, 22 Mar 2013 13:54:30 +0000
Received: from inari-msr.crf.canon.fr ([194.2.158.67]) by maggie.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <Herve.Ruellan@crf.canon.fr>) id 1UJ2QL-0005Ot-Nd for ietf-http-wg@w3.org; Fri, 22 Mar 2013 13:54:30 +0000
Received: from mir-bsr.corp.crf.canon.fr (mir-bsr.corp.crf.canon.fr [172.19.77.99]) by inari-msr.crf.canon.fr (8.13.8/8.13.8) with ESMTP id r2MDqajb000523; Fri, 22 Mar 2013 14:52:36 +0100
Received: from ADELE.crf.canon.fr (adele.fesl2.crf.canon.fr [172.19.70.17]) by mir-bsr.corp.crf.canon.fr (8.13.8/8.13.8) with ESMTP id r2MDqZ16006873; Fri, 22 Mar 2013 14:52:36 +0100
Received: from ADELE.crf.canon.fr ([::1]) by ADELE.crf.canon.fr ([::1]) with mapi id 14.02.0342.003; Fri, 22 Mar 2013 14:52:35 +0100
From: RUELLAN Herve <Herve.Ruellan@crf.canon.fr>
To: Amos Jeffries <squid3@treenet.co.nz>, "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Thread-Topic: Header compression: buffer management
Thread-Index: Ac4mKEB4rOwKdoC6QHy2X3WZpGsVggAFcOwAADEMCLA=
Date: Fri, 22 Mar 2013 13:52:35 +0000
Message-ID: <6C71876BDCCD01488E70A2399529D5E5163F3CD1@ADELE.crf.canon.fr>
References: <6C71876BDCCD01488E70A2399529D5E5163F39C4@ADELE.crf.canon.fr> <514B2330.2030807@treenet.co.nz>
In-Reply-To: <514B2330.2030807@treenet.co.nz>
Accept-Language: en-US, fr-FR
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [172.20.7.30]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Received-SPF: none client-ip=194.2.158.67; envelope-from=Herve.Ruellan@crf.canon.fr; helo=inari-msr.crf.canon.fr
X-W3C-Hub-Spam-Status: No, score=-4.6
X-W3C-Hub-Spam-Report: AWL=-2.073, RP_MATCHES_RCVD=-2.497
X-W3C-Scan-Sig: maggie.w3.org 1UJ2QL-0005Ot-Nd a63ffbdde7dc8b0200ff5615c2168230
X-Original-To: ietf-http-wg@w3.org
Subject: RE: Header compression: buffer management
Archived-At: <http://www.w3.org/mid/6C71876BDCCD01488E70A2399529D5E5163F3CD1@ADELE.crf.canon.fr>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17117
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

> -----Original Message-----
> From: Amos Jeffries [mailto:squid3@treenet.co.nz]
> Sent: jeudi 21 mars 2013 16:12
> To: ietf-http-wg@w3.org
> Subject: Re: Header compression: buffer management
> 
> On 22/03/2013 1:50 a.m., RUELLAN Herve wrote:
> > In HeaderDiff we chose to let the encoder decide how the buffer is
> managed (regarding additions and removals). These decisions are encoded
> on the wire and applied by the decoder on its own buffer. We think this
> choice has several advantages.
> 
> The encoder *will* at some point be a malicious attacker out to cause the
> decoder problems. Placing such an encoder in charge of buffer management
> at the decoder end of the wire is a sure-fire recipe for trouble. For anything
> like correct operation under such conditions it requires a pre-known buffer
> limit and enforcement of that limit at the decoder. Possibly with one size in
> the specs and a larger buffer size offered by the decoder for ongoing traffic
> (yes I can hear the cries about RTT lag already).

True, a malicious encoder could try to cause the decoder problems. But I think this is true for any encoder. Even HTTP/1.1 header format caused some vulnerabilities due to some whitespace handling.

Here, the decoder has only to check that the total buffer size is kept below the negotiated limit.

> > First, this allows to have a very simple and lightweight decoder: it only
> needs to decode the decisions made by the encoder and apply them. It has
> no need to effectively implements a LRU mechanism for its buffer. This is
> especially important for small devices with limited CPU.
> > In addition, we think it could be of interest for an intermediary, that could
> keep a partial buffer containing only the entries it is interested with, ignoring
> the other entries.
> 
> I notice that you are not making the same claim for encoder. All HTTP nodes
> will need both algorithms to follow the request+response model.
> How does the encoder+decoder as a pair stack up for size and complexity?

The case of the encoder is handled below. I started with the decoder because all HTTP nodes must implement a decoder able to handle any message sent to it. So the decoder will be roughly the same on a high-end workstation and on a low-power device.
Transmitting the buffer management information in the stream allows to have different implementations of the encoder, all compatible with any decoder. Therefore, an implementer can choose which kind of implementation he wants depending on its constraints (CPU, compaction ratio...). 


> > Second, this allows to adapt the buffer management to the context. While
> LRU is a good algorithm in the general case for deciding which entry to
> remove from the buffer, it may not be the best one for every specific case.
> More complex algorithms can probably be devised to improve the
> compaction (for example taking also into account the frequency of
> occurrence of headers), or simpler algorithms could be used to reduce the
> CPU cost to the detriment of compaction (this is important for small devices).
> > Adaptability is also important for the future of HTTP/2.0. If we do our job
> correctly, HTTP/2.0 will still be used in 10 or 20 years, but we have no idea
> how it will be used at that time. Making HTTP/2.0 adaptable to new usages is
> crucial to give it a long life expectancy.
> > For these reasons, we prefer to keep all the buffer management on the
> encoder side, allowing an implementer to choose its preferred approach.
> 
> Good reasons.
> 
> Amos

Hervé.