[hybi] WS framing alternative

"Thomson, Martin" <Martin.Thomson@andrew.com> Tue, 27 October 2009 01:32 UTC

Return-Path: <Martin.Thomson@andrew.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost []) by core3.amsl.com (Postfix) with ESMTP id 42C3D3A6778 for <hybi@core3.amsl.com>; Mon, 26 Oct 2009 18:32:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.555
X-Spam-Status: No, score=-2.555 tagged_above=-999 required=5 tests=[AWL=0.044, BAYES_00=-2.599]
Received: from mail.ietf.org ([]) by localhost (core3.amsl.com []) (amavisd-new, port 10024) with ESMTP id hmVj30waDB6O for <hybi@core3.amsl.com>; Mon, 26 Oct 2009 18:32:05 -0700 (PDT)
Received: from csmailgw2.commscope.com (csmailgw2.commscope.com []) by core3.amsl.com (Postfix) with ESMTP id 72DB03A66B4 for <hybi@ietf.org>; Mon, 26 Oct 2009 18:32:05 -0700 (PDT)
Received: from [] ([]:60705 "EHLO ACDCE7HC1.commscope.com") by csmailgw2.commscope.com with ESMTP id S67750AbZJ0BcT (ORCPT <rfc822; hybi@ietf.org>); Mon, 26 Oct 2009 20:32:19 -0500
Received: from SISPE7HC1.commscope.com ( by ACDCE7HC1.commscope.com ( with Microsoft SMTP Server (TLS) id 8.1.393.1; Mon, 26 Oct 2009 20:32:19 -0500
Received: from SISPE7MB1.commscope.com ([fe80::9d82:a492:85e3:a293]) by SISPE7HC1.commscope.com ([fe80::8a9:4724:f6bb:3cdf%10]) with mapi; Tue, 27 Oct 2009 09:32:16 +0800
From: "Thomson, Martin" <Martin.Thomson@andrew.com>
To: "hybi@ietf.org" <hybi@ietf.org>
Date: Tue, 27 Oct 2009 09:32:43 +0800
Thread-Topic: WS framing alternative
Thread-Index: AcpWpWDvQb6C13oURy2kiXvvBbXkYg==
Message-ID: <8B0A9FCBB9832F43971E38010638454F0F1EA72C@SISPE7MB1.commscope.com>
Accept-Language: en-US
Content-Language: en-US
acceptlanguage: en-US
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-BCN: Meridius 1000 Version 3.4 on csmailgw2.commscope.com
X-BCN-Sender: Martin.Thomson@andrew.com
Subject: [hybi] WS framing alternative
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/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, 27 Oct 2009 01:32:06 -0000

WS is binary.  I believe that the benefits (reduced frame size, etc...) are outweighed by the disadvantages (debugging, etc...).  There would be little cost in a minor change that would also enable use of MIME.

  WS-frame = WS-length CRLF WS-headers CRLF WS-body CRLF
  WS-length = 1*DIGIT
  WS-headers = WS-header-name ":" WS-header-value CRLF
     ; add whatever MIME requires here, except the ugly stuff
  WS-body = *OCTET

Set some basic defaults for MIME headers (i.e. Content-Type = text/plain;charset=utf-8) and the impact on existing implementations is minimal.  Rather than sending:

  [0x80, 0x0d]Hello, World!

You send (indenting for readability):

  Hello, World!

The unknown length thing is harder to replicate, but you could do as Greg suggests for BWTP, or something even simpler:

  WS-length = 1*DIGIT [WS-incomplete-frame]
  WS-incomplete-frame = "+"

That is:


  o, World!

MIME headers can then be used for a range of evils.  Including ones that we don't agree with.

Of course, your super simple implementation can:

  Read digits, convert to number b.
  Read incomplete marker.
  Discard until you reach a CRLF followed by another CRLF.
  Read b octets, assume UTF-8.
  Read CRLF.
  If incomplete, loop to start, else report message.
  Rinse, repeat.