Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FAAC18A3C for ; Wed, 9 Dec 2015 20:03:06 +0000 (UTC) Received: (qmail 53689 invoked by uid 500); 9 Dec 2015 20:03:00 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 53617 invoked by uid 500); 9 Dec 2015 20:03:00 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 53607 invoked by uid 99); 9 Dec 2015 20:03:00 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Dec 2015 20:03:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 23BDC180A77 for ; Wed, 9 Dec 2015 20:03:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id zpenNy66roXy for ; Wed, 9 Dec 2015 20:02:50 +0000 (UTC) Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 4AC6A428ED for ; Wed, 9 Dec 2015 20:02:50 +0000 (UTC) Received: by pfdd184 with SMTP id d184so34917192pfd.3 for ; Wed, 09 Dec 2015 11:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=Vw0vKjA6htipXcsYYTQJEOFzLdG38f2BRsCBffMJN3U=; b=lFVJ2rigoSwhTUT7vo+oXVJmbN7erVm4i1gAiFqfwf178y8ZVFdmAKFdPFaJhrRG29 Zx3Sy2KwQHFiWYIQNv4tTNI72vc1kmFgbynSs4ftWqdqSh4AhdvRWbPec0w/NONzdH0y fo3UJW0dHR33ldOssQxHUdtjjzYnKgSKT9D/iOQqgJ/mUikzbN5yUlqIbZynN3bqZe+i Q8ETprrSQ++KMB3UybhRQlLvhLMk9vxMFZ3mlc7iH5qxoUwZEY9j+RL2QNzPiol/XXf+ Fz4xLt++TSWl6G3dQU2YJvNe5QjoJ3pQ4rnSc1ipLPVJsCffdIfQdituQNxSTpEdFBiV Jkiw== X-Received: by 10.98.42.9 with SMTP id q9mr871011pfq.142.1449691063338; Wed, 09 Dec 2015 11:57:43 -0800 (PST) Received: from [192.168.1.4] (50-39-117-165.bvtn.or.frontiernet.net. [50.39.117.165]) by smtp.gmail.com with ESMTPSA id s15sm13453000pfs.31.2015.12.09.11.57.41 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Dec 2015 11:57:41 -0800 (PST) Subject: Re: Upgrade Summary To: dev@httpd.apache.org References: <56660896.c74fc20a.15f56.0ebd@mx.google.com> <56660B43.2060507@gmail.com> <6B13DF2B-0586-42BB-B62F-59A7638B697D@greenbytes.de> <13FE9E7F-9620-4BF9-8EA4-57A6314D66BF@greenbytes.de> <9CCEFD7E-9ED3-4ED1-8F58-2134DD5310F9@gbiv.com> From: Jacob Champion Message-ID: <566887B5.2080705@gmail.com> Date: Wed, 9 Dec 2015 11:57:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 12/09/2015 09:17 AM, William A Rowe Jr wrote: > On Tue, Dec 8, 2015 at 9:10 PM, Roy T. Fielding > wrote: > > > On Dec 8, 2015, at 2:07 AM, Stefan Eissing > > wrote: > > > > Open: > > 1. Protocols like Websocket need to take over the 101 sending themselves in the "switch protocol" phase. (correct, Jacob?). Should we delegate the sending of the 101 to the protocol switch handler? > > That seems unlikely. > > > Agreed, anywhere we like we can send the 101 with headers, all that the > websocket module needed to do was to set up output_headers or perhaps we > add intermediate_output_headers in the request structure. Easily fixed > so this code is still common... +1. > This should be easily handled by adding a filter that translates the > HTTP/1 > incoming body (if any) to a single channel of the new protocol. > Just fake it. > There is no need to wait or set aside the bytes, unless that is > desired for > other reasons (e.g., denial of denial of service attacks). > > However, we must read the request body complete before the input handler > is toggled to the h2c state, or before we switch to any bidirectional > protocol, e.g. TLS or otherwise. For my own clarification: this is a protocol-specific limitation, right? As in, you can't begin a TLS handshake without first draining the incoming request body off the connection. > > > 3. When to do the upgrade dance: > > a post_read_request: upgrade precedes authentication > > b handler: upgrade only honored on authenticated and otherwise ok requests > > c both: introduce separate hooks? have an additional parameter? more complexity > > (a). We do want to upgrade non-ok responses. If the "new" protocol > wants to > send a canned HTTP/1.1 error, it can do so without our help. > > > +1 in the case of h2c, TLS. I understand that websocket upgrades are > going to be conditional on authentication. As long as we give websocket > the chance to upgrade in the fixups or similar phase, after auth, then > websocket can ignore the Upgrade: websocket offer after inspecting authnz. Sounds reasonable. Unfortunate in the sense that it's possible for a module implementing the Upgrade API to screw up and accidentally ignore authnz, but since most protocols we're talking about can safely upgrade first and respond with 401/3 on the new protocol, I don't see much of an alternative. > > 4. status code of protocol switch handler: if we move the task of 101 sending, the switch handler might not do it and keep the connection on the "old" protocol. Then a connection close is not necessary. So, we would do the close only when the switch handler returns APR_EOF. > > Eh? > > I'm wondering the same, the new protocol loop can do all of the > connection handling, no need for the protocol switch to do anything but > continue, if the connection is ended in the protocol handler, it's gone. Why leave it up to the protocol handler (to potentially get wrong)? Are there any cases where, after a successful upgrade, we would not want to close the connection upon returning from the protocol handler? --Jacob