Re: JSON headers

Amos Jeffries <squid3@treenet.co.nz> Tue, 12 July 2016 07:16 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1127F12D669 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 Jul 2016 00:16:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.208
X-Spam-Level:
X-Spam-Status: No, score=-8.208 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.287, SPF_HELO_PASS=-0.001, SPF_PASS=-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 TMYTYabV7nRk for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 Jul 2016 00:16:29 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0F73C12D649 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 12 Jul 2016 00:16:28 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bMrr9-0001ll-Ek for ietf-http-wg-dist@listhub.w3.org; Tue, 12 Jul 2016 07:11:47 +0000
Resent-Date: Tue, 12 Jul 2016 07:11:47 +0000
Resent-Message-Id: <E1bMrr9-0001ll-Ek@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <squid3@treenet.co.nz>) id 1bMrr6-0001kh-CT for ietf-http-wg@listhub.w3.org; Tue, 12 Jul 2016 07:11:44 +0000
Received: from [121.99.228.82] (helo=treenet.co.nz) by maggie.w3.org with esmtp (Exim 4.80) (envelope-from <squid3@treenet.co.nz>) id 1bMrqy-0004Rj-LU for ietf-http-wg@w3.org; Tue, 12 Jul 2016 07:11:38 +0000
Received: from [192.168.20.251] (unknown [121.98.40.13]) by treenet.co.nz (Postfix) with ESMTP id C1686E6FBD for <ietf-http-wg@w3.org>; Tue, 12 Jul 2016 19:10:59 +1200 (NZST)
To: ietf-http-wg@w3.org
References: <8251.1468229350@critter.freebsd.dk> <e9a55629-656c-3b6a-3ac4-5fb7a109b2f0@gmx.de> <8739.1468234635@critter.freebsd.dk> <38b3e7bb-3202-f489-ff15-d4d545e13ca0@gmx.de> <8854.1468236033@critter.freebsd.dk> <326f0b93-dbd5-3dfb-2a35-d1bf084684b4@gmx.de> <9221.1468245597@critter.freebsd.dk> <aa9cee9c-d8e3-17ba-9fcd-e327575cd5a8@gmx.de> <9801.1468259070@critter.freebsd.dk> <15d27f23-6b51-1e8e-3f10-194c80570424@gmx.de> <20160711190107.GB9542@1wt.eu> <0e467573-4f68-80a5-14a4-5a63b41ac4d4@gmx.de> <57841F4A.30901@tzi.org> <57e2c1b6-749f-c697-5c92-15eeb44b303b@gmx.de> <57849130.4060104@tzi.org> <928f8531-6573-caf6-50c1-1672cc020959@gmx.de>
From: Amos Jeffries <squid3@treenet.co.nz>
Message-ID: <11907e5a-bab7-ec9b-2bd4-e8447573edf4@treenet.co.nz>
Date: Tue, 12 Jul 2016 19:10:57 +1200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <928f8531-6573-caf6-50c1-1672cc020959@gmx.de>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=121.99.228.82; envelope-from=squid3@treenet.co.nz; helo=treenet.co.nz
X-W3C-Hub-Spam-Status: No, score=-4.3
X-W3C-Hub-Spam-Report: AWL=-1.207, BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1bMrqy-0004Rj-LU 0ebbcfc42bcfb958519389f60a597eeb
X-Original-To: ietf-http-wg@w3.org
Subject: Re: JSON headers
Archived-At: <http://www.w3.org/mid/11907e5a-bab7-ec9b-2bd4-e8447573edf4@treenet.co.nz>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31919
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On 12/07/2016 6:51 p.m., Julian Reschke wrote:
> On 2016-07-12 08:41, Carsten Bormann wrote:
>>> It is allowed by the structure of the *wire format*.
>>
>> The syntax indeed cannot prevent it.
>> It's still not *allowed* in JSON.
>>
>>> The *specification* has a "SHOULD have unique names", but then, that's
>>> only a SHOULD (exactly because we know we can't rely on it, otherwise we
>>> wouldn't have the prose about what recipients can do with it).
>>
>> It is a SHOULD because people were chickening out because of a possible
>> political conflict with ECMA 404.  Note well that no reason is given to
>> ever violate that SHOULD.
> 
> But we do know why it's violated in practice:
> 
> 1) Streaming might make it hard to check for senders,
> 
> 2) People abusing it to add comments to JSON (by choosing a member name
> for comments, and repeating it).
> 
> ...and probably for other reasons I'm not aware of.
> 
>> Now, for performance reasons, there is no requirement on a receiver to
>> check for this constraint.  Protocol design 101 tells us that a lack of
>> checking will cause implementations to emit invalid JSON just because
>> they can (the "soup" effect).  Hence the description in RFC 7159 what
>> goes wrong when you do that.  (However, the security considerations fail
>> to mention the check-vs-use vulnerabilities that inevitably come from
>> the variety in implementation strategies; the last paragraph of Section
>> 8 of RFC 7049 does apply.)
> 
> Maybe something for JSONbis?
> 
>> This discussion may be a bit off-topic for the HTTP WG, but I think it
>> is important to understand JSON when using it in HTTP.
> 
> Absolutely; and the conclusion might well be that we won't use JSON on
> the wire.
> 


Personally I hope we don't.

I was fine with it as a way to write ABNF-like descriptions in future
RFCs to make everyones custom headers have a more generic syntax that
our parsers could handle easier.

But using a textual representation on the wire for future improvements
is something we should be looking at avoiding, not encouraging.

HTTP/2 HPACK offers some new possibilities by adding integer encoding
for header field-value that the recipient is not required to write in
textual format before processing. Lets not throw that advantage away.

Amos