Re: HTTP/2 and Websockets

Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Mon, 29 September 2014 09: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 (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 25B4B1A872E for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 02:55:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.688
X-Spam-Level:
X-Spam-Status: No, score=-7.688 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.786, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
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 bFJtqEOTjw1c for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 02:55:26 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 54B071A8724 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 29 Sep 2014 02:55:25 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1XYXd7-0005jk-Ej for ietf-http-wg-dist@listhub.w3.org; Mon, 29 Sep 2014 09:52:29 +0000
Resent-Date: Mon, 29 Sep 2014 09:52:29 +0000
Resent-Message-Id: <E1XYXd7-0005jk-Ej@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <ilari.liusvaara@elisanet.fi>) id 1XYXcZ-0005io-IN for ietf-http-wg@listhub.w3.org; Mon, 29 Sep 2014 09:51:55 +0000
Received: from emh07.mail.saunalahti.fi ([62.142.5.117]) by maggie.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <ilari.liusvaara@elisanet.fi>) id 1XYXcY-00030w-3o for ietf-http-wg@w3.org; Mon, 29 Sep 2014 09:51:55 +0000
Received: from LK-Perkele-VII (a88-112-44-140.elisa-laajakaista.fi [88.112.44.140]) by emh07.mail.saunalahti.fi (Postfix) with ESMTP id A687F4040; Mon, 29 Sep 2014 12:51:29 +0300 (EEST)
Date: Mon, 29 Sep 2014 12:51:29 +0300
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
To: Yutaka Hirano <yhirano@google.com>
Cc: Robert Collins <robertc@robertcollins.net>, HTTP Working Group <ietf-http-wg@w3.org>
Message-ID: <20140929095129.GA28711@LK-Perkele-VII>
References: <CAJ3HoZ1gHH1MmY=NY68HBcFV7u74qKtkdWDe4i93MkjnXE+sPg@mail.gmail.com> <CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Received-SPF: pass client-ip=62.142.5.117; envelope-from=ilari.liusvaara@elisanet.fi; helo=emh07.mail.saunalahti.fi
X-W3C-Hub-Spam-Status: No, score=-3.2
X-W3C-Hub-Spam-Report: AWL=-3.204, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1XYXcY-00030w-3o 24c552fe4a44b1bff6cecff6be880de8
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP/2 and Websockets
Archived-At: <http://www.w3.org/mid/20140929095129.GA28711@LK-Perkele-VII>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/27324
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>

On Mon, Sep 29, 2014 at 02:26:34PM +0900, Yutaka Hirano wrote:
> Hi,
> 
> I am proposing a spec draft:
> http://tools.ietf.org/html/draft-hirano-httpbis-websocket-over-http2-01 .
> Since many modifications were made on on the HTTP/2 spec, some description
> may be obsolete. Please let me know if you find any flaw.

The capability negotiation looks weird.

I would just signal SETTINGS_WEBSOCKET_CAPABLE with 0x1-bit set to 1 (and
the rest reserved for extension) from server (or from proxy towards
client).

After receiving SETTINGS_WEBSOCKET_CAPABLE with 0x1 flag, the client/
proxy knows the proxy/server can handle websockets (and is used via
:scheme 'ws'/'wss'). No need to ACK anything.

In the future, some more elaborate extensions might need to be enabled
from both sides, but be base functionality doesn't. Only features that
change existing semantics need to be acknowledged.

One example of something to signal from client to proxy/server would
be reverse connections (but this needs some way for proxies and browsers
to route the connection, maybe associated stream ID, and PUSH_PROMISE
can't be used due to its unidirectionality[1]).

Reverse connections can't be mapped to RFC 6455, so those would need
HTTP/2 path all the way between client and server.

> Yeah, we can't simply use DATA frames because intermediaries may buffer
> data. The HTTP/2 spec had "MSG_DONE" once and I wanted to use it, but it
> was removed from the spec. Currently I think introducing a new frame type
> is the right way.

One way would be to take the base Websockets spec for data communications
and rip out everything unneeded and adapt some things:

- Server's/proxy(toward client) SETTINGS has notification about Websockets
  support.
- Client's opening handshake has no upgrade headers (upgrade or connection:
  upgrade). Instead it has :scheme set to either 'ws' or 'wss'.
- Client's opening handshake has :authority instead of host.
- Client's opening handshake has no Sec-websocket-key
- Server's opening handshake has 200 status instead of 101.
- Server's opening handshake has no Sec-websocket-accept
- Each DATA frame carries one websocket frame.
- FIN, RSVx and opcode are signaled as the first byte of DATA frame.
- There is no masking, and MASK is implcitly 0.
- Frame length is implicitly data frame length - 1.
- Zero-byte data frames are not valid.
- Proxies fragment or coalesce if needed (TODO: How to handle 16kB
  and up control frames?)
- Proxies can perform adaptation between RFC 6455 and Websockets over
  HTTP/2.
- No TLS handshakes are done (TLS is below HTTP/2).
- TCP connection is replaced by HTTP/2 stream.

This requires some support on proxies (e.g. priority boosting and
fragmenting), but proxies should know what they are dealing with,
and Websockets needs proxy support anyway (at least unless one does not
want to burn through sequence numbers really fast and to cause excessive
load on proxies).

Also, extensions that modify base header semantics (as opposed to just
using RSVx bits or adding their own header included in frame size)
don't work, but I think that is not a big problem. PMCE is OK.


[1] I earlier sent list of ideas for decoupling framing and HTTP layers,
PUSH_PROMISE is unidirectional even in that (that's the difference
between PUSH_PROMISE and HEADERS!).


-Ilari