Re: [hybi] Changing meaning of 1007 status code ("frame" => "message")

Tobias Oberstein <tobias.oberstein@tavendo.de> Tue, 06 September 2011 15:53 UTC

Return-Path: <tobias.oberstein@tavendo.de>
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 D708621F8C48 for <hybi@ietfa.amsl.com>; Tue, 6 Sep 2011 08:53:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.349
X-Spam-Level:
X-Spam-Status: No, score=-2.349 tagged_above=-999 required=5 tests=[AWL=-0.050, BAYES_00=-2.599, MIME_8BIT_HEADER=0.3]
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 V-v2PFX8c8Gs for <hybi@ietfa.amsl.com>; Tue, 6 Sep 2011 08:53:29 -0700 (PDT)
Received: from EXHUB020-1.exch020.serverdata.net (exhub020-1.exch020.serverdata.net [206.225.164.28]) by ietfa.amsl.com (Postfix) with ESMTP id 346E821F8C30 for <hybi@ietf.org>; Tue, 6 Sep 2011 08:53:29 -0700 (PDT)
Received: from EXVMBX020-12.exch020.serverdata.net ([169.254.3.209]) by EXHUB020-1.exch020.serverdata.net ([206.225.164.28]) with mapi; Tue, 6 Sep 2011 08:55:15 -0700
From: Tobias Oberstein <tobias.oberstein@tavendo.de>
To: Iñaki Baz Castillo <ibc@aliax.net>, "hybi@ietf.org" <hybi@ietf.org>
Date: Tue, 06 Sep 2011 08:54:12 -0700
Thread-Topic: [hybi] Changing meaning of 1007 status code ("frame" => "message")
Thread-Index: AcxsquXOAK6foRPrTDO0yrfsxelQ9gAAO/Dg
Message-ID: <634914A010D0B943A035D226786325D422C0EB8DB1@EXVMBX020-12.exch020.serverdata.net>
References: <CALiegf=D5K9H0uckc_zLVbaLieyu082g8kooAXa-3LkG+g_XGQ@mail.gmail.com>
In-Reply-To: <CALiegf=D5K9H0uckc_zLVbaLieyu082g8kooAXa-3LkG+g_XGQ@mail.gmail.com>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Subject: Re: [hybi] Changing meaning of 1007 status code ("frame" => "message")
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: Tue, 06 Sep 2011 15:53:29 -0000

> As said in other mail I suggest changing the meaning of 1007 status code
> from:
> 
>       1007 indicates that an endpoint is terminating the connection
>       because it has received data that was supposed to be UTF-8 (such
>       as in a text frame) that was in fact not valid UTF-8 [RFC3629].
> 
> to:
> 
>       1007 indicates that an endpoint is terminating the connection
>       because it has received a message that was supposed to be UTF-8
>       that was in fact not valid UTF-8 [RFC3629].

Does not make a difference, since a message that consists of
100 frames and contains invalid UTF-8 in the first frame is
as invalid as the same message containing the invalid octets
only in the last frame.

Why should I read the subsequent 99 frames after having
received the first frame with invalid UTF-8 before failing
the connection?

> WS message format/encoding/content MUST be validated when receiving all
> the frames belonging to such message, as message inspection/usage belongs
> to the WS application, rather than the WS "transport" layer (framing stuf).

No, since that would imply that you can't have a message of arbitrary
number of frames, or a message frame with 2^63 octets. No one could
buffer that, and there is no need to do so anyway, when you have a frame-based
or a streaming API in your implementation.

The question of API is orthogonal to the protocol.

> 
> Of couse, a WS endpoint COULD validate each text frame by inspecting
> whether it contains valid UTF-8 bytes (completed or splitted bytes).
> That's could be an optimization out of the scope of the protocol specification
> (as many others).
> 
> I insist: this specification SHOULD define logic layers, basically:
> 
> * WS transport layer: framing stuff and control frames.
> * WS application layer: sends and receives *full* WS messages (binary or
> text).

No, thats not WS. WS itself is not a message based, but framed streaming
protocol.

> 
> - The WS transport layer receives control frames and send control frames to
> the other endpoint.
> - The WS transport layer gives received *messages* to the WS application
> layer (it doesn't matter giving the full buffered message or using straming).

No, I have 3 types of API: message-based, frame-based and streaming.

> - The WS application layer sends *messages* to the WS transport layer.
> The transport layer decides whether to split, or not, the message into N
> frames.

No, there may be valid scenarios when the application wants to control
fragmentation. Think about multi-channel media streaming.

> - The WS application layer notifies the WS transport layer to close the
> connection with status 1007 upon receipt of an invalid UTF-8 text message.

No, the WS implementation fails the connection and fires a connectionClose()
handler on the application. See the JS WS API.

> Please consider it. Any protocol in Internet is designed with logical layers, all
> but WebSocket.

Your premise is false, and thus any conclusion void.
 
> 
> Regards.
> 
> --
> Iñaki Baz Castillo
> <ibc@aliax.net>
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi