Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)

Takeshi Yoshino <tyoshino@google.com> Mon, 24 February 2014 21:32 UTC

Return-Path: <tyoshino@google.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1A2511A026A for <hybi@ietfa.amsl.com>; Mon, 24 Feb 2014 13:32:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.325
X-Spam-Level:
X-Spam-Status: No, score=-1.325 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_47=0.6, RP_MATCHES_RCVD=-0.547, SPF_PASS=-0.001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7c2mnm_qpbWp for <hybi@ietfa.amsl.com>; Mon, 24 Feb 2014 13:32:08 -0800 (PST)
Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by ietfa.amsl.com (Postfix) with ESMTP id 2C77E1A026D for <hybi@ietf.org>; Mon, 24 Feb 2014 13:32:07 -0800 (PST)
Received: by mail-wg0-f49.google.com with SMTP id y10so5268048wgg.16 for <hybi@ietf.org>; Mon, 24 Feb 2014 13:32:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=cBOhQl278ty6L0GYU23sJ73nQsqQUVwyUozCY/cz200=; b=f7VOc96XCpYfliYZSlhQtwlJ48wos5g5OarWzOrLh+L7x2c4eL9bSStk5r4FbdmlFz LGywB9e+n+9HBNo358xXygaMImxvVwuFnsCfQeZSwpnouMD60jS76/agGuKlV/QBKEmM WJc2UYkQXfuyaIWf4G1tnF/ZzHrPI0ix2sCc2rTcmqmqPt/HnV6NpVfDNc4+IHlBNWol 0MnsFYrj+W6Y0iJpICvRgQOjXWz7AtBY6TpxAGS9ZBgKdXQOXzBRboDgeCBKoJ5YYaBh GSoGzCp19ISVsxRkXIME6qoE1ruOavzpdXJS7AMg9pdyrNj73MIcPjqtlXtLV00kqyKE mL1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=cBOhQl278ty6L0GYU23sJ73nQsqQUVwyUozCY/cz200=; b=Ic7+oDqdtPeHpN6QvrjqSkNwDUjKwkut+6ttarkERQ/Blgz+pZIAVnmjMPdXnm+XH+ bNZbY/Yk6nV85LrPI6EEuVFHJWFJ9tILFyBgI8gQeLWcmlVjjyDeXrNpd5wg513Noz6R K87Pd1rxvTpKM0G4hFHYoAcd8YilCQ9lZ2UqISvED6bKc/vAkFJcHigbgB4HF40dNZHB hPEyhIsNP0DQZ6vIKNaMsYPcQ+YTIG4WuPeBJ5anl8Hq6Z3RFJ8M7O5+t/PU7tLtYFDU OlfKWpaELLIGRX8+OqcMlOMnFZapS1gDetntPdEqs7CNjWXW2lRCM90ezk1WTkPblcBZ o5Wg==
X-Gm-Message-State: ALoCoQkGUmQ5QWgFCigeN74VYpW/RuXDzOc9d+/nR0jmE69P5BNH8exl1lzaaJnCKEolyTmQjz0Ipn7d6f7zJdXUmIhFVHedzSivTShEIIleqG2c6CJFFo6hWBs2wWiWD4C2+5WtccyD7bXoftQ7IVSXiyXFjhyiOrsUP0IbLEUpXD/JnugDshIQi/430cOmz5qqHpf4HNTa
X-Received: by 10.181.13.11 with SMTP id eu11mr16049709wid.30.1393277526927; Mon, 24 Feb 2014 13:32:06 -0800 (PST)
MIME-Version: 1.0
Received: by 10.194.8.231 with HTTP; Mon, 24 Feb 2014 13:31:46 -0800 (PST)
In-Reply-To: <CAGzyod6isscjV6TD=2DUo_dTSDRZxz6Mzmr7MbYNATwFPE7HXA@mail.gmail.com>
References: <CAH9hSJbf_ABT7ECL9eS=_ADrncX8qBtxZv=uLcdu9_6GUv23Uw@mail.gmail.com> <CACuKZqEcA1Pv8RpWfmThMjTzi2BbVMMKXqujs6BxVfxRPZJ9NQ@mail.gmail.com> <CAG4zZZCr4aTfVpw2coX2g0qw++4kdgNCFVze6tHKZ+fJNqb0aQ@mail.gmail.com> <CAG4zZZA4WR50Ea2e36XEgTgpJURwiMFn+DXeYuxHFfZatYzDOQ@mail.gmail.com> <CAH9hSJYv5VXGjS7AfG12-ArEvE6Uj_eE6pPxAiQcchcgV8vHcg@mail.gmail.com> <CAH9hSJbzra7uz7yfKQwfZaP_jhnxwdZyx8JnwCmBGhiMk6rbtg@mail.gmail.com> <CAG4zZZC1cmaH36znAvVLZE_MyJ+ThNk1Ky7tQ-QnKf_qwiQNDw@mail.gmail.com> <CAG4zZZB3h6TTFLUp-ucYQP7tMf-8=h5fh1UqufMh3w-0JN+hSw@mail.gmail.com> <CAH9hSJaeCrLjkhHUzaaGDw-apiSv-eaPZeYGEHBuwRoF3yPCOA@mail.gmail.com> <CAH9hSJY4NResx4DskJM8agd5ZXo9yHELYaXOpWG-xXK8P4+9zw@mail.gmail.com> <CAG4zZZC_S-+sALay3h+cD3nUK33_ayef5QC6v--TiAAR3Oc33w@mail.gmail.com> <CAGzyod6isscjV6TD=2DUo_dTSDRZxz6Mzmr7MbYNATwFPE7HXA@mail.gmail.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Tue, 25 Feb 2014 06:31:46 +0900
Message-ID: <CAH9hSJaPCd83QF7DsgbcbHMwLQg9XwUbFX--Jeq8t322-Crwew@mail.gmail.com>
To: Roberto Peon <fenix@google.com>
Content-Type: multipart/alternative; boundary="f46d043c7de6110fcf04f32db446"
Archived-At: http://mailarchive.ietf.org/arch/msg/hybi/6LSI61DvH7TaKmjJ2SwldrQaumI
Cc: "hybi@ietf.org" <hybi@ietf.org>, Peter Thorson <webmaster@zaphoyd.com>
Subject: Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.15
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, 24 Feb 2014 21:32:10 -0000

