Re: HTTP2 server-side stream creation

Andy Green <> Fri, 02 August 2019 00:47 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 2C355120089 for <>; Thu, 1 Aug 2019 17:47:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.201, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id Q0OdsxjFk1sl for <>; Thu, 1 Aug 2019 17:46:57 -0700 (PDT)
Received: from ( [IPv6:2603:400a:ffff:804:801e:34:0:38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 96FE9120073 for <>; Thu, 1 Aug 2019 17:46:57 -0700 (PDT)
Received: from lists by with local (Exim 4.89) (envelope-from <>) id 1htLfY-00009b-Ij for; Fri, 02 Aug 2019 00:43:40 +0000
Resent-Date: Fri, 02 Aug 2019 00:43:40 +0000
Resent-Message-Id: <>
Received: from ([2603:400a:ffff:804:801e:34:0:4f]) by with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <>) id 1htLfW-00008e-1A for; Fri, 02 Aug 2019 00:43:38 +0000
Received: from ([]) by with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <>) id 1htLfU-00040R-7O for; Fri, 02 Aug 2019 00:43:37 +0000
Date: Fri, 02 Aug 2019 01:43:05 +0100
User-Agent: K-9 Mail for Android
In-Reply-To: <>
References: <>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
To:, Ben Maurer <>, HTTP Working Group <>
From: Andy Green <>
Message-ID: <>
Received-SPF: pass client-ip=;;
X-W3C-Hub-Spam-Status: No, score=-2.9
X-W3C-Hub-Spam-Report: AWL=1.002, BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: 1htLfU-00040R-7O 2db47fa43d1b0297f952d036628d4707
Subject: Re: HTTP2 server-side stream creation
Archived-At: <>
X-Mailing-List: <> archive/latest/36928
Precedence: list
List-Id: <>
List-Help: <>
List-Post: <>
List-Unsubscribe: <>

On August 1, 2019 10:00:28 PM GMT+01:00, Ben Maurer <>; wrote:
>I've currently been looking at framing protocols that are appropriate
>use in a peer to peer context where there is less of a distinction
>client and server.
>This 4-year-old thread (which I selected an email in the middle of,
>best represents the core of the question) discusses this type of

This has been an interesting subject for properly integrated ws-over-h2 and other things that just wanted opaque bidi streams-on-h2 too.

>Even though the spec says that "Clients send HTTP requests and receive
>responses" it also states that "Streams initiated by a client MUST use
>odd-numbered stream identifiers; those initiated by the server MUST use
>even-numbered stream identifiers". This implies that servers can in
>receive some sort of request and provide a response.

Maybe you meant "...clients can in fact receive...", it's not contraversial http servers receive requests and provide responses.  However I think they are talking about something more mundane there... PUSH_PROMISE streams where the server takes the initiative to respond to one incoming request also by opening additional even-numbered outgoing streams, each with their own HEADERS and still following http semantics.

>The thread seems to conclude that it's at least plausible to use HTTP2
>this context.
>I attempted to find conversations since that time and couldn't find
>I'm curious if people are aware of any attempts to take this approach.

There are drafts flying around that take various approaches to trying to do this.  But I think none of them tried to just use DATA frames in both directions as much as you like... they introduced a SETTINGS to indicate they could handle bidi streams and usually a new frame type.

The difficulty they were circumventing is that in the standardized http implementation, DATA in a stream can either be request body or response body... those two things are serialized in http.  What existing servers or clients or intermediaries would do if they see more server DATA coming after they completed an http transaction, is a bit unpredictable.

>As a more concrete example, imagine one were creating a protocol like
>bittorrent (where both peers of a connection may initiate requests)
>HTTP2 be an appropriate base layer for that protocol (allowing either
>to initiate a request a chunk of data in the case of bittorrent).

Take a look at rfc8441

It shows one way to have an opt-in escape hatch out of the standardized http straitjacket.  Once you have the extended stream established, basically it provides an analogue of tcp connection state handling, either side can "send a FIN" / RST_STREAM etc.  Although RFC8441 is struggling implementation-wise, it seems quite workable in terms of surviving negotiating it through common intermediaries.

So AFAIK it should be workable.  A side effect would be in addition to spawning lots of h2 client connections, every peer would want to be an h2 server on tcp listening through NAT etc somehow... it's a bit different than udp.