Re: [hybi] More on Payload Masking

Scott Ferguson <ferg@caucho.com> Thu, 11 November 2010 17:34 UTC

Return-Path: <ferg@caucho.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 5EE853A6909 for <hybi@core3.amsl.com>; Thu, 11 Nov 2010 09:34:28 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W++U6WJ0c05c for <hybi@core3.amsl.com>; Thu, 11 Nov 2010 09:34:27 -0800 (PST)
Received: from smtp115.biz.mail.re2.yahoo.com (smtp115.biz.mail.re2.yahoo.com [66.196.116.35]) by core3.amsl.com (Postfix) with SMTP id EF38A3A6975 for <hybi@ietf.org>; Thu, 11 Nov 2010 09:34:21 -0800 (PST)
Received: (qmail 63789 invoked from network); 11 Nov 2010 17:34:49 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp115.biz.mail.re2.yahoo.com with SMTP; 11 Nov 2010 09:34:49 -0800 PST
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: Yq.hrLoVM1lJw2AD0elCp3mw9GMwEJzFPagA.4_pXkMQq6H oA75LBVig_qGL97GVTze0J1muxk1HxhYcS7VfRBB2G_x_NqTZXMOp7Qmp71u iPsvHAOswF5lFnOgvvZ3izkhFJHayrK8tjnb3CiVOBTAFo24y7IW82HVw4Uf MtgnYqbLOTu74812cWNjnvVD2Og39q3DfEj6l1dfEREq23oDUMNwfbQ_Hkkt tiVtgALwf
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4CDC2938.8080303@caucho.com>
Date: Thu, 11 Nov 2010 09:34:48 -0800
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Willy Tarreau <w@1wt.eu>
References: <AANLkTi=Q3oAM1rdqPHTLffN_yEGPCY9VM0CXPiNU4R79@mail.gmail.com> <AANLkTimVS=yxw8subceZu8=fEuiJCQgF7rg4DYx_vzqn@mail.gmail.com> <20101111062936.GB487@1wt.eu>
In-Reply-To: <20101111062936.GB487@1wt.eu>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] More on Payload Masking
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Nov 2010 17:34:28 -0000

Willy Tarreau wrote:
> On Thu, Nov 11, 2010 at 03:13:26PM +1100, Greg Wilkins wrote:
>   
>   
>> Note that some of the proposed changes to
>> the framing mechanism (FIN bit ) are intended to make it even less
>> likely that a WS frame could be mistaken for a HTTP request.
>>     
>
> I'd like to add that it is important to understand that designing a
> keep-alive compatible intermediary involves much stricter protocol
> compliance than just being able to process a first HTTP request in
> a connection, because you are forced to find some required headers
> (connection, content-length, transfer-encoding, ...) and have to always
> remain synced with the data that flow. The slightest approximation in
> the protocol can very quickly get you out of sync and make the component
> totally unreliable, hanging on downloads, randomly spewing errors, etc...
> So while it is possible to design a working intermediary which does not
> support Upgrade nor CONNECT, it's almost not possible to design one that
> magically works through invalid framing.
>   

+1

Repeating Willy's point for emphasis: a keepalive server/proxy must 
parse all framing content for keepalives to work, including http 
headers, chunking, etc. for both the request and the response. It cannot 
skip invalid bytes and continue the keepalive. Because there's no way to 
recover from the framing errors, the server/proxy needs to close the 
connection after the error if the HTTP framing breaks.

For example, in the case of NPH scripts, a server has to close the 
connection when the NPH script completes because the server doesn't know 
if the script responded with Connection: close or if the script even had 
a valid Content-Length/chunking.

-- Scott