Re: HTTP/2 and Websockets

Yutaka Hirano <yhirano@google.com> Mon, 29 September 2014 05:31 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 4E0361A0282 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sun, 28 Sep 2014 22:31:04 -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 be-vb_cF20kh for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sun, 28 Sep 2014 22:31:01 -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 480441A0275 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Sun, 28 Sep 2014 22:31:01 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1XYTUe-0002eu-8X for ietf-http-wg-dist@listhub.w3.org; Mon, 29 Sep 2014 05:27:28 +0000
Resent-Date: Mon, 29 Sep 2014 05:27:28 +0000
Resent-Message-Id: <E1XYTUe-0002eu-8X@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 1XYTUE-0002e3-Vo for ietf-http-wg@listhub.w3.org; Mon, 29 Sep 2014 05:27:03 +0000
Received: from mail-lb0-f180.google.com ([209.85.217.180]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <yhirano@google.com>) id 1XYTUD-0003fF-PI for ietf-http-wg@w3.org; Mon, 29 Sep 2014 05:27:02 +0000
Received: by mail-lb0-f180.google.com with SMTP id f15so3745488lbj.39 for <ietf-http-wg@w3.org>; Sun, 28 Sep 2014 22:26:35 -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=wo7C7/gLCIpLM1yP2G0pth6QOQ7MtQKqX+O/cIRRnLc=; b=BCA3CsywcYyITEs4sa1KhF1UEDxh/reqMNNjdEL8OYLH/3tyh7CxNbdMhKKXG6ec0n 20rzv9ZM//cElgP6N4yN0eT0SQJHkpyzHNJyt/gmT33uNsII5tDDozeWunJANr9GDSno Trek5/QyrNO1o+oZHcBr/us2ub5GL0I2QxUM9reuNxZLzUsEBFW/gwnVGhu4zzZr7zdz DtOyTOniCzbr6Gtyh6X/8eo3iCjMTrI1TMrnTC4rk5svBAiRH2cYulesckS0RGaDbaJe vD9Wm9ZJmCiOqn4v/8cgCFjKqUGm68SnpdcJws0MWqBZ1uEreQV9/F926aYCUWuy9D6a 46Zg==
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=wo7C7/gLCIpLM1yP2G0pth6QOQ7MtQKqX+O/cIRRnLc=; b=F7+vjYHVTatBIDXx9kwB3vZjzPllJWsRgex3K5aTmH2FaBCMdQ6kG1PzHApcbhObRh 7MmiGnBaXn0Br7k1nbCPnMppHzupfaF13a0Pauw6UqoI7M9ml+Z0uGxDMNLpDAuzJ0Ni sijZmR5c/uD24bnkEU7LJ5o8nnDhXl2+CwAazAMXz7vnH3KfLweXINpwhMh9FbEaVzi2 8F6vi3Fay3b/T14NQn7HKWon3HgA93y7MSne/UF2XSljSjZ6ZmE4AMzDCU7hjzCGswzS dDqrxxB+0fVh9P5/5vjmy45Hm3mAiX393LKURsgwoyGP0HWT1erLZSpnn+3/D1PBcomr Q0Dg==
X-Gm-Message-State: ALoCoQk9Qb2coanB11uULba+JEoYJR6oKeCTuabZSQ1mhyfHs+zJwdbbJ9/BAatyQHC/XmmB1j/j
MIME-Version: 1.0
X-Received: by 10.112.134.101 with SMTP id pj5mr34623873lbb.47.1411968394993; Sun, 28 Sep 2014 22:26:34 -0700 (PDT)
Received: by 10.114.77.161 with HTTP; Sun, 28 Sep 2014 22:26:34 -0700 (PDT)
In-Reply-To: <CAJ3HoZ1gHH1MmY=NY68HBcFV7u74qKtkdWDe4i93MkjnXE+sPg@mail.gmail.com>
References: <CAJ3HoZ1gHH1MmY=NY68HBcFV7u74qKtkdWDe4i93MkjnXE+sPg@mail.gmail.com>
Date: Mon, 29 Sep 2014 14:26:34 +0900
Message-ID: <CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com>
From: Yutaka Hirano <yhirano@google.com>
To: Robert Collins <robertc@robertcollins.net>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="047d7b3a90449e411305042d8267"
Received-SPF: pass client-ip=209.85.217.180; envelope-from=yhirano@google.com; helo=mail-lb0-f180.google.com
X-W3C-Hub-Spam-Status: No, score=-3.7
X-W3C-Hub-Spam-Report: AWL=-2.246, 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.608, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1XYTUD-0003fF-PI bb616649b3810dd8afb1f2fa7604284d
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP/2 and Websockets
Archived-At: <http://www.w3.org/mid/CABihn6GAu7pViZ3JxHAm1-SOeFLvxOQAuhrzwROGGY2jiCg4Cg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/27316
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>

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.

