Re: HTTP/2 and Websockets

Greg Wilkins <gregw@intalio.com> Mon, 29 September 2014 19:20 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 4CA461A9176 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 12:20:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.065
X-Spam-Level:
X-Spam-Status: No, score=-7.065 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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 gu_i7BUbYIgk for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 29 Sep 2014 12:20:41 -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 9D68B1A924E for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 29 Sep 2014 12:20:41 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1XYgSQ-0002k1-Rf for ietf-http-wg-dist@listhub.w3.org; Mon, 29 Sep 2014 19:18:02 +0000
Resent-Date: Mon, 29 Sep 2014 19:18:02 +0000
Resent-Message-Id: <E1XYgSQ-0002k1-Rf@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <gregw@intalio.com>) id 1XYgS6-0002ic-3M for ietf-http-wg@listhub.w3.org; Mon, 29 Sep 2014 19:17:42 +0000
Received: from mail-wi0-f170.google.com ([209.85.212.170]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <gregw@intalio.com>) id 1XYgS4-0005e4-JA for ietf-http-wg@w3.org; Mon, 29 Sep 2014 19:17:42 +0000
Received: by mail-wi0-f170.google.com with SMTP id n3so98132wiv.5 for <ietf-http-wg@w3.org>; Mon, 29 Sep 2014 12:17:13 -0700 (PDT)
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=ec2kJaDbr0HUQknsrJN146IGl1tDLFLQf5uVkdPd1Pw=; b=Y3whn4xDxuaDIx/SgqwexI/IQvTNnHn4cyn7zPvvBDxr7xLN88UasUuVQA4iqhSodo b31CNWIv/r5X+FQc9ZOfEQGoEUM6hmWlV5/CigfmptMVoH4ZUejfiAAeYpFs5Y7skV0Y tGKZMUVWvb7weppceH06MHcpSwo7Xdpc2mN66ZXKgsHHKT8Sv3q0ibxFLiDlA1IPtVyz lFpC1C+wyeEG20q/fR615sttWOjNvdxisd3xfMe81OrOUFSxnfk9WB5VDL/1egTxZqoA 1P3ayEqYc3aZr6zyBVpGgJkprhPcPhxxyalgh1NhtsvOMrypzQdphfpRRIIc3Cwi6d6b XQ+w==
X-Gm-Message-State: ALoCoQnVjdOYQOvokPkutFggTiMpThln5ONi0KEQAzjpBUBCYUuWEThtClQkkjrn38mpGEA2Vln9
MIME-Version: 1.0
X-Received: by 10.194.103.200 with SMTP id fy8mr5716820wjb.123.1412018233807; Mon, 29 Sep 2014 12:17:13 -0700 (PDT)
Received: by 10.194.169.98 with HTTP; Mon, 29 Sep 2014 12:17:13 -0700 (PDT)
In-Reply-To: <CABihn6EBbq-gvh_VmxuReJsqgFUe6eGPuWZ3KN026SLu3x4gdg@mail.gmail.com>
References: <CAJ3HoZ1gHH1MmY=NY68HBcFV7u74qKtkdWDe4i93MkjnXE+sPg@mail.gmail.com> <CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com> <20140929095129.GA28711@LK-Perkele-VII> <CABihn6EBbq-gvh_VmxuReJsqgFUe6eGPuWZ3KN026SLu3x4gdg@mail.gmail.com>
Date: Tue, 30 Sep 2014 05:17:13 +1000
Message-ID: <CAH_y2NHZeQF4+oWsW6x9AmqXz5dLy1qKsNvAxWw-N5DVXLph6w@mail.gmail.com>
From: Greg Wilkins <gregw@intalio.com>
To: Yutaka Hirano <yhirano@google.com>
Cc: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>, Robert Collins <robertc@robertcollins.net>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="047d7bfe95223e48f70504391dea"
Received-SPF: permerror client-ip=209.85.212.170; envelope-from=gregw@intalio.com; helo=mail-wi0-f170.google.com
X-W3C-Hub-Spam-Status: No, score=-3.8
X-W3C-Hub-Spam-Report: AWL=-3.088, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7
X-W3C-Scan-Sig: maggie.w3.org 1XYgS4-0005e4-JA 405cf71db39056d0ee25d9dad3f454d0
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP/2 and Websockets
Archived-At: <http://www.w3.org/mid/CAH_y2NHZeQF4+oWsW6x9AmqXz5dLy1qKsNvAxWw-N5DVXLph6w@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/27332
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>

I think this is a timely subject as I believe it is very important to take
Yutaka's ideas forward to a working extension sooner rather than later.

My fear is that unless we test websocket over HTTP/2 before we go final, we
may discover some fatal flaw that prevents efficient handling of websocket
as a h2 stream.

Even if there are no nasties discovered, not having an extension defined at
the start will mean that a lot of h2 infrastructure will get deployed
without websocket support.  Once this occurs, it may be very difficult to
get good websocket coverage for some time with an extension approach.   I
fear that the response will be to come up with a websocket mapping that
abuses the h2 protocol so that it can tunnel through websocket unaware
intermediaries... and that is unlikely to be efficient because we have
dropped end_segment semantics from h2 streams.

Cheers

PS. My real preference is that this group get's recharted to support both
http and websocket semantics over h2 - and we go back to the drawing board
with the framing layer using >1 examples to generalise from.



On 29 September 2014 21:36, Yutaka Hirano <yhirano@google.com> wrote:

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


-- 
Greg Wilkins <gregw@intalio.com>
http://eclipse.org/jetty HTTP, SPDY, Websocket server and client that scales
http://www.webtide.com  advice and support for jetty and cometd.