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

On 21/04/2016 6:54 a.m., Roy T. Fielding wrote:
>>> 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.
> 

No right back. It is actively forbidden with a MUST ignore.

RFC 7540 section 3.1:
"
   A server MUST ignore an "h2" token in an Upgrade header field.
"

The loophole for 1.1 case is that RFC7230 is applicable. In this case
where RFC 7540 is applicable that MUST ignore comes into play and comes
down hard.



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

It is actively forbidden with a MUST NOT. Which is very different from
"no way defined".

RFC 7540 section 3.3:
"
   ... The "h2c"
   protocol identifier MUST NOT be sent by a client or selected by a
   server; the "h2c" protocol identifier describes a protocol that does
   not use TLS.
"


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

Exactly my point in that earlier mail.

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

RFC 7540 section 3.3 contradicts you. see above for the applicable quote.

Once you have h2 active you are forbidden from opportunistic downgrade
to the nsecure version of HTTP/2. Even using a secondary TLS layer with
h2c ALPN.

You can move to HTTP/1, HTTP/3, or non-HTTP. But not to h2c.

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


RFC 723x and prior describe things that are allowed and leave the rest
undefined. RFC 7540 breaks that pattern and actively prohibits things -
namely h2c in TLS and h2 outside it.

That makes it rather important to be aware of which RFC a previous
Upgrade or ALPN (if any) negotiated to be applicable. Because being
within 7540 scope limits what edge cases can be using for subsequent
sub-levels of transport.

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

What RFC defines HTTP/2.0 ?

RFC 7540 does not. It is clear on that.

At best you end up with TLS negotiated, which bring in the ALPN choice
between 'h2', 'http/1.1' or non-HTTP. Still not having reached h2c over TLS.


IIRC we had these arguments already when a group of us tried to prevent
the h2/h2c split. And still we are where we are.

Amos

Received on Thursday, 21 April 2016 10:51:32 UTC