Firstly we should define the handshake in terms of a stream opening on
> an existing HTTP/2 connection, and since Upgrade: is not permitted in
> HTTP/2 ("
> Note:HTTP/2 purposefully does not support upgrade to another protocol.
> The handshake methods described in Section 3 are believed sufficient
> to negotiate the use of alternative protocols.
> ")
> its not clear to me if that means we need to define a new frame type,
> or whether we can still use the Upgrade header sanely.

The above draft describes the negotiation scheme. Please take a look.

Secondly, we need to define websocket frame mappings. The least work,
> and I suspect the easiest for implementors, would be to put all the
> websocket frames into HTTP/2's data frames, without worrying about
> frame alignment: just treat the fully open stream as a series of bytes
> in the same way TCP is treated by the websocket spec.
> I suspect however that a better result would be achieved by defining
> custom HTTP/2 frames, since websockets already have the basic support
> for multiplexing (large application writes can be fragmented into
> smaller frames as needed), we shouldn't run into HOL blocking issues.

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.


> Lastly, it seems (to me) that it would be desirable to allow
> PUSH_PROMISE setup of websockets connections

Can you tell me why it is desirable?

Thanks,


On Mon, Sep 29, 2014 at 12:10 PM, Robert Collins <robertc@robertcollins.net>
wrote:

> Has anyone done any specification on integrating websockets into
> HTTP/2? I couldn't find a spec, so I poked around a bit...
>
> It looks to me like there are three issues.
>
> Firstly we should define the handshake in terms of a stream opening on
> an existing HTTP/2 connection, and since Upgrade: is not permitted in
> HTTP/2 ("
> Note:HTTP/2 purposefully does not support upgrade to another protocol.
> The handshake methods described in Section 3 are believed sufficient
> to negotiate the use of alternative protocols.
> ")
>
> its not clear to me if that means we need to define a new frame type,
> or whether we can still use the Upgrade header sanely.
>
>
> Secondly, we need to define websocket frame mappings. The least work,
> and I suspect the easiest for implementors, would be to put all the
> websocket frames into HTTP/2's data frames, without worrying about
> frame alignment: just treat the fully open stream as a series of bytes
> in the same way TCP is treated by the websocket spec.
> I suspect however that a better result would be achieved by defining
> custom HTTP/2 frames, since websockets already have the basic support
> for multiplexing (large application writes can be fragmented into
> smaller frames as needed), we shouldn't run into HOL blocking issues.
>
> Lastly, it seems (to me) that it would be desirable to allow
> PUSH_PROMISE setup of websockets connections, but the PUSH_PROMISE
> state machine goes straight into half-closed, rather than into 'open',
> and that prohibits doing websockets with a pushed connection. There
> isn't any prose in HTTP/2 about /why/ the state machine does that :(.
>
> -Rob
>
> --
> Robert Collins <rbtcollins@hp.com>
> Distinguished Technologist
> HP Converged Cloud
>
>