Re: [vwrap] type-system : binary elements in JSON serializations
Mark Lentczner <markl@lindenlab.com> Thu, 01 April 2010 20:21 UTC
Return-Path: <markl@lindenlab.com>
X-Original-To: vwrap@core3.amsl.com
Delivered-To: vwrap@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix)
with ESMTP id 3FD8F3A6950 for <vwrap@core3.amsl.com>;
Thu, 1 Apr 2010 13:21:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.853
X-Spam-Level:
X-Spam-Status: No, score=0.853 tagged_above=-999 required=5 tests=[AWL=-0.278,
BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com
[127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8dywXAKRKdaP for
<vwrap@core3.amsl.com>; Thu, 1 Apr 2010 13:21:16 -0700 (PDT)
Received: from mail-gw0-f44.google.com (mail-gw0-f44.google.com
[74.125.83.44]) by core3.amsl.com (Postfix) with ESMTP id 433973A685D for
<vwrap@ietf.org>; Thu, 1 Apr 2010 13:21:03 -0700 (PDT)
Received: by gwj15 with SMTP id 15so1027490gwj.31 for <vwrap@ietf.org>;
Thu, 01 Apr 2010 13:21:32 -0700 (PDT)
Received: by 10.150.180.12 with SMTP id c12mr1915220ybf.144.1270153291743;
Thu, 01 Apr 2010 13:21:31 -0700 (PDT)
Received: from nil.lindenlab.com ([38.99.52.137]) by mx.google.com with ESMTPS
id 21sm1979038yxe.39.2010.04.01.13.21.29 (version=TLSv1/SSLv3 cipher=RC4-MD5);
Thu, 01 Apr 2010 13:21:30 -0700 (PDT)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Apple Message framework v1078)
From: Mark Lentczner <markl@lindenlab.com>
In-Reply-To: <62BFE5680C037E4DA0B0A08946C0933DCB5FBCB3@rrsmsx506.amr.corp.intel.com>
Date: Thu, 1 Apr 2010 13:21:27 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <81A71295-EB0A-4F87-9F97-85CC5F7F4CCE@lindenlab.com>
References: <b325928b1003281033p28c92367x2be877cc348268da@mail.gmail.com>
<62BFE5680C037E4DA0B0A08946C0933DCB5FB69D@rrsmsx506.amr.corp.intel.com>
<OF525A1644.1F7FE877-ON852576F5.00641451-852576F5.00641932@us.ibm.com>
<b325928b1003291124i47c4ca3bpa55724f57d4ad7d8@mail.gmail.com>
<62BFE5680C037E4DA0B0A08946C0933DCB5FB75C@rrsmsx506.amr.corp.intel.com>
<b325928b1003291313h6204c04bs5bf55a03447e9844@mail.gmail.com>
<f72742de1003301022u971914fl75d8c0a56c7b1b3f@mail.gmail.com>
<62BFE5680C037E4DA0B0A08946C0933DCB5FBCB3@rrsmsx506.amr.corp.intel.com>
To: vwrap <vwrap@ietf.org>
X-Mailer: Apple Mail (2.1078)
Subject: Re: [vwrap] type-system : binary elements in JSON serializations
X-BeenThere: vwrap@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Virtual World Region Agent Protocol - IETF working group
<vwrap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/vwrap>,
<mailto:vwrap-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/vwrap>
List-Post: <mailto:vwrap@ietf.org>
List-Help: <mailto:vwrap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/vwrap>,
<mailto:vwrap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Apr 2010 20:21:17 -0000
There are several interrelated issues here: 1) There appears to be consensus that the JSON serialization of binary values should be as a JSON string value containing the Base64 encoded version of the binary data. (Rather than the current array of small integers.) However, at a receiving end, JSON would provide no way to distinguish a LLSD binary value and an LLSD string value that happened to be decodable as Base64. For example, the JSON string "NoteWell" could be the Base64 encoding of the octets 0x36.8b.5e.59.e9.65 In the usage model of LLSD, the receiving end knows what it wants and reads a value as the type it needs. (This is why all the conversion rules are defined as how to read an X when given a Y in the data.) In order to allow a program wanting binary to read it when transmitted via JSON, we'd need to define a default conversion to Binary from String. 2) Should we add a conversion to Binary from String? It would be defined as Base64 decode the string if valid, otherwise result in the default Binary value (zero octets). All the other conversions are symmetric. Adding a conversion to String from Binary implies that there are cases where the receiving end expects a string, but there was a Binary value on the wire (this cannot happen with JSON encoding). I cannot come up with a use case for this conversion. Perhaps if there were a programming environment where binary values are natively handled as Base64 encoded strings? (This is the rationale for the other conversions: Such as environments that don't distinguish between numbers and strings...) There is also a possible temptation to keep people from: The intention of such a string from binary conversion is NOT to circumvent LLSD's commitment to all text being terms of Unicode strings. Text encoded in some encoding should NOT be sent as Binary, relying on automatic Base64 encoding to get it into some environment via Strings if needed, only to be decoded on the other side. The right thing to do is to send the Unicode string as an LLSD String, transcoding as needed by the chosen serialization method. Admittedly this worry might over blown, but I have seen programmers "just try anything until it works for some broken case" when it comes to character encoding errors. I originally left out the Binary<->String conversions to ensure no one could ever go there! 3) Should we add the reverse conversion: to String from Binary?. It would be simply Base64 encoding the binary values. - Mark Mark Lentczner Sr. Systems Architect Technology Integration Linden Lab markl@lindenlab.com Zero Linden zero.linden@secondlife.com
- Re: [vwrap] type-system : binary elements in JSON⦠Mark Lentczner