On Tue, Feb 25, 2014 at 3:59 AM, Roberto Peon <fenix@google.com> wrote:

> As I understand it:
>
> If the previous DATA frame on the stream included END_SEGMENT, and the
> current DATA frame on the stream includes END_SEGMENT, then the HTTP2 frame
> length == the websocket frame length.
> This is extremely likely to be the common case.
>
> If the websocket frame needs to be broken up (generally only because it
> has a large payload), then some other signaling of the frame length is
> necessary, e.g. by using an HTTP/2 HEADERS frame with content-length key.
>  -=R
>
>
> On Mon, Feb 24, 2014 at 10:43 AM, Joakim Erdfelt <joakim@intalio.com>wrote:
>
>> Let me see if I grok this entirely...
>>
>> You are saying that HTTP/2.0 HEADERS has a 14 bit value already.
>> You would like to utilize this existing 14 bit value to represent
>> websocket payload data.
>>
>
Yes. Using the 14 bit length combined with the END_SEGMENT signal, we can
represent a block by sequence of HTTP/2.0 DATA frames.

As Roberto said, the simplest case is (for simplicity, padding in DATA
frames is assumed to be 0):

DATA(length=n, END_SEGMENT(2nd bit in flags)=true, Data=payload data of n
bytes)

Where Data field contains one byte to represent FIN, RSV1-3 and opcode. Or,
instead we can send HEADERS before the DATA which contains FIN, RSV1-3 and
opcode header since they would compress well compared to length header.

If payload is large, a sequence

DATA(length=s_0, END_SEGMENT=false, Data=payload data of s_0 bytes),
DATA(length=s_1, END_SEGMENT=false, Data=payload data of s_1 bytes),
...
DATA(length=s_n, END_SEGMENT=true, Data=payload data of s_n bytes)

represents the original frame. Where the first one byte in the
concatenation of Data fields has FIN, RSV1-3 and opcode, or instead we can
send HEADERS before the sequence of DATAs which contains FIN, RSV1-3 and
opcode.


>  You would like to avoid having to adjust or supplement HTTP/2.0 HEADERS
>> just for WebSocket behaviors.
>>
>
Yes. I'm trying to use what we have now as-is.


> You are indicating that this 14 bit value is not a 1 to 1 representation
>> of "original WebSocket frame size" as determined by various APIs or
>> extensions before hitting the HTTP/2.0 layer.
>>
>
Right


>  You hint at the behavior of large (over 14 bit length) "original
>> WebSocket frames" being likely sent in multiple HTTP/2.0 DATA/END_SEGMENT
>> portions.
>>
>
Right


>  Wouldn't this also mean that any "original WebSocket frame" length
>> information not being present on the receiving side. right?
>>
>
 Not present on receiving the first DATA, but will be revealed on receiving
the length header of the last DATA frame (with END_SEGMENT on).


>  The receiving side would just see HTTP/2.0 DATA/END_SEGMENT with some
>> indicator that the DATA is for WebSocket, right?
>>
>
I don't quite understand this question. It's already known that DATAs
contain WebSocket traffic by ":scheme" in the opening handshake.


> The receiving side would never see the "original WebSocket frame" as this
>> information is now lost.  Is that correct?
>>
>
END_SEGMENT tells where the boundary of the frames was.


>  Instead you have HTTP/2.0 DATA length header for WebSocket payload data,
>> along with an END_SEGMENT indicating the separation between WebSocket
>> messages.
>>
>
That depends on another topic. If we separate messages with END_SEGMENT,
then yes. If we separate frames with END_SEGMENT, then no.

I'd like to get consensus on that length header in HTTP/2.0 DATA frame is
sufficient. It's a topic independent from whether we preserve frame
boundary or not.


>
>>
>> --
>> Joakim Erdfelt <joakim@intalio.com>
>> webtide.com <http://www.webtide.com/> - intalio.com/jetty
>> Expert advice, services and support from from the Jetty & CometD experts
>> eclipse.org/jetty - cometd.org
>>
>>
>> On Mon, Feb 24, 2014 at 11:28 AM, Takeshi Yoshino <tyoshino@google.com>wrote:
>>
>>> Thanks all for your comments.
>>>
>>> First, please note that I wanted to discuss the question in the context
>>> of WS/HTTP/2.0 layering. Not about redesign of RFC 6455 itself.
>>>
>>> I asked this question since the length header is the biggest field when
>>> encoded into HTTP/2.0 HEADERS format. Whether we can eliminate it or not in
>>> WS/HTTP/2.0 is one of the most important points to evaluate the plans
>>> employing HTTP/2.0 HEADERS.
>>>
>>> Though the ranges the length headers represent differ (HTTP/2.0: 14 bit,
>>> WS length format: 63 bit), it seems everyone can live without a header of
>>> "original WebSocket frame size".
>>>
>>> Please reply to this post if you have any objection, but please don't
>>> write objection to use of HTTP/2.0 HEADERS itself in this thread.
>>>
>>> Thanks
>>>
>>
>>
>> _______________________________________________
>> hybi mailing list
>> hybi@ietf.org
>> https://www.ietf.org/mailman/listinfo/hybi
>>
>>
>
[1] http://tools.ietf.org/html/draft-hirano-httpbis-websocket-over-http2-00