Re: [hybi] Handshake was: The WebSocket protocol issues.

Patrick McManus <mcmanus@ducksong.com> Tue, 12 October 2010 18:54 UTC

Return-Path: <mcmanus@ducksong.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 BB9753A6A01 for <hybi@core3.amsl.com>; Tue, 12 Oct 2010 11:54:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.618
X-Spam-Level:
X-Spam-Status: No, score=-2.618 tagged_above=-999 required=5 tests=[AWL=-0.019, 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 WQpQsbajPyzk for <hybi@core3.amsl.com>; Tue, 12 Oct 2010 11:54:33 -0700 (PDT)
Received: from linode.ducksong.com (linode.ducksong.com [64.22.125.164]) by core3.amsl.com (Postfix) with ESMTP id E31FC3A6A15 for <hybi@ietf.org>; Tue, 12 Oct 2010 11:54:32 -0700 (PDT)
Received: by linode.ducksong.com (Postfix, from userid 1000) id A131D10300; Tue, 12 Oct 2010 14:55:47 -0400 (EDT)
Received: from [192.168.16.226] (cpe-67-253-92-25.maine.res.rr.com [67.253.92.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by linode.ducksong.com (Postfix) with ESMTPSA id A6981102A5; Tue, 12 Oct 2010 14:55:45 -0400 (EDT)
From: Patrick McManus <mcmanus@ducksong.com>
To: Willy Tarreau <w@1wt.eu>
In-Reply-To: <20101009204009.GP4712@1wt.eu>
References: <4CAF9589.1060007@caucho.com> <AANLkTinnnT5Oib7FvDdZF2q_WUT8=q8KNmfkfajE0Mor@mail.gmail.com> <4CAFA043.10101@caucho.com> <AANLkTi=eo-cjBz160FN0cn53v4-CpDSYaEneqkr_ZP7k@mail.gmail.com> <4CAFAC2B.5000800@caucho.com> <55bva61goeqtn0lifgjt5uihf50obh7kf4@hive.bjoern.hoehrmann.de> <4CAFB9C4.6030905@caucho.com> <AANLkTinv5Ym5jwUEqS76z3UkVa7GpmOBT_WXhBbFK0-m@mail.gmail.com> <20101009055723.GL4712@1wt.eu> <AANLkTimY2DjxgZybibSRtc7L34Wns2KhQC=Wa9K6PYku@mail.gmail.com> <20101009204009.GP4712@1wt.eu>
Content-Type: text/plain; charset="UTF-8"
Date: Tue, 12 Oct 2010 14:55:30 -0400
Message-ID: <1286909730.2924.1992.camel@ds9.ducksong.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.3
Content-Transfer-Encoding: 7bit
Cc: hybi <hybi@ietf.org>, Bjoern Hoehrmann <derhoermi@gmx.net>
Subject: Re: [hybi] Handshake was: The WebSocket protocol issues.
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: Tue, 12 Oct 2010 18:54:34 -0000

On Sat, 2010-10-09 at 22:40 +0200, Willy Tarreau wrote:

> > As I understand this suggestion, for it to provide security it relies on
> > servers always
> > treating any message with Connection: close as the final message. I don't
> > know if
> > servers always do this correctly, but since it's not really required for
> > interoperability,
> > I suspect that some do not.
> 
> I really don't buy that.

Unfortunately, Willy, I do buy it. I think I may have even implemented
such a server :(

As you know the side that issues the active TCP close goes into
TIME-WAIT.. My server was actually a very busy intermediary and I was
trying to avoid building up a gigantic pile of close-waits on it... so
the server side would not close the connection immediately after
completing the response unless it needed to do so to delimit the
response. instead it would presume that if the client didn't want a
persistent connection it would close the socket pretty soon itself so I
tossed it in the persistent reuse pool with a very short timeout -
anticipating that the active FIN would arrive from the client before the
timeout expired -  Which turned out to be true - I never saw a case of a
client depending on the server closing the connection other than in
cases without (at least) a Content-Length in the response. If the client
went ahead and sent another request I presume the code would have
dispatched it normally even though the previous one said "close", I
don't have access to the code to check it right now.

> tools, otherwise you get back to the situation where both sides wait for
> the other one to close. 

Either side is free to close at any time, right?

> makes some sense, but saying that some won't support close clearly does
> not.

I would agree with this regarding the "connection: close" response
header, but not the request header. It is largely meaningless.