Re: WebSocket2

Van Catha <vans554@gmail.com> Wed, 05 October 2016 16:35 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@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 72EA91295DD for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 5 Oct 2016 09:35:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.516
X-Spam-Level:
X-Spam-Status: No, score=-9.516 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, RP_MATCHES_RCVD=-2.996, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 n4MM-qx3C10V for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 5 Oct 2016 09:34:58 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 63578129463 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 5 Oct 2016 09:34:58 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1brp4f-0006Uu-0u for ietf-http-wg-dist@listhub.w3.org; Wed, 05 Oct 2016 16:29:41 +0000
Resent-Date: Wed, 05 Oct 2016 16:29:41 +0000
Resent-Message-Id: <E1brp4f-0006Uu-0u@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <vans554@gmail.com>) id 1brp4a-0006U4-1L for ietf-http-wg@listhub.w3.org; Wed, 05 Oct 2016 16:29:36 +0000
Received: from mail-qk0-f175.google.com ([209.85.220.175]) by maggie.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <vans554@gmail.com>) id 1brp4W-0003Yd-M3 for ietf-http-wg@w3.org; Wed, 05 Oct 2016 16:29:35 +0000
Received: by mail-qk0-f175.google.com with SMTP id j129so215605457qkd.1 for <ietf-http-wg@w3.org>; Wed, 05 Oct 2016 09:29:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=app8wAOwGJBB5otfyuQh4/5qeyMe17DsIRBYqKeKYSg=; b=QyE3AoOqkko9svjL1XhN1xjuQ4swtJRcVT5wQwu49/dNEEhAyPXjQ4u58ThjcuH/Iq q0greMqOpJ0gIuL04lhPOY71qmBEREKlPuf2L7ZgKoDylFtvNkR6NfhYVJr4ZpZcivTG iv0UU8kOeyv/AJqxMJMBtyqUEvGr+h2m+FvdP4uL4ld2DwfQRC9aRZmYL+4sHy445ax1 atIyspLVy+Qax9sByyYEu+QvjnUAd9+2w4ICek2g6mXjLd2HAwfwvNBqnRATpcqleTmX JrEridJers/Fqmd5nsltOmX96afyY3XYRvVc6BbCliwE76ya6pV4YUWdGKX9wPEWdzUk rP+A==
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; bh=app8wAOwGJBB5otfyuQh4/5qeyMe17DsIRBYqKeKYSg=; b=iTvoUlS036MHww2e/vHXkyCpo58ek4TJW0XsTJKqp4yQ+yVl/nkFoovjVcyRBGyKkY tcLjFmSQlDYylcYKAemMoDTIWbQlRWf2LYbGY99KP8fsssIbiRemznhK3KUtQFCHbyQz MIPJxKCZx8XDfGMBYmEFZxPdxnUvtX+ARWRbgSrC/o58WNmUoj2AcbDEvP14oR4Xu67V t7LF1kmrZX7WK4GvE1yX+f/TsOL3fuJ021Q1gQtjFPQ9kgU1z5IXhSvCjmz7JPVE3W9V YIRwbSlPANOhFWnbsoFJuntCbmwhDjyNW72/lMq4CoNNFi6mzQg5mDyCXqhmJ7BX5DLj mGpg==
X-Gm-Message-State: AA6/9RkQm57OeZYdJcDlQOD36IBF4/V0kv5Q8wZOEP74iAKQ/ptEqadaJSCU3/ArPzl95WAvKW5eV7FQtK2oxw==
X-Received: by 10.55.66.66 with SMTP id p63mr9344435qka.277.1475684946599; Wed, 05 Oct 2016 09:29:06 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.55.217.206 with HTTP; Wed, 5 Oct 2016 09:29:05 -0700 (PDT)
In-Reply-To: <CAH9hSJY40AnYE1JTuc1aYFzRtaT-+PwX8M7YeVj2cbosCfD0TQ@mail.gmail.com>
References: <CAG-EYChPJpAzoEuNwY3cNz503d0FRbNnDx_9AsNsZyfb5nmN0g@mail.gmail.com> <20161002080030.5F328160CC@welho-filter4.welho.com> <20161002101548.GA9450@LK-Perkele-V2.elisa-laajakaista.fi> <201610021110.u92BAWpi019029@shell.siilo.fmi.fi> <20161002124346.GB9450@LK-Perkele-V2.elisa-laajakaista.fi> <201610021340.u92DeBBL029907@shell.siilo.fmi.fi> <20161002171905.GA10108@LK-Perkele-V2.elisa-laajakaista.fi> <201610030440.u934e3kL031002@shell.siilo.fmi.fi> <CAG-EYCgEs1oSdLeLVwd12ECaL=+3pzytuy89xFWvvKCEY8fi4g@mail.gmail.com> <CAH9hSJaMsKaoTK+kr2X_GP_T7=jcDQtFLSusYrV+nDWCadcyxg@mail.gmail.com> <201610041520.u94FK6vV008976@shell.siilo.fmi.fi> <CAH9hSJY40AnYE1JTuc1aYFzRtaT-+PwX8M7YeVj2cbosCfD0TQ@mail.gmail.com>
From: Van Catha <vans554@gmail.com>
Date: Wed, 05 Oct 2016 12:29:05 -0400
Message-ID: <CAG-EYCiCkC2XWuhbOtwKusW28=p-sYLArDR6MfN1Zc41+9f2-A@mail.gmail.com>
To: Takeshi Yoshino <tyoshino@google.com>
Cc: Kari Hurtta <hurtta-ietf@elmme-mailer.org>, Ilari Liusvaara <ilariliusvaara@welho.com>, HTTP working group mailing list <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="001a114ac0240b023f053e20add5"
Received-SPF: pass client-ip=209.85.220.175; envelope-from=vans554@gmail.com; helo=mail-qk0-f175.google.com
X-W3C-Hub-Spam-Status: No, score=-5.1
X-W3C-Hub-Spam-Report: AWL=-1.138, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1brp4W-0003Yd-M3 7438139964bbdadc8a3b5c339a8a95e3
X-Original-To: ietf-http-wg@w3.org
Subject: Re: WebSocket2
Archived-At: <http://www.w3.org/mid/CAG-EYCiCkC2XWuhbOtwKusW28=p-sYLArDR6MfN1Zc41+9f2-A@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/32488
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>

