Re: [hybi] RFC6455 clarification: when received close code of 1005, 1006, 1015

Takeshi Yoshino <tyoshino@google.com> Thu, 24 May 2012 04:12 UTC

Return-Path: <tyoshino@google.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ED70721F8567 for <hybi@ietfa.amsl.com>; Wed, 23 May 2012 21:12:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.653
X-Spam-Level:
X-Spam-Status: No, score=-102.653 tagged_above=-999 required=5 tests=[AWL=0.323, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xx2rweWtAvOb for <hybi@ietfa.amsl.com>; Wed, 23 May 2012 21:12:49 -0700 (PDT)
Received: from mail-gg0-f172.google.com (mail-gg0-f172.google.com [209.85.161.172]) by ietfa.amsl.com (Postfix) with ESMTP id 9D1CF21F855B for <hybi@ietf.org>; Wed, 23 May 2012 21:12:37 -0700 (PDT)
Received: by ggnc4 with SMTP id c4so8572341ggn.31 for <hybi@ietf.org>; Wed, 23 May 2012 21:12:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record; bh=v43dV95BkzR5d7gdpzNeNvMfVFsDK0/dSKSY4IzGL2U=; b=a02feOlrSm1tMcsMcimDAOTfAJeC4phMQsCO0jSz1a3nDFcguFC73gCO03U09/9xnN p97+jZZZqTYAN+heSWts1d8WRbpsMTuWeR2HeZZKxq3xzDJH1KpvXdr3/65XIOl8VEWk 1gywP/VNZcSqoh/3USvEVVEvQLjTm+BpWFyit51enOSsbBHK81r39hiJ2PEfxDAka/SR grz9KoF16coJnt8DX2+Q0LMSheZ1xxI7LrIixWHDscAPgFQulcaDdAl49xFY6DKeyfmw N08e3CrNAlNjlYj34VQEnUwUrvyGIlHSv7erqwj7zYOXpF5PXyTPqOQDB0JxcWm3xIS0 bzmg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=v43dV95BkzR5d7gdpzNeNvMfVFsDK0/dSKSY4IzGL2U=; b=Wtz8XjBBlVQpuXYb6mUttK3WsOtciNj/oZYGsmHumq8H0vkk9BSIe9t+YSCdLGEjOm VjwZMFDAXHpE4fxlWwsbOizJuWSd6TQxGGQA8ZGLm82yJ2Ztcjita2+0eI5GgBchzl6q rRTk72NlDY6/yC81g5sZ2vpGoW8hDsiEZK+PvneN0CHGgt0cUjZNBmC1iVOwpeq5CeLQ H21vrJTINwPBDY+2g3zm/5Z8NtU/jBAKDU4r+bjPif5tPYMnkMmUhqG3+HpWyi0x7AD+ qnuBjyGS3JqOTLHe1xKUkFiwIyTT2l/NP7GONmiRGEzcqi7AwWt3k6kKzUxUMif5GbQw MdTA==
Received: by 10.42.63.80 with SMTP id b16mr19905700ici.29.1337832756739; Wed, 23 May 2012 21:12:36 -0700 (PDT)
Received: by 10.42.63.80 with SMTP id b16mr19905693ici.29.1337832756652; Wed, 23 May 2012 21:12:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.66.7 with HTTP; Wed, 23 May 2012 21:12:15 -0700 (PDT)
In-Reply-To: <CAM6mnz+fy2D_91UL=nnOmrL=4LOqrQ97CQW8DfFkQhHDHwn6FQ@mail.gmail.com>
References: <CAH9hSJbQ7dcu4N=Yf7TyFzJ0FhfVRehEMtnFx3Qvv_W0T5Cs+A@mail.gmail.com> <4FAACC40.6040308@isode.com> <CAH9hSJY5RPiAfwgBkbK08sY09dDkOO6JtCWqM2dYUko2ZV5MZw@mail.gmail.com> <CAFWCB1kuuMNSEmcgcHdMyOHRJyp=VKSm-YNceCPDZat3+1=zJw@mail.gmail.com> <CAM6mnz+fy2D_91UL=nnOmrL=4LOqrQ97CQW8DfFkQhHDHwn6FQ@mail.gmail.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Thu, 24 May 2012 13:12:15 +0900
Message-ID: <CAH9hSJYUmPsMpjoo9f4SpK_0jW3XcbTGE-Bksi8x+62LD6NoeA@mail.gmail.com>
To: Jason Duell <jduell.mcbugs@gmail.com>
Content-Type: multipart/alternative; boundary="90e6ba5bb94f3aac3704c0c076c9"
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQn9lkSbYCntz5Yn61Ohm2AMgyn6l3xOnHw27vmLa5ebtfIZ7tuo0zwyJq1WgRnra4/n8ZcE5v811rxba0jwJOcbKZxFz3YNiBX+1YrFegYrEXINRoH7KzjxfEkd228/ql3XNw12
Cc: Takashi Toyoshima <toyoshim@chromium.org>, hybi@ietf.org
Subject: Re: [hybi] RFC6455 clarification: when received close code of 1005, 1006, 1015
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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, 24 May 2012 04:12:50 -0000

On Wed, May 23, 2012 at 1:38 PM, Jason Duell <jduell.mcbugs@gmail.com>wrote:

> On Mon, May 21, 2012 at 11:18 PM, Takashi Toyoshima
> <toyoshim@chromium.org> wrote:
> > I'll fix WebKit implementation of receiving 1005, 1006, 1015, and
> > length=1 of close frames.
> > These frames will fire CloseEvent with code=1006 and wasClean=false.
>
> What, if anything, do you plan to reply to the endpoint with, if the
> 1005/1006/1015 is received before your client has sent its own close
> frame?  Will you be replying with 1002, but delivering 1006 to
> onclose?  I can see the logic there, though it's a little confusing.
>

Yes. It's a bit confusing but well defined behavior. For any other protocol
violation, the endpoint received a broken frame SHOULD send 1002 and MUST
invoke onclose with 1006.

http://tools.ietf.org/html/rfc6455#section-7.1.7


> The only other choice would seem to be to simply shut down the TCP
> connection with no close frame, but that seems harsh.  Or we could
> both send 1002 to the remote server and deliver it to onclose (though
> I agree that 1006 seems closer in meaning).


It's SHOULD. Shutting down TCP without sending 1002 is also fine as per
spec. http://tools.ietf.org/html/rfc6455#section-7.1.7

There has been discussion about the meaning of the code argument of the
onclose handler. As 7.1.5 of the spec
http://tools.ietf.org/html/rfc6455#section-7.1.5 explains, now it's meaning
is finalized as "the status code contained in the first Close control frame
received". That's my understanding. So, the code for onclose must be 1006.