Re: [hybi] WS close code equivalent to HTTP 500/Internal Server Error

Takashi Toyoshima <toyoshim@chromium.org> Wed, 09 May 2012 04:02 UTC

Return-Path: <toyoshim@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 57B4521F8522 for <hybi@ietfa.amsl.com>; Tue, 8 May 2012 21:02:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.977
X-Spam-Level:
X-Spam-Status: No, score=-102.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, 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 aurAtxEmvXUS for <hybi@ietfa.amsl.com>; Tue, 8 May 2012 21:02:35 -0700 (PDT)
Received: from mail-lpp01m010-f44.google.com (mail-lpp01m010-f44.google.com [209.85.215.44]) by ietfa.amsl.com (Postfix) with ESMTP id 1D2EC21F8525 for <hybi@ietf.org>; Tue, 8 May 2012 21:02:34 -0700 (PDT)
Received: by lagj5 with SMTP id j5so5393319lag.31 for <hybi@ietf.org>; Tue, 08 May 2012 21:02:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record; bh=t+lM58SSINWTaBF6zG/C5XfL+YpnGO63P02d7u/+lxk=; b=RczeffG2C838H2Lt4PzGQ8w5R8H6PWrb/uUsTEp5JWvJjIi6bSFKw9gdTQ/qG8LDLk E3bToFJfBtUuBFu3PvqKTIObMU0k0PvcdvLRXN3iPQY5xcPdxdWJ75r2CmcPRZ0lgtje yua/KLwbXP7YLNihJ2XBSzuX0MdDxWT3h/BCxNDjP/vVNxeOxy9qgHpxgXKoKTN2BsZQ 3QN+ucMJ/Gjw4I6BN1wVdd6OD7STl4RK0N1eRu0TguXSTyvmls1+HGFFXkkq65acZHdr mLuTKZ6ZwA+D0oCybQOSFmtYgzjyEG7Isa0+sTeVvqS4kAiVdiV34fYq2M5dO2g9GkLL btXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record:x-gm-message-state; bh=t+lM58SSINWTaBF6zG/C5XfL+YpnGO63P02d7u/+lxk=; b=LH9VoMnDnwoOt3pUdeaVqk5L1o2kqoZLWZT82rwYXlnnVJLrIXzECU8zrBLoBdKkmu tukGe1J6FWYNm3wUWT6D1l/TRc4YjubCCHOn65FSOkE9lSz2oZl/fBQpEKne2cK4KPsJ IjsHPT+j4p1V5mJT6ZOOY7gL3IJJfxylIMSACjpbWleAFXWReXwGBIWbjUYu2roR4tAK RCv8J56o2PEw/GxkRRJ06x2HkdOIPLSkZnXBU+6GhvE2d3Nnq2RNSLYM3nnCZtjrr+iG FOJryJWkwtbNtA0hYeOJvtj9fLTeeNz/3be6Z6l8RhmlHzUC43UFv7meOqj6IuwriRRz 3MxQ==
Received: by 10.152.145.169 with SMTP id sv9mr20005704lab.12.1336536153851; Tue, 08 May 2012 21:02:33 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.152.145.169 with SMTP id sv9mr20005696lab.12.1336536153750; Tue, 08 May 2012 21:02:33 -0700 (PDT)
Sender: toyoshim@google.com
Received: by 10.112.49.201 with HTTP; Tue, 8 May 2012 21:02:33 -0700 (PDT)
In-Reply-To: <4ED4E9CB.3040106@isode.com>
References: <02F41063-6221-4EB8-A4E4-2E396A6B946C@zaphoyd.com> <4ED4E9CB.3040106@isode.com>
Date: Wed, 9 May 2012 13:02:33 +0900
X-Google-Sender-Auth: Sve_sFHgKC9s6IsNkGBOZOzSLQI
Message-ID: <CAFWCB1mM=276jZGTmgRTDrd=i=m7B=VF8JG0hwUcO0Qor4pJoA@mail.gmail.com>
From: Takashi Toyoshima <toyoshim@chromium.org>
To: Alexey Melnikov <alexey.melnikov@isode.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQlmMUMlimGPxlB8S5cQiMR0bncXsxWZgu/+eDI8kWreoE8y5MD1Aw1KiXrSOhbm8viig0eucdM52TsCIUcDPNsZC55IctDncr2Bp3NFZjkmSAAMEm6iXCdOXQIe5Jp9tDcQFngi
Cc: hybi@ietf.org, Peter Thorson <webmaster@zaphoyd.com>
Subject: Re: [hybi] WS close code equivalent to HTTP 500/Internal Server Error
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: Wed, 09 May 2012 04:02:36 -0000

Hi hybi,

Is this discussion valid also for browser side implementation?
My concern is that what error code should be sent if a browser got an
internal error.

On Tue, Nov 29, 2011 at 11:18 PM, Alexey Melnikov
<alexey.melnikov@isode.com> wrote:
> Peter Thorson wrote:
>>
>> This issue came up while polishing up the error handling code for my WS
>> implementation. There doesn't seem to be a websocket close code equivalent
>> to HTTP 500/Internal server error.
>>
>> I would like to handle situations where my endpoint catches an internal
>> logic error and knows that continuing the connection will probably result in
>> bad/unknown behavior but knows that it is safe enough to close the
>> connection cleanly.
>>
>> Example: I am a server and my handler for processing websocket messages is
>> interpreted code and that code has a syntax error. The websocket server
>> itself is fine and can safely close the connection but clearly cannot
>> process messages until someone fixes the missing semicolon somewhere. In an
>> HTTP server I would return 500/Internal Server error to indicate that
>> something on the server end screwed up and that there is probably more
>> information in the server log files to diagnose further.
>>
>> None of the current close codes (except 1006/abnormal closure - which
>> isn't allowed on the wire) really fit. I'd rather not just drop the
>> connection uncleanly/send back empty close frame since that provides no
>> information about what happened and makes figuring out whose logs I should
>> be looking at as an end application developer difficult. Browsers only
>> report the status code itself and not the reason so sending a normal/going
>> away error code with a more specific reason is less helpful. What are other
>> implementations doing in this case? Would another close code for internal
>> server error make sense?
>
> Let's use 1011 for this (Unless I already suggested it be used for something
> else. Please correct me if I did.):
>
> 1011
>      1011 indicates that a server is terminating the connection
>      because it has encountered an unexpected condition which prevented
>      it from fulfilling the request.
>
>
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi