Re: HTTP/2 Upgrade with content?

Stefan Eissing <stefan.eissing@greenbytes.de> Fri, 13 March 2015 07:02 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ietf.org@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 7981C1AC40B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 13 Mar 2015 00:02:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.91
X-Spam-Level:
X-Spam-Status: No, score=-6.91 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 v36gqSRvHLkF for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 13 Mar 2015 00:02:40 -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 EF4541A8A7F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 13 Mar 2015 00:02:39 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1YWJXu-0004m4-TM for ietf-http-wg-dist@listhub.w3.org; Fri, 13 Mar 2015 06:58:10 +0000
Resent-Date: Fri, 13 Mar 2015 06:58:10 +0000
Resent-Message-Id: <E1YWJXu-0004m4-TM@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.80) (envelope-from <stefan.eissing@greenbytes.de>) id 1YWJXj-0004l1-Rc for ietf-http-wg@listhub.w3.org; Fri, 13 Mar 2015 06:57:59 +0000
Received: from mail.greenbytes.de ([217.91.35.233]) by maggie.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <stefan.eissing@greenbytes.de>) id 1YWJXg-0000CR-J6 for ietf-http-wg@w3.org; Fri, 13 Mar 2015 06:57:59 +0000
Received: from [192.168.178.31] (unknown [84.150.84.219]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mail.greenbytes.de (Postfix) with ESMTPSA id 6A2C815A0659; Fri, 13 Mar 2015 07:57:32 +0100 (CET)
Content-Type: multipart/alternative; boundary="Apple-Mail-C52A36DA-2E59-4511-ABA4-62B72586C0A6"
Mime-Version: 1.0 (1.0)
From: Stefan Eissing <stefan.eissing@greenbytes.de>
X-Mailer: iPhone Mail (12D508)
In-Reply-To: <CAH_y2NFV=Z7hqbtWTdiePRwUnhhRjiP8R_Ua7kmpZEkwXtxgEA@mail.gmail.com>
Date: Fri, 13 Mar 2015 07:57:30 +0100
Cc: Mike Bishop <Michael.Bishop@microsoft.com>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: 7bit
Message-Id: <B5C01B7A-9215-4268-B189-E6281F425BF7@greenbytes.de>
References: <CAH_y2NF3iwND1ttQDY98KC_u=OZj5aqEABmXHKObMgqPH1npLg@mail.gmail.com> <BL2PR03MB1323474B977B051738AD09187060@BL2PR03MB132.namprd03.prod.outlook.com> <CAH_y2NFV=Z7hqbtWTdiePRwUnhhRjiP8R_Ua7kmpZEkwXtxgEA@mail.gmail.com>
To: Greg Wilkins <gregw@intalio.com>
Received-SPF: pass client-ip=217.91.35.233; envelope-from=stefan.eissing@greenbytes.de; helo=mail.greenbytes.de
X-W3C-Hub-Spam-Status: No, score=-0.0
X-W3C-Hub-Spam-Report: HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001
X-W3C-Scan-Sig: maggie.w3.org 1YWJXg-0000CR-J6 c357b8c66de98630e895f72e25abf45e
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP/2 Upgrade with content?
Archived-At: <http://www.w3.org/mid/B5C01B7A-9215-4268-B189-E6281F425BF7@greenbytes.de>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/28949
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>

Thanks for bringing this up. I am at the same branch in the road in my mod_h2 implementation. 

So far, I decided to silently skip the upgrade on any request with a body, to make it predictable for a client. Not to succeed in a small test case and fail in production. 

It would be good to
- hear from clients what they prefer/expect. there could be a response header "upgrade: no-conten" or such
- get the same server behaviour across implementations for interop purposes

Cheers,

  Stefan



> Am 13.03.2015 um 02:04 schrieb Greg Wilkins <gregw@intalio.com>:
> 
> 
> Mike,
> 
> the requirement of 3.2 is different to a normal HTTP/1.1 request.   Normally there is no requirement for a server to buffer the entire request body before commencing handing of a normal HTTP/1.1 request.    Typically the application is called and a streaming API used to provide the content to the request handler.   Note that this is not a block or not to block question - modern HTTP/1.1 servers are perfectly capable of consuming content via asynchronous IO.
> 
> Thus from the servers point of view, the memory commitment required to service a single connection is the buffer size that it uses to read the request content.   Now applications might then aggregate those buffers and attempt to hold the entire content in memory, but that is an application responsibility and the server cannot do much about that.
> 
> This requirement is different.  It is allowing an arbitrary sized body content to be sent in the HTTP/1.1 request that must be held by the server so that it can be fed to the HTTP/2 handling of the request that takes place after the upgrade and after the 101 has been sent.
> 
> I guess technically the new HTTP2 connection could work in a mode where it receives content as HTTP/1.1 but sends the response as HTTP/2.... but that is a) stupidly complex for a mechanism that browser say they will not implement anyway; b) just asking for a deadlock if the response is large and requires flow control frames to be received that cannot be sent until the entire body is consumed.
> 
> But you point about upgrades failing for all sorts of reasons is a valid one.  So I agree that 413 is not the right response and that simply ignoring the upgrade on requests that have too large bodies (or perhaps any body at all for simplicity), is probably the right thing to do.
> 
> cheers
> 
> 
> 
> 
> 
> 
>> On 13 March 2015 at 10:47, Mike Bishop <Michael.Bishop@microsoft.com> wrote:
>> A server is blocked on the connection, just as it would be in HTTP/1.1.  The situation for the server is no worse than if the client weren’t offering Upgrade.  Servers will enforce the same limits of large bodies they’re not willing to handle.  Issuing a 413, telling the client that the reason their request isn’t being serviced is due to the size of the body, is confusing if the actual way to make it be serviced is to omit the Upgrade header.  That’s a bizarre use of 413.
>> 
>>  
>> 
>> My inclination would be for servers to ignore the Upgrade header if they don’t want to be blocked.  Clients will always need to handle Upgrade headers being ignored, since they can legitimately be stripped by intermediaries.  Clients will never understand all the reasons why some Upgrades work and some don’t – they have to handle both cases cleanly.
>> 
>>  
>> 
>> From: Greg Wilkins [mailto:gregw@intalio.com] 
>> Sent: Thursday, March 12, 2015 4:10 PM
>> To: HTTP Working Group
>> Subject: HTTP/2 Upgrade with content?
>> 
>>  
>> 
>>  
>> 
>> Section 3.2 describes the upgrade to HTTP/2 and it allows support for upgrade requests with bodies:
>> 
>>    Requests that contain an entity body MUST be sent in their entirety
>>    before the client can send HTTP/2 frames. This means that a large
>>    request entity can block the use of the connection until it is
>>    completely sent.
>> Servers will need to protect themselves from DoS attacks via such requests as buffering arbitrary large content in their entirety is a commitment that servers cannot generally give.
>> 
>> Thus servers will have to limit the size of the entities they are prepared to hold in this situation (and the size of a single normal request buffers is probably the memory commitment they are prepared to make for any given connection).
>> 
>>  
>> 
>> My question is, what should a server do if it receives an otherwise valid upgrade request that it could handle but with content that exceeds this memory limit?      Should it respond with a 413 REQUEST_ENTITY_TOO_LARGE or should it just ignore the upgrade and let the request be handled via HTTP/1.1 (which can stream the content into the request handler and it becomes somebody else's problem to limit memory usage).
>> 
>> My problem with ignoring the upgrade is that it is an arbitrary limit and it will be hard for clients to tell why some upgrades work and others do not.
>> 
>> Alternately my problem with 413 is that some servers might wish to avoid the whole upgrade with content path and thus send a 413 for any upgrade with content, which may break some clients that could otherwise proceed with HTTP/1.1
>> 
>> thoughts?
>> 
>>  
>> 
>> PS. in hindsight, I would rather that we had not allowed upgrades with content and instead told clients to upgrade with an OPTION request prior to any PUT/POST request.... gallop... gallop... gallop.... SLAM!
>> 
>> 
>> 
>> 
>> --
>> 
>> Greg Wilkins <gregw@intalio.com>  @  Webtide - an Intalio subsidiary
>> http://eclipse.org/jetty HTTP, SPDY, Websocket server and client that scales
>> http://www.webtide.com  advice and support for jetty and cometd.
>> 
> 
> 
> 
> -- 
> Greg Wilkins <gregw@intalio.com>  @  Webtide - an Intalio subsidiary
> http://eclipse.org/jetty HTTP, SPDY, Websocket server and client that scales
> http://www.webtide.com  advice and support for jetty and cometd.