Re: [hybi] Clarify the role of closing handshake

Takeshi Yoshino <tyoshino@google.com> Wed, 16 February 2011 00:21 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 9DF093A6C75 for <hybi@core3.amsl.com>; Tue, 15 Feb 2011 16:21:41 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.592
X-Spam-Level:
X-Spam-Status: No, score=-104.592 tagged_above=-999 required=5 tests=[AWL=-0.969, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_33=0.6, MIME_BASE64_TEXT=1.753, 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 aFT5conSFWjK for <hybi@core3.amsl.com>; Tue, 15 Feb 2011 16:21:40 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id DDA473A6C37 for <hybi@ietf.org>; Tue, 15 Feb 2011 16:21:39 -0800 (PST)
Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id p1G0M5Fr007393 for <hybi@ietf.org>; Tue, 15 Feb 2011 16:22:05 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1297815725; bh=5hgEOJGAP4iZtMJcRqs0W7b9Agg=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Jvzy6FFQFVI/5Epuy72jiQte3AW6p/uYOUcgGqMsj8i+egX+KJjzoUM2xgjTeUWrZ X2EJiA0sBboZoUAGRbq2w==
Received: from iym1 (iym1.prod.google.com [10.241.52.1]) by wpaz37.hot.corp.google.com with ESMTP id p1G0Lgps011074 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Tue, 15 Feb 2011 16:22:04 -0800
Received: by iym1 with SMTP id 1so683921iym.17 for <hybi@ietf.org>; Tue, 15 Feb 2011 16:22:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=jkQ6Kdcejp4P3UUPL/8JlNNnb70qR9gHc7zqm85uLx4=; b=QlsZJH1qrZxKjeVG5/sLRweNNdTdDfjVXxMPZjg1DPfQpFUHksrbp4jwhtFwjUHKbU V7NDMuhGp+E4lYliJTQg==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=tQuYt4w4/MMgvug+6/71F4Xli3a7k5y0JBoUiE+tGPsSui0HX//lmUBUEDGDofqKSf y6mKal+sSS/YUonqv2Wg==
Received: by 10.231.171.197 with SMTP id i5mr33482ibz.54.1297815724216; Tue, 15 Feb 2011 16:22:04 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.17.201 with HTTP; Tue, 15 Feb 2011 16:21:44 -0800 (PST)
In-Reply-To: <OF35ACDF07.73860E04-ON88257839.000091DB-88257839.0000F650@playstation.sony.com>
References: <OF21F755C7.13DF9AAD-ON88257838.007EEEA2-88257839.00007084@playstation.sony.com> <OF35ACDF07.73860E04-ON88257839.000091DB-88257839.0000F650@playstation.sony.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Tue, 15 Feb 2011 16:21:44 -0800
Message-ID: <AANLkTimhJ+F85NrAjt8TwDjDpyH0j30YcfAxppNKEvwF@mail.gmail.com>
To: Yutaka_Takeda@playstation.sony.com
Content-Type: multipart/alternative; boundary="001636c9243639d2a0049c5b45cc"
X-System-Of-Record: true
Cc: hybi@ietf.org, hybi-bounces@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: Wed, 16 Feb 2011 00:21:41 -0000

In case you missed this part of my post citing Ian's thought.

http://www.ietf.org/mail-archive/web/hybi/current/msg01526.html

<http://www.ietf.org/mail-archive/web/hybi/current/msg01526.html>
>
> I think the net result is that ideally .close() should map to sending a
> FIN, aka using shutdown(SHUT_WR). Unfortunately this is not always
> possible -- people cited numerous examples of cases where we can't rely on
> TCP semantics in practice -- so we probably want to simulate this at the
> WebSocket layer or the application layer. Since the JS API exposes a
> .close() method, we should probably expose it at the WebSocket layer.


What do you think about this? I think it's nice to put your method just for
implementor's information together with Gabriel's idea in case we decide to
adopt Gabriel's idea, but reluctant to put it as mandatory protocol because
of this.

Takeshi


On Tue, Feb 15, 2011 at 16:10, <Yutaka_Takeda@playstation.sony.com> wrote:

>
> Typo correction: The "SHOULD" in my text need to be "MUST" because both
> endpoints
> communicate using EoS in the proposed close handshake:
>
> (1) The endpoint MUST close write channel of the TCP connection
>    immediately after Close message is sent. (e.g. shutdown(SHUT_WR))
>
>
> (2) After both sending and receiving a Close message, both endpoints
>
>    MUST wait for EoS(End of Stream; i.e. recv() returning 0) before
>    closing TCP socket and discard any data received after the Close
>
>    message.
>
> (3) After both sending and receiving a Close message and the endpoint
>    has detected EoS, then the WebSocket connection is said to have been
>    closed _cleanly_.
>
> --
> Yutaka Takeda - US R&D Sony Computer Entertainment, Inc.
> Office: 650 655 7484   Fax: 650 655 8060
>
>
>
>  *Yutaka Takeda/R&D/SCEA@Playstation*
> Sent by: hybi-bounces@ietf.org
>
> 02/15/2011 04:05 PM
>   To
> ifette@google.com
> cc
> hybi@ietf.org
> Subject
> Re: [hybi] Clarify the role of closing handshake
>
>
>
>
>
> Ian Fette (イアンフェッティ) <ifette@google.com> wrote on 02/15/2011 02:27:58 PM:
>
> > What I'm currently looking at is this: (comments welcome)
> >
> >          <t>The Close message contains an opcode of 0x01.</t>
> >           <t>The Close message contains no body (the body has zero
> > length).</t>
> >           <t>The application MUST NOT send any more data messages
> > after sending
> >           a close message.</t>
> >           <t>If an endpoint receives a Close message and that endpoint
> did not
> >           previously send a Close message, the endpoint MUST send a Close
> >           message in response. It SHOULD do so as soon as is practical.
> >           </t>
> >           <t>After both sending and receiving a close message, an
> endpoint
> >           considers the websocket connection closed, and
> >           SHOULD close the underlying TCP connection.</t>
> >           <t>If a client and server both send a Close message at thesame
> time,
> >           both endpoints will have sent and received a Close messageand
> should
> >           consider the websocket connection closed and close the
> underlying
> >           TCP connection.</t>
>
> I would replace corresponding texts with something along the line of the
> following for more completeness:
>
> (1) The endpoint SHOULD close write channel of the TCP connection
>    immediately after Close message is sent. (e.g. shutdown(SHUT_WR))
>
> (2) After both sending and receiving a Close message, both endpoints
>    SHOULD wait for EoS(End of Stream; i.e. recv() returning 0) before
>    closing TCP socket and discard any data received after the Close
>    message.
>
> (3) After both sending and receiving a Close message and the endpoint
>    has detected EoS, then the WebSocket connection is said to have been
>    closed _cleanly_.
>
> Justification:
> - (1) is to ensure that no more data will be written to the
>  underlying TCP socket after the Close message, and to indicate
>  that sender has reached the EoS at TCP level.
> - (2) is to prevent the endpoint from generating spurious RST
>  due to a bug at the remote endpoint injecting data after Close frame.
> - Presence of Close frame helps intermediaries to detect normal closure
>  of WebSocket connection.
>
> Best.
>
> - Yutaka _______________________________________________
>
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>
>
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>
>