[hybi] Clarify the role of closing handshake

Takeshi Yoshino <tyoshino@google.com> Thu, 10 February 2011 00:05 UTC

Return-Path: <tyoshino@google.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 3C3973A67AD for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 16:05:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -103.676
X-Spam-Level:
X-Spam-Status: No, score=-103.676 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MANGLED_TOOL=2.3, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 3Y0eDM2j8KXY for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 16:05:26 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id E10193A67AC for <hybi@ietf.org>; Wed, 9 Feb 2011 16:05:25 -0800 (PST)
Received: from hpaq13.eem.corp.google.com (hpaq13.eem.corp.google.com [172.25.149.13]) by smtp-out.google.com with ESMTP id p1A05ZIl010546 for <hybi@ietf.org>; Wed, 9 Feb 2011 16:05:35 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1297296336; bh=kmhUtCRytUrgcHnJl2cPNVjPX8U=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=ufXMt7xBl2wJAJyYvINHLs5SejMIv59fKJdmSNBdGF89QC5Re2GbGERpS3rIPB7Dg fRWRVmMKKyyDLj8IUE72A==
Received: from iwn2 (iwn2.prod.google.com [10.241.68.66]) by hpaq13.eem.corp.google.com with ESMTP id p1A057GL004403 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Wed, 9 Feb 2011 16:05:34 -0800
Received: by iwn2 with SMTP id 2so802378iwn.21 for <hybi@ietf.org>; Wed, 09 Feb 2011 16:05:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=YSiw4iS3a9moH3mX6X8/rC0rOK0WZJowlK7vxzhY6O8=; b=NOsRXhByyT58bnWxszxHdRAjzjvrF4ojLKYLr6TqxNCOxGJoCZIbKfirv/BV6BqOVV wR3vwxlzWAUprW72N/mg==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:from:date:message-id:subject:to:content-type; b=FZV3NZpgZ7WILrefHuntvW3w7mXfljgqfLJluextQ6y2eIu7M8xBXRUbbvEodGI/9E nHGIwPHtFF0Gp1QCKFmw==
Received: by 10.42.178.134 with SMTP id bm6mr2051195icb.523.1297296333993; Wed, 09 Feb 2011 16:05:33 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.17.201 with HTTP; Wed, 9 Feb 2011 16:05:13 -0800 (PST)
From: Takeshi Yoshino <tyoshino@google.com>
Date: Wed, 09 Feb 2011 16:05:13 -0800
Message-ID: <AANLkTi=wAwQHGbu_vVS5o9yNuC-M=e_hWwtU5F6UPGqm@mail.gmail.com>
To: hybi@ietf.org
Content-Type: multipart/alternative; boundary="90e6ba6e8d9c27f604049be257af"
X-System-Of-Record: true
Subject: [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 00:05:27 -0000

Long time has passed since there was active discussion on closing handshake
design. Closing handshake detail has been gradually changed in -01 and -05
adopting suggestions from tickets and posts on the list, and now there is
some inconsistency between sections. I think now it's good time to discuss
again what closing handshake should realize, how it should be done, and what
_cleanly_ means.

== What closing handshake should realize ==
Now it seems closing handshake in -05 is designed to realize two things.
a) peer B assume that no more data is coming from peer A when B receives
closing initiation from A
b) peer A assume that all the data sent out has been successfully received
by peer B when A receives closing acknowledgement from B

Section 1.4 in -05 states only a), but I thought that b) is also closing
handshake's objective. e.g. this old post
http://www.ietf.org/mail-archive/web/hybi/current/msg01526.html by Hixie
says so.

How many people on this list are supportive for having feature-b) realized
by closing handshake? When I was talking with people offlist, some were
doubtful about the usefulness of this feature. It think most apps would
build their own shutdown protocol and doesn't rely on WebSocket closing
handshake.

== How it should be done for each option ==
1) If we need only a), a) can be simply realized by closing frame without
body.

2) If we need both a) and b), we have to distinguish closing initiation and
acknowledgement since it's possible that both sides initiate closing at the
same time.

Some sentences ("A received close message is deemed to be ..." in Section
4.5.1) were added to -01 to ask each peer to check the body of closing frame
to distinguish if it's acknowledgement or not". This was incomplete as
Gabriel pointed out in http://trac.tools.ietf.org/wg/hybi/trac/ticket/34,
but it's now almost addressed in -05. I think we need to make one more tiny
fix on 4.5.1, but then, I think it's perfect.

== What does _cleanly_ means? ==
By the word _cleanly_ all the information about closing handshake is passed
to the WebSocket API.

If we take 1), _cleanly_ means the user agent has received all data from the
server.

If we take 2),... in -05, _cleanly_ has different meaning depending on
whether client initiated close or server initiated close. If client
initiated close, _cleanly_ means the user agent has received all data from
the server and all the data sent to the server has been received by the
server. If server initiated close, _cleanly_ only means the user agent has
received all data from the server. Since we're going to assure b), the user
agent should initiate closure before sending back acknowledgement (we need
some change in 4.5.1). Then, _cleanly_ means the same for both cases.

====

Let's make decision here to clean-up closing handshake stuff in the spec.

1) keep feature-b)
- Change Section 1.4 to mention that closing handshake is designed to
realize feature-b)
- Fix 4.5.1 so that a peer wait until receiving acknowledgement if it has
initiated closing handshake
2) drop feature-b)
- Drop body comparison procedure added in -01
- Avoid using a word "acknowledgement". It's confusing IMO.