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

Iñaki Baz Castillo <ibc@aliax.net> Tue, 06 September 2011 15:35 UTC

Return-Path: <ibc@aliax.net>
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 DA27E21F8BC4 for <hybi@ietfa.amsl.com>; Tue, 6 Sep 2011 08:35:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.645
X-Spam-Level:
X-Spam-Status: No, score=-2.645 tagged_above=-999 required=5 tests=[AWL=0.032, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1]
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 AnHp9BUiyXeW for <hybi@ietfa.amsl.com>; Tue, 6 Sep 2011 08:35:39 -0700 (PDT)
Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com [209.85.216.172]) by ietfa.amsl.com (Postfix) with ESMTP id 4388121F8BC3 for <hybi@ietf.org>; Tue, 6 Sep 2011 08:35:39 -0700 (PDT)
Received: by qyk34 with SMTP id 34so644572qyk.10 for <hybi@ietf.org>; Tue, 06 Sep 2011 08:37:25 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.229.28.200 with SMTP id n8mr4000626qcc.291.1315323445666; Tue, 06 Sep 2011 08:37:25 -0700 (PDT)
Received: by 10.229.79.207 with HTTP; Tue, 6 Sep 2011 08:37:25 -0700 (PDT)
Date: Tue, 06 Sep 2011 17:37:25 +0200
Message-ID: <CALiegf=D5K9H0uckc_zLVbaLieyu082g8kooAXa-3LkG+g_XGQ@mail.gmail.com>
From: Iñaki Baz Castillo <ibc@aliax.net>
To: hybi@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: [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:35:40 -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].


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).

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).

- 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).
- 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.
- 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.
- The WS application layer notifies the WS transport layer to close
the connection due to other causes (normal termination and so).
- The WS transport layer notifies the WS application layer when the
connection has been closed (locally or remotely) and the exact cause.

How the WS transport layer and the WS application layer sends messages
or notifies events to each other is out of the scope of this
specification (of course).


Validation of a WS message should be done by the WS application layer,
so 1007 code should refer to "message" rather than "frame".

IMHO this is obvious, and it's also obvious that defining logic layers
when creating a protocol specification is *good* for the implementor.
If not, we end with these kinds of anarchic discussions (see other
threads) which have difficult answer due to the protocol specification
ambiguity.

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

Regards.

-- 
Iñaki Baz Castillo
<ibc@aliax.net>