Re: HTTP/2 and Websockets

Yutaka Hirano <yhirano@google.com> Mon, 29 September 2014 11:40 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 E95671A1BDC for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 04:40:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.165
X-Spam-Level:
X-Spam-Status: No, score=-7.165 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, 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 sGEy2ZC2NeLv for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 04:40:43 -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 072EB1A1A50 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 29 Sep 2014 04:40:42 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1XYZGu-0004m1-O0 for ietf-http-wg-dist@listhub.w3.org; Mon, 29 Sep 2014 11:37:40 +0000
Resent-Date: Mon, 29 Sep 2014 11:37:40 +0000
Resent-Message-Id: <E1XYZGu-0004m1-O0@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <yhirano@google.com>) id 1XYZGa-0004kw-CY for ietf-http-wg@listhub.w3.org; Mon, 29 Sep 2014 11:37:20 +0000
Received: from mail-la0-f43.google.com ([209.85.215.43]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <yhirano@google.com>) id 1XYZGY-0007dx-S0 for ietf-http-wg@w3.org; Mon, 29 Sep 2014 11:37:20 +0000
Received: by mail-la0-f43.google.com with SMTP id gb8so8328242lab.30 for <ietf-http-wg@w3.org>; Mon, 29 Sep 2014 04:36:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5gips7QMfJQR6Li2FIBsCqmWWlDUHLuK0YNeJq7gUBg=; b=Zd5EnPIW3NWF3fnGgdtEiOfnz/wK0w6tXEHXg4KxMRZ/sPp0ZbEgrlUXOzdItFRfYu VhaVQiCO32f16YOlc+PsK/aorJEo1Meivnk8SyU82ALyTPFy6M3KID1/pVkXWzE7kSJ/ QT1bfx8/ShMrENO4h9MtrocK82lV7wudLfveGmf5TyGS2BCAdZNlX6dMu5Pxoo6fNetZ bMrYkeBqafZAH5vCpy9MWtWl/j9bz4+C21dMlxtpeci+ldZDT7wLb5d88U7e/IlyB1y8 WpOG8/tW6oiRQm6grpNSwUs0O6+Sp1Av1d0XyJ57WDQhiOlO3atqWjd/0lviZg4EP1Lg KlkA==
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:date :message-id:subject:from:to:cc:content-type; bh=5gips7QMfJQR6Li2FIBsCqmWWlDUHLuK0YNeJq7gUBg=; b=dt+h4IqqMiEbDQNu+yYeL0RaNVw74A1WOiGCyHSHw4lVygia7alYXwxeuhkqBAnNGe ADa7E3KM/5Ww96V34MITKbB2ycYqOAuBXRAlcKBv3yFnxPzEIIsyq1WblELFWXcKtioU cC0uDfEmu1oeLao8y6s3NF7HfmUdnN+oH+UTDr5GzQufkNuJ8VQynlFlRSB6MW/ax9nu xkEiazA8hnYtxCmfG8+mnaoeMJK1NOdmRUJchGwOJEveZg/j4m2aBdht5l968UCCJd5N ZSXQLhHajyI5T7qpLYY+h3+gqI6KFdA6xqE2v3iNpc4ailSqe8DiONqnwIOBljcfrWzF qLOQ==
X-Gm-Message-State: ALoCoQnPuhUSfzr42CnCLkVHk43q4F3cOlHL0CbeUPK1IsUewEDUx53gdc32pJqzwGiKkSJKff0P
MIME-Version: 1.0
X-Received: by 10.152.4.97 with SMTP id j1mr38612969laj.73.1411990612021; Mon, 29 Sep 2014 04:36:52 -0700 (PDT)
Received: by 10.114.77.161 with HTTP; Mon, 29 Sep 2014 04:36:51 -0700 (PDT)
In-Reply-To: <20140929095129.GA28711@LK-Perkele-VII>
References: <CAJ3HoZ1gHH1MmY=NY68HBcFV7u74qKtkdWDe4i93MkjnXE+sPg@mail.gmail.com> <CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com> <20140929095129.GA28711@LK-Perkele-VII>
Date: Mon, 29 Sep 2014 20:36:51 +0900
Message-ID: <CABihn6EBbq-gvh_VmxuReJsqgFUe6eGPuWZ3KN026SLu3x4gdg@mail.gmail.com>
From: Yutaka Hirano <yhirano@google.com>
To: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Cc: Robert Collins <robertc@robertcollins.net>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="089e0149338cdb2cef050432ae3c"
Received-SPF: pass client-ip=209.85.215.43; envelope-from=yhirano@google.com; helo=mail-la0-f43.google.com
X-W3C-Hub-Spam-Status: No, score=-3.7
X-W3C-Hub-Spam-Report: AWL=-2.175, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.761, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1XYZGY-0007dx-S0 715e243fa0713cfc3aa56a62c813e0ef
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP/2 and Websockets
Archived-At: <http://www.w3.org/mid/CABihn6EBbq-gvh_VmxuReJsqgFUe6eGPuWZ3KN026SLu3x4gdg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/27327
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>

Thank you for the comments!

We have been not working actively for months because of two reasons:
1) The http/2 spec was changing rapidly and we couldn't write a spec on top
of it.
2) We weren't confident if wide range of people were interested in this
protocol.

1) will be resolved soon, I hope. For 2), If you are interested in
WebSocket over HTTP/2, it is very helpful to express it!
About one year ago, we were talking if we wanted perfect RFC6455 compatible
WebSocket or not (i.e. full-extension support). IIRC most of us didn't want
the full RFC6455 compatibility, but if you have any opinion, it is welcome.
In short, we would like to hear your voice.

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.

My proposal doesn't need ACK.
The client sends a SETTINGS frame before sending the first handshake in the
stream. After that, the client starts the usual WebSocket opening handshake.

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.
>

Given that we have SETTINGS_WEBSOCKET_CAPABLE, I would use a new frame type
not to confuse intermediaries / endpoints. The actual data format will be
discussed, but IMHO it is less important and can be discussed later.

Thanks,

On Mon, Sep 29, 2014 at 6:51 PM, Ilari Liusvaara <
ilari.liusvaara@elisanet.fi> wrote:

> 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
>