Re: Is the response header "Upgrade: h2" allowed when TLS is used?

"Roy T. Fielding" <fielding@gbiv.com> Wed, 20 April 2016 19:00 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@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 (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 14FE212EF3C for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 20 Apr 2016 12:00:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.017
X-Spam-Level:
X-Spam-Status: No, score=-8.017 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.996, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=gbiv.com
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 b_L58n18MshD for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 20 Apr 2016 12:00:26 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 54A2212EA34 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 20 Apr 2016 12:00:22 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1asxI6-0002OQ-6t for ietf-http-wg-dist@listhub.w3.org; Wed, 20 Apr 2016 18:55:58 +0000
Resent-Date: Wed, 20 Apr 2016 18:55:58 +0000
Resent-Message-Id: <E1asxI6-0002OQ-6t@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <fielding@gbiv.com>) id 1asxI0-0002MX-Jw for ietf-http-wg@listhub.w3.org; Wed, 20 Apr 2016 18:55:52 +0000
Received: from sub4.mail.dreamhost.com ([69.163.253.135] helo=homiemail-a54.g.dreamhost.com) by maggie.w3.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from <fielding@gbiv.com>) id 1asxHu-0008Cb-7L for ietf-http-wg@w3.org; Wed, 20 Apr 2016 18:55:51 +0000
Received: from homiemail-a54.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a54.g.dreamhost.com (Postfix) with ESMTP id 2FCAA400F8A33; Wed, 20 Apr 2016 11:54:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=content-type :mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=eivPNJActU+C8TjGzw+OSgB0B5w=; b=ctEiCeLs0qGviHjnQwEV+HBjnKe6 6M7uespe5OURzSqlI3IC6R0YDRC1PbkudvqZ+ULOYXoHqemHXRRGKGxqablHIU1P +BhdubpfqH0fci3s14KUg5dgJY1fSzjqUW7b80a7UjTEBMdWwl7AGQB1Ao34mlaM 6Y1BnvHaM0iTKbc=
Received: from [192.168.1.2] (ip68-228-71-159.oc.oc.cox.net [68.228.71.159]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a54.g.dreamhost.com (Postfix) with ESMTPSA id E514040136D00; Wed, 20 Apr 2016 11:54:54 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <91D281BC-F987-488B-AEEB-6F52EE7802AB@greenbytes.de>
Date: Wed, 20 Apr 2016 11:54:38 -0700
Cc: Mike Bishop <Michael.Bishop@microsoft.com>, Michael Kaufmann <mail@michael-kaufmann.ch>, Stefan Eissing <stefan.eissing@greenbytes.de>
Content-Transfer-Encoding: quoted-printable
Message-Id: <9856746B-8E56-4B9D-BA2B-B4E31BFFCC69@gbiv.com>
References: <20160419161634.Horde.7_VYZk5McZE4CAiQrQh-uXr@webmail.michael-kaufmann.ch> <7CF7F94CB496BF4FAB1676F375F9666A2A7CBD72@bgb01xud1012> <BE75D624-3A89-463A-B860-A2E83613C199@lukasa.co.uk> <5CBBE2E0-BA35-42B6-9E19-D658753D593B@greenbytes.de> <825033AC-9E67-4B81-84E6-FC5C67112037@lukasa.co.uk> <57165D31.5070604@treenet.co.nz> <20160419233014.Horde.pDb9tRgUZYP9jgWUZg3sUna@webmail.michael-kaufmann.ch> <CH1PR03MB1916F1E7699825ACC4D741AA876C0@CH1PR03MB1916.namprd03.prod.outlook.com> <91D281BC-F987-488B-AEEB-6F52EE7802AB@greenbytes.de>
To: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
X-Mailer: Apple Mail (2.2104)
Received-SPF: none client-ip=69.163.253.135; envelope-from=fielding@gbiv.com; helo=homiemail-a54.g.dreamhost.com
X-W3C-Hub-Spam-Status: No, score=-6.7
X-W3C-Hub-Spam-Report: AWL=0.015, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1asxHu-0008Cb-7L cd0eb47750b095acc40a5ca120b6010a
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Is the response header "Upgrade: h2" allowed when TLS is used?
Archived-At: <http://www.w3.org/mid/9856746B-8E56-4B9D-BA2B-B4E31BFFCC69@gbiv.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31527
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>

>> Am 19.04.2016 um 23:47 schrieb Mike Bishop <Michael.Bishop@microsoft.com>:
>> 
>> That would seem reasonable.  Hypothetically, a server could attempt RFC 2817-style Upgrade to TLS and then select "h2" as the ALPN token during the TLS handshake.  A logical flow for carrying the initial request into the h2 context would look a lot like that for h2c -- stream 1 is half-closed and already "contains" the client's initial request.  However, that still wouldn't use an "h2" Upgrade token and isn't actually defined anywhere.
>> 
>> "Upgrade: h2c" or offer Alt-Svc if you want to switch to HTTP/2 on a different, encrypted connection.
>> 
>> -----Original Message-----
>> From: Michael Kaufmann [mailto:mail@michael-kaufmann.ch] 
>> Sent: Tuesday, April 19, 2016 2:30 PM
>> To: ietf-http-wg@w3.org
>> Subject: Re: Is the response header "Upgrade: h2" allowed when TLS is used?
>> 
>> Zitat von Amos Jeffries <squid3@treenet.co.nz>:
>> 
>>> On 20/04/2016 4:07 a.m., Cory Benfield wrote:
>>>> 
>>>> Heh, I missed that. With that note, then, I’d say that Apache should 
>>>> stop putting h2 in the Upgrade header on a TLS-using connection
>>>> *unless* it believes that connection is for a HTTP-schemed URL, when 
>>>> it should put h2c.
>>>> 
>>>> Cory
>>>> 
>>> 
>>> 
>>> I think you are all overlooking the basic details:
>>> 
>>> * RFC 7540 does not govern HTTP/1.1 connections, even TLS ones.
>>> 
>>> * RFC 7540 section 3.2 is about negotiating http:// URLs over non-TLS 
>>> connections.
>>> 
>>> 
>>> When the client has negotiated for HTTP/1.1 over TLS to happen (aka 
>>> HTTPS). It is appropriate to Upgrade:h2. Since RFC 723x applies.

It can be interpreted that way, yes.

>>> But when the client negotiates h2c to happen. It is forbidden from 
>>> using
>>> Upgrade:h2 to get to h2. Avoiding the issues Upgrade would have with 
>>> only one-way encryption for the message pair.

Well, no, h2 as a token presumes a completely secured TLS connection.  How you get
there is left up to the client and server to negotiate.

>>> Note that h2c is also forbidden from being used in ALPN by section 3.3.
>>> So there is no valid way to be using TLS for h2c in the first place.

No, there is just no way defined by RFC7540. That doesn't mean it can't be implemented.
TLS is just a connection.

>>> If one is already using h2 it is pointless to Upgrade:h2.
>>> 
>> 
>> I have just realized that RFC 7540 registers the "h2c" upgrade token (section 11.8) but it does NOT register an "h2" upgrade token. (it also registers the identification strings "h2" and "h2c" for ALPN in section 11.1, but that is a different thing)
>> 
>> The upgrade token "h2" probably does not exist according to the RFCs.  
>> It is also not mentioned here:  
>> http://www.iana.org/assignments/http-upgrade-tokens/http-upgrade-tokens.xhtml
>> 
>> So when using TLS, servers should not send "Upgrade: h2" because "h2"  
>> is an undefined upgrade token.

No, that presumes only registered tokens can be used.  HTTP/1.1 is not so limited.

>> And also when using TLS, servers should not send "Upgrade: h2c" because h2c means "HTTP/2 using cleartext TCP", and a connection that uses TLS cannot be "upgraded" to a connection that does not use TLS.

No, because TLS is just a connection.  For example, it might be opportunistic TLS.
Or it might be a configured tunnel over TLS or SSH of which the HTTP level is unaware.

It is better to think of the tokens as a protocol of their own, rather than a reference
to a specific protocol with the same name (or not, in the case of h2).  In other words,
the "h2c" token has a defined way of being interpreted that might result in some set of
actions by the recipient to reach some other state.  Likewise for h2, even though its
interpretation has not been defined by the registry.

BTW, if you send "Upgrade: HTTP/2.0, TLS", its interpretation is defined by RFC7230.


Cheers,

Roy T. Fielding                     <http://roy.gbiv.com/>
Senior Principal Scientist, Adobe   <http://www.adobe.com/>