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

Takeshi Yoshino <tyoshino@google.com> Fri, 25 May 2012 07:16 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 5D6F821F848B for <hybi@ietfa.amsl.com>; Fri, 25 May 2012 00:16:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.761
X-Spam-Level:
X-Spam-Status: No, score=-102.761 tagged_above=-999 required=5 tests=[AWL=0.215, 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 Xk2SEDWaErWb for <hybi@ietfa.amsl.com>; Fri, 25 May 2012 00:16:11 -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 5E01721F8484 for <hybi@ietf.org>; Fri, 25 May 2012 00:16:11 -0700 (PDT)
Received: by ggnc4 with SMTP id c4so669082ggn.31 for <hybi@ietf.org>; Fri, 25 May 2012 00:16:10 -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=JEStCL55IO98GvoCaVO1juci/5KEL6w9Yw4FpT1ZDH8=; b=TV7ZMVLPlx4xOHY3kTDVz4yZUTC0s32ZztTsjEv2tKyayYrAdqVMQ3smTvqFnw4fmT FlwK1/Dw6VsC3zGjvtRHrNgDUhT0mjdo0nd35g3s5b3o23cKWZ/G6+unJuMPHZT6yp2h 8xAYI6aBcEW3FlqAImE32f4JI0Si82q55sLlS/WZaLZ2AAd0VvVqE3aYHA3dUD87rHt0 XdLM2jyPK0y19sqXNZVFCDlxuLyaJKM4b6V3fA0JqDihCYeq3GFM+D4awZP3900qphxL rRpee0jQvdy8oLEDAVNC8B/0rnCHHwlso9AIwI1zZFwLzn3580qM3g9MziiIyVNtVsmH AymA==
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=JEStCL55IO98GvoCaVO1juci/5KEL6w9Yw4FpT1ZDH8=; b=KWOsr5TWlu/LwtqC3KOeciy/ItSWhH5vuHtgBGPo7YF+2F4Ji6zc8COKTR+zjGDpdo EkfIa29Fnz7DNPAm/lRnUVZ02oiM0zeHZ/3hAhtppGvtG88zohfXFHUr4H5iyVXr16+N EKQ0clx4HLnQ6jBs+v5bB3g2UXlrXV3pp4wEI+EXeIGsL3b4fHEF2dU+2EjzzlMec0db iHo/4vwT+rUZwiI8g1jvRT6qfqeezeErjVaFuPUBMd++KciN8nKXFNEihhUampunU5Pv Q+kHwbzD8wNB0Sfx8VlC2A4yqVgXlTIfZncUHVrr+KtCRXYKNOevdDtDEKCAWU2ms0BH g21w==
Received: by 10.50.168.34 with SMTP id zt2mr1172908igb.10.1337930170348; Fri, 25 May 2012 00:16:10 -0700 (PDT)
Received: by 10.50.168.34 with SMTP id zt2mr1172895igb.10.1337930170109; Fri, 25 May 2012 00:16:10 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.66.7 with HTTP; Fri, 25 May 2012 00:15:49 -0700 (PDT)
In-Reply-To: <4FBE97BB.4090609@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> <CAH9hSJYUmPsMpjoo9f4SpK_0jW3XcbTGE-Bksi8x+62LD6NoeA@mail.gmail.com> <CAFWCB1kmfn-wsnTptDjDsXUVGLdwMMG49eTNz7YutC9ZsE07yw@mail.gmail.com> <4FBE97BB.4090609@gmail.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Fri, 25 May 2012 16:15:49 +0900
Message-ID: <CAH9hSJbmc8e+2B4EYKynud8H1Y7QRpQsazC5wXS_iXSuiUVyjA@mail.gmail.com>
To: Jason Duell <jduell.mcbugs@gmail.com>
Content-Type: multipart/alternative; boundary="e89a8f64289a860fd604c0d72489"
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQmTyp1Hqz9dU9PNhhk1OpP9e+RI3SmuPwQQAhkH9poa+GTKdFvOSGtenbrG9SzFgrrm0tuyw2+w6um1RxEyEKNmFCMWLjalWWASMclgkdv1bJgWZYByysrwlEKgNYsL9TgTByDc
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: Fri, 25 May 2012 07:16:12 -0000

On Fri, May 25, 2012 at 5:19 AM, 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<http://tools.ietf.org/html/rfc6455#section-7.1.7>
>>>
>> On Wed, May 23, 2012 at 1:38 PM, Jason Duell <jduell.mcbugs@gmail.com>
>> wrote:
>>
>
> So all protocol errors must deliver 1006 to JS instead of 1002?   This is
> counter-intuitive to me, and I think it will confuse both users and
> developers.
>

If we do so, the meaning of 1002 delivery to JS will be ambiguous. We need
a way to determine whether the remote server is misbehaving or the client
is. Otherwise, it makes healthy clients worry about bugs in themselves.

Solutions I can come up with are:

- check wasClean to distinguish it's remote error or local error
- check if onerror was invoked or not to distinguish it's remote error or
local error
- add new status codes for local errors (e.g. 1022 "protocol error in the
frame from the remote endpoint")

Whichever we choose, we need to make change on 7.1.5.


>  As 7.1.5 of the spechttp://tools.ietf.org/**html/rfc6455#section-7.1.5<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".
>>
>
> OK--so if I follow you, the justification here to deliver 1006 to the
> application when the client encounters a protocol error is because we
> always set the close code to the error the *server* sends us, or 1006, (i.e
> a protocol error means no close frame, so 1006).
>

Yes.


> I can see this reading of the spec.  But the exact language for 1002 is
> "1002 indicates that an endpoint is terminating the connection due to a
> protocol error."  Note that it says "an" endpoint, not "the remote
> endpoint."  This makes me think we can deliver 1002 to JS for a protocol
> error we detect from the server.


Yes, but I don't think the text has such implication. It's overridden by
7.1.5.