Kari and other participants, which way do you think would be better:

RFC of Websocket2  updates RFC 7540 (HTTP/2)
OR
RFC of Websocket2 registers new method.

Using it this way you proposed would it require adding
SETTINGS_WEBSOCKET_CAPABLE
as well?

I think the SETTINGS_WEBSOCKET_CAPABLE can be included in the RFC and if
a middle box does not implement support for it, as long as it forwards
everything correctly
AND the response contains the sec-ws2-error header, there should not be
problems?

> > Ilari Liusvaara suggested sec-ws2-ack for check that
> > ":scheme" is not ignored (if I remember correctly).

If the websocket2 response returns the custom error header, this is similar
to the sec-ws2-ack.
Example on success we MUST return OKAY|SUCCESS.

sec-ws2-error: OKAY

Without this error header how can the client know what went wrong during
ws2 negotiation?

Takeshi:

> Are you suggesting that the WS2/h2 should be indistinguishable from
HTTP1.1/h2 from
> intermediaries and server without knowledge of the websocket2- headers or
> application level knowledge? Or just suggesting that we can reduce
complexity by
> ignoring all the v2-v1 bridging at proxies?
>
> Do you have any strong opinion about how WS2 should be exposed on the web
platform?
> The WebSocket API, some brand new API? Or are you only interested in
defining a
> standardized messaging protocol to be layered over HTTP2 and QUIC to
utilize their
> power?

Standardized protocol or not is irrelevant.  I was simply considering the
options
and what would work.  QUIC uses different negotiation and transport frames
then HTTP/2
does (also QUIC does not have HTTP/2 SETTINGS frames). I was proposing
ideas at
tackling the problem to make WebSocket2 work across different transport
layers.



> > There is a particular use case where if you sent lots of small messages
that end
> > up in a single HTTP/2 DATA frame or a single system level packet, there
is an
> > overhead of 3 extra bytes and 6 for LZ4 compressed payloads.

> How does this 3 break down?

> Reading the following revised header proposal, I looks the minimum is 2
octets.
> - 2 LZ4 decompressed payload length field's length bits
> - 2 compression bits
> - 2 payload length field's length bits
> - 2 type bits
> - 1 octet at minimum for text and binary message
> and 2 + 4 (decompressed byte size) = 6 for LZ4?

I made a typo in the example:

> Now it can look like:
> b01010100 0x09 0x05 0xAE 0xB4

Should be b01010100 0x03 0x05 0xAE 0xB4


The old proposal used 32 bits for payload length and if LZ4 32 bits for
decompressed
size. The new way I proposed specifies how many bits those will be by
setting bits
in the 8 bit header. So instead of forcing 32 bits always, we can have
variable
8,16,32.

Value of 0 in the payload length (bxxxx00xx) signifies no payload length.

The minimum size of a frame is 1 byte.  Which would be a text or binary
frame and
look like:

b00000000
OR
b00000001

> To me, 4 octet fixed-length payload length header looks competitive for
its
> simplicity, but this variable length doesn't compared to the RFC 6455
length
> encoding. I understand it ended up to look weird, but it has good
representation
> power and efficiency, and there're existing code resources developed for
> implementing RFC 6455. What do you think about just using RFC 6455's
length format?

On all accounts RFC 6455 payload length is great.  It also would free
up 2 bits in the header.

Since the MASK bit is gone (?), maybe it can gain an extra bit.  Also a
64bit
max payload size I think is too much, will we ever want to send any message
larger
then 4.3~ gigabyte? I think a MAX_SIZE should be imposed, and one way to do
this
without imposing a MAX_SIZE spec is to use a defined amount of bits for the
lengths.

Both the LZ4 decompressed size and Payload Length can be replaced with the
RFC 6455 way
if the mask bit can be freed.


> > Second last 2 RSV bits are for compression.   0 is no compression, 1 is
lz4, 2 is
deflate.  3 is reversed.

> Unless there we expect needs for switching between the two or more
compression
> algorithms in a single connection, we don't need to give a dedicated bit
for each
> algorithm.

> The first 2 RSV bits could be also defined as generic compression
parameter field.

I thought about this, and it does add a nice amount of flexibility at the
cost of 2
bits.  For example if your streaming LZ4 compressed data which is often
1000 bytes+ per message but
occasionally get a less than 20 byte message (that gets framed), specifying
to not
compress that frame would see a performance/+size benefit.

I think we can all agree we do not want to handle decompression in the
client
Javascript.



On Wed, Oct 5, 2016 at 1:28 AM, Takeshi Yoshino <tyoshino@google.com> wrote:

> Hi Kari,
>
> I just remembered that you gave some feedback to Yutaka's proposal in
> 2014. Thanks.
>
> On Wed, Oct 5, 2016 at 12:20 AM, Kari Hurtta <hurtta-ietf@elmme-mailer.org
> > wrote:
>
> <snip>
>
>
>> I contemplated SETTINGS as:
>>
>> ∙ SETTINGS frame with SETTINGS_WEBSOCKET_CAPABLE = 1
>>   from HTTP/2 server ⇒  HTTP/1 client direction
>>
>>   ∘ Promises that HTTP/2 server checks ":scheme"
>>     (and specially "wss" and "ws")
>>
>>   ∘ Acknowledges that DATA frames for
>>     ":scheme" = "wss" and "ws" are handled
>>     as bidirectional traffic (similar than
>>     ":method" = "CONNECT").
>>
>>     In other words these DATA drames do
>>     NOT form HTTP request body from client
>>     and DATA drames do not form
>>     HTTP response body from server
>>     (on cases ":scheme" = "wss" and "ws").
>>
>>   ∘ SETTINGS_WEBSOCKET_CAPABLE = 1 does
>>     not promise that HTTP/2 server
>>     accepts ":scheme" = "wss" or "ws".
>>
>
> Yutaka's proposal tried to represent the same guarantee by using the
> combination of the client to server direction SETTINGS and the response
> status code.
>
> I chatted with Yutaka offline. He don't remember the background fully, but
> we guess we chose to let the client send SETTINGS because we want to start
> sending WebSocket handshake before waiting for response from the server to
> reduce the initial latency. Such an attempt may result in failure, but
> worth doing for some latency sensitive applications.
>
> There're two approaches to realize this:
> (a) let the server send SETTINGS and let the client send handshake
> speculatively without waiting for the SETTINGS
> (b) let the client send SETTINGS and then send handshake speculatively,
> and let the server determine the response status code based on whether or
> not it has received SETTINGS as specified in Yutaka's I-D.
>
> (a) still gives the client path check result before receiving the
> WebSocket handshake response, but it's not good that the server cannot know
> whether the path was good or not before accepting the WebSocket handshake.
>
> One more thing to note is that we were investigating whether we could
> relax the requirement of the WebSocket API that messages cannot be sent
> before receiving handshake response, when h2 is used. The server needs to
> process these speculative messages without determining whether the the path
> was good for WS/h2 if we adopt (a).
>
> One small benefit of (b) is that there wouldn't be any
> SETTINGS_WEBSOCKET_CAPABLE traffic if the client doesn't want to use WS.
>
> Now I think combining (a) and (b) is the best given the concern that the
> server may forget to investigate the SETTINGS correctly but still reply to
> a WebSocket handshake with non 501 status code.
>
> <snip>
>
>
>> > :scheme is needed, yes.
>> >
>> > Not sure about need for "sec-ws2-ack". For WebSocket/TCP, we employed
>> the
>> > Sec-WebSocket-Key/Accept challenge/response in order to prevent the
>> > WebSocket protocol from being abused for cross protocol attacks e.g.
>> SMTP.
>> > If all the intermediaries and servers correctly investigate the :scheme
>> > header and don't get confused, "sec-ws2-ack" is unnecessary. Regarding
>> > ws/h2-RFC6455 bridging, a correctly implemented intermediary facing
>> ws/h2
>> > capable node and ws/h2 non-capable node would just perform RFC 6455
>> > handshake as Kari suggested. So, no problem.
>>
>> Ilari Liusvaara suggested sec-ws2-ack for check that
>> ":scheme" is not ignored (if I remember correctly).
>>
>
> Yeah. I understood so and therefore I said "If all the intermediaries and
> servers correctly investigate the :scheme header and don't get confused,".
>
> <snip>
>
>