Re: [hybi] Clarify the role of closing handshake

Greg Wilkins <gregw@webtide.com> Thu, 10 February 2011 01:04 UTC

Return-Path: <gregw@intalio.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 6BBC53A682D for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 17:04:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.77
X-Spam-Level:
X-Spam-Status: No, score=-1.77 tagged_above=-999 required=5 tests=[AWL=1.207, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
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 J0Mkf0eDi67G for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 17:04:02 -0800 (PST)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) by core3.amsl.com (Postfix) with ESMTP id 7FDA13A684D for <hybi@ietf.org>; Wed, 9 Feb 2011 17:04:02 -0800 (PST)
Received: by vws7 with SMTP id 7so540470vws.31 for <hybi@ietf.org>; Wed, 09 Feb 2011 17:04:13 -0800 (PST)
MIME-Version: 1.0
Received: by 10.220.190.197 with SMTP id dj5mr3300239vcb.4.1297299852954; Wed, 09 Feb 2011 17:04:12 -0800 (PST)
Sender: gregw@intalio.com
Received: by 10.220.77.205 with HTTP; Wed, 9 Feb 2011 17:04:12 -0800 (PST)
In-Reply-To: <AANLkTi=wAwQHGbu_vVS5o9yNuC-M=e_hWwtU5F6UPGqm@mail.gmail.com>
References: <AANLkTi=wAwQHGbu_vVS5o9yNuC-M=e_hWwtU5F6UPGqm@mail.gmail.com>
Date: Thu, 10 Feb 2011 12:04:12 +1100
X-Google-Sender-Auth: 4BAC3XGF-vA13XR5MXGNz_s3Nfo
Message-ID: <AANLkTimGHPmGSB1hCr2VJ3O8bFJiEkvdkvqptt6A8mBA@mail.gmail.com>
From: Greg Wilkins <gregw@webtide.com>
To: Takeshi Yoshino <tyoshino@google.com>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: hybi@ietf.org
Subject: Re: [hybi] Clarify the role of closing handshake
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, 10 Feb 2011 01:04:03 -0000

One of the other aims of the closing handshake was to better identify
error condition, so as to prevent a client repeating unacceptable
operations.

For example, if a client sends a frame that is too large for the
server to handle, the server needs to indicate that an error condition
has occurred.  If the connection is closed (orderly or otherwise) ,
then the client might assume that it was an idle shutdown or transient
condition on the server and thus open a new connection and continue to
send over large frames.


Currently -05 says:

7.1.2.  Server-initiated closure
   Certain algorithms require or recommend that the server *abort the
   WebSocket connection* during the opening handshake.  To do so, the
   server must simply close the WebSocket connection.


the problem with this is that for a client such a close of the
websocket connection cannot be distinguished from a
network/intermediary failure.   I think that typically an aborted
connection should not be retried, but a network/intermediary failure
should be - so it would be good to be able to signal to the client the
difference.

Thus I'd like to suggest that the close handshake carry a single byte
of reason for the close.
I think it would be sufficient to define just:

  0x00 Normal close
  0x01 Abnormal close

But I could see an argument for something a little richer:

 0x00 Idle close
 0x01 close
 0x02 abnormal close

but I concede that the danger here is trying to define too many close states