[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hybi] WS framing alternative



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):
  
  13

  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:

  4+

  Hell
  9
 
  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.

--Martin

Note Well: Messages sent to this mailing list are the opinions of the senders and do not imply endorsement by the IETF.