Re: [hybi] I-D Action:draft-ietf-hybi-thewebsocketprotocol-01.txt

Willy Tarreau <w@1wt.eu> Thu, 23 September 2010 18:52 UTC

Return-Path: <w@1wt.eu>
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 307FA3A6A45 for <hybi@core3.amsl.com>; Thu, 23 Sep 2010 11:52:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.523
X-Spam-Level:
X-Spam-Status: No, score=-2.523 tagged_above=-999 required=5 tests=[AWL=-1.080, BAYES_00=-2.599, HELO_IS_SMALL6=0.556, J_CHICKENPOX_44=0.6]
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 IwO9wejWSRXK for <hybi@core3.amsl.com>; Thu, 23 Sep 2010 11:52:07 -0700 (PDT)
Received: from 1wt.eu (1wt.eu [62.212.114.60]) by core3.amsl.com (Postfix) with ESMTP id 45F4C3A6A67 for <hybi@ietf.org>; Thu, 23 Sep 2010 11:52:04 -0700 (PDT)
Received: (from willy@localhost) by mail.home.local (8.14.4/8.14.4/Submit) id o8NIqTBR024770; Thu, 23 Sep 2010 20:52:29 +0200
Date: Thu, 23 Sep 2010 20:52:29 +0200
From: Willy Tarreau <w@1wt.eu>
To: Greg Wilkins <gregw@webtide.com>
Message-ID: <20100923185229.GD24620@1wt.eu>
References: <op.vif8o0stidj3kv@simon-pieterss-macbook.local> <op.viroqvliidj3kv@simon-pieterss-macbook.local> <AANLkTi=M7DJr=WR3H2o=FCiQLoYdSMxURMpXFjYOFOk3@mail.gmail.com> <op.vjgenvsbidj3kv@simon-pieterss-macbook.local> <AANLkTi=CxRhUpOJ-F-0rxzP14GrnmK__35kF7nrBu9y0@mail.gmail.com> <AANLkTi=3Fwgaw+Uqs_cWiT4jYpEiQt0Layaw3efPjXQV@mail.gmail.com> <op.vjg8lhzl64w2qv@anne-van-kesterens-macbook-pro.local> <AANLkTiknA=90Z0E-K1Vx1rkPemhtHjPL8cxqJJ2D7RpM@mail.gmail.com> <AANLkTin21B7o0-OTroXgvXcDyh_XpMFAtFAVDsCz_Las@mail.gmail.com> <AANLkTinuhrORia+5PHSCVWTgBXJV2hNrYVzGFBJ4BR-5@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <AANLkTinuhrORia+5PHSCVWTgBXJV2hNrYVzGFBJ4BR-5@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
Cc: hybi <hybi@ietf.org>
Subject: Re: [hybi] I-D Action:draft-ietf-hybi-thewebsocketprotocol-01.txt
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, 23 Sep 2010 18:52:08 -0000

On Thu, Sep 23, 2010 at 09:53:21AM -0700, Greg Wilkins wrote:
> On 23 September 2010 08:47, John Tamplin <jat@google.com> wrote:
> > On Thu, Sep 23, 2010 at 11:36 AM, Ian Fette (????????????????????????)
> > <ifette@google.com> wrote:
> >> I will try to put together a -02 by the end of the week and see how far I get, and then let's see how we can move forward.
> >
> > I can help with that if you need it as well.
> >
> >> In my mind, some of the pressing issues remaining are Issue 4 (http://trac.tools.ietf.org/wg/hybi/trac/ticket/4), and any
> >> ideas anyone has (including NPN, or proposing an alternate that still meets the required properties) would be helpful.
> >
> > I thought a couple of people posted that the simple solution of
> > requiring the WS server to not read the random bytes until it had
> > written the 101 response header solved the problem of otherwise
> > functional proxies causing the WS server to hang?
> 
> It may solve "the problem" of a particular intermediary, but I don't
> think it justifies the existence of those random bytes on the wire as
> not HTTP and not Websocket data.
> 
> The inclusion of those bytes was never discussed or justified.

The only valid advantage that I've seen (explained by hixie) was to
validate the ability to talk in both directions. But with the new
framing, you proposed the ping+pong which appeared a lot better to
me because not only does it validate the ability to talk, it also
validates the ability to speak the WebSocket protocol, which is
even more important.

>  There
> is still no rigorous explanation of what benefit they provide that
> could not be provided with an early ping/pong like:
> 
>    Client Handshake (with nonce)  --->
>                   <---- Server handshake
>                   <---- Ping (with hash of nonce)
>    onOpen called
>    Pong ------>
> 
> This give no extra round trip before the client onopen is called and
> verifies that at least server->client websocket data can be sent.   If
> client->server data cannot be sent, then the pong will not be received
> and the connection will be shutdown.

The connection will not necessarily be shutdown in this case. Gateways
that don't understand "upgrade" might only see a GET, and not forward
anything from the client to the server, but only a respose from the
server to the client until the server closes. And unfortunately, the
client has no way to know if its data are delivered.

I think it is reasonable to send the ping from the client first,
provided that we add "Connection: close" in order to prevent anyone
in between from considering the added data as a possible pipelined
request. 

Another thing I really like with a ping+pong opening is that it can
easily be reused and extended for non-HTTP handshakes (even raw TCP).

>   Note that a ws connection can
> fail at any time, so this provides no extra error handling burden on
> applications as they have to handle this case anyway.

100% agree, and that's something that should clearly be stated in the doc.
I too often hear people say "my application *requires* HTTP keep-alive", so
we should be clear that anyone can break the connection without prior notice.

Regards,
Willy