Re: [Cbor] correctness of implied top level array?

Laurence Lundblade <lgl@island-resort.com> Wed, 27 February 2019 04:11 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ECD90130DF6 for <cbor@ietfa.amsl.com>; Tue, 26 Feb 2019 20:11:09 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25STYzyKchWv for <cbor@ietfa.amsl.com>; Tue, 26 Feb 2019 20:11:08 -0800 (PST)
Received: from p3plsmtpa06-03.prod.phx3.secureserver.net (p3plsmtpa06-03.prod.phx3.secureserver.net [173.201.192.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 377D0130DEC for <cbor@ietf.org>; Tue, 26 Feb 2019 20:11:08 -0800 (PST)
Received: from [192.168.1.82] ([76.192.164.238]) by :SMTPAUTH: with ESMTPSA id yqYkg059a12o1yqYlgAKoA; Tue, 26 Feb 2019 21:11:07 -0700
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Laurence Lundblade <lgl@island-resort.com>
In-Reply-To: <40A3B694-80A4-4AD7-A2A6-C071C6E88D2D@tzi.org>
Date: Tue, 26 Feb 2019 20:11:06 -0800
Cc: cbor@ietf.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <F0A06813-3F1F-4D53-80A1-4CBBBB91DC64@island-resort.com>
References: <81789050-5133-48B0-BEE7-4F1E0BBB4C06@island-resort.com> <40A3B694-80A4-4AD7-A2A6-C071C6E88D2D@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3445.9.1)
X-CMAE-Envelope: MS4wfNQFXpovs66hHMZO3oSMd5rHVCkm0WCz/a68UT2fAPeZilOsPotgkex75YIDYVgqG4ClpuDbFFVEcRvJU9SF1W4KBX9dwJxZmtp/fYSDk8ScnwnXq6fk JAihXtRkqIHw00pRghIkyOdUlR+O/wqhXHs8ey52zHFwIIiD+NRWjK5TQGuLIEjgTEIyN4YtNgKprg==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/cW_xc9RIqysqhxRwYXjM3VaexGk>
Subject: Re: [Cbor] correctness of implied top level array?
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Feb 2019 04:11:10 -0000

Hi Carsten,

So wouldn’t that mean application/cbor is required to consist of one and only one data item with no extra data? And maybe we need a section that says when you design a CBOR protocol you should be clear whether it carries a CBOR sequence or a CBOR data item. Maybe say the preferred encoding the CBOR data item because to be similar to JSON where you can’t have loose name/value pairs?

LL

> On Feb 24, 2019, at 4:36 AM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> Hi Laurence,
> 
> the construction you describe is different from a CBOR data item:
> It is a CBOR Sequence.  You piqued me to finally write it up, see below.
> 
> More generally speaking, an encoded CBOR data item followed by residual data is a very valid construction, for instance for a piece of metadata tacked on as a header to a binary blob.  CBOR’s self-delimiting is all you need here.
> The metadata part doesn’t stop to be well-formed by being followed by that binary blob.
> But of course the whole thing *is* not, but still *has* a well-formed encoded CBOR data item.
> 
> Unfortunately, not very many CBOR libraries have an API that allows isolating that metadata header from its residual data.  Maybe it’s worth writing a draft about suggested API functionality as well.  (One other thing that recently came up and is supported by too few CBOR library APIs is using an already encoded CBOR data item during encoding an array, map, or Tag.)
> 
> Grüße, Carsten
> 
> 
> Name:		draft-bormann-cbor-sequence
> Revision:	00
> Title:		Concise Binary Object Representation (CBOR) Sequences
> Document date:	2019-02-24
> Group:		Individual Submission
> Pages:		8
> URL:            https://www.ietf.org/internet-drafts/draft-bormann-cbor-sequence-00.txt
> Status:         https://datatracker.ietf.org/doc/draft-bormann-cbor-sequence/
> Htmlized:       https://tools.ietf.org/html/draft-bormann-cbor-sequence-00
> Htmlized:       https://datatracker.ietf.org/doc/html/draft-bormann-cbor-sequence
> 
> 
> Abstract:
>  This document describes the Concise Binary Object Representation
>  (CBOR) Sequence format and associated media type "application/cbor-
>  seq".  A CBOR Sequence consists of any number of encoded CBOR data
>  items, simply concatenated in sequence.
> 
>  Structured syntax suffixes for media types allow other media types to
>  build on them and make it explicit that they are built on an existing
>  media type as their foundation.  This specification defines and
>  registers "+cbor-seq" as a structured syntax suffix for CBOR
>  Sequences.
> 
>