Re: JSON headers

"Roy T. Fielding" <fielding@gbiv.com> Thu, 14 July 2016 19:34 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 05CA212D76F for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2016 12:34:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.308
X-Spam-Level:
X-Spam-Status: No, score=-8.308 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=gbiv.com
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 O2XnF5ha4m7w for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 14 Jul 2016 12:34:21 -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 290BB12D127 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 14 Jul 2016 12:34:21 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bNmKq-0007nJ-9O for ietf-http-wg-dist@listhub.w3.org; Thu, 14 Jul 2016 19:30:12 +0000
Resent-Date: Thu, 14 Jul 2016 19:30:12 +0000
Resent-Message-Id: <E1bNmKq-0007nJ-9O@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 <fielding@gbiv.com>) id 1bNmKm-0007Zi-EJ for ietf-http-wg@listhub.w3.org; Thu, 14 Jul 2016 19:30:08 +0000
Received: from sub5.mail.dreamhost.com ([208.113.200.129] helo=homiemail-a94.g.dreamhost.com) by maggie.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from <fielding@gbiv.com>) id 1bNmKg-0007L7-DC for ietf-http-wg@w3.org; Thu, 14 Jul 2016 19:30:05 +0000
Received: from homiemail-a94.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTP id AA1A838A06F; Thu, 14 Jul 2016 12:29:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=content-type :mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=WQDgK2s0aHzXuUGYRvrmNfQyGQI=; b=TBAmPllZMsKyKSHRsMVUVFy7vtHK t846T9EGeaXnbR7v7DQKPmjThf0M7xslquOeMS9RKx0dRSQG+I55XDrGTdKg3NrE VCaJm8oN6deQdWHdHwFre5HGC+KUAfvNeqXK+PQ1hugG4DQFAItHUxXbJqJh8+sD l6VpggMRW6h2BRk=
Received: from [192.168.1.7] (ip68-228-71-159.oc.oc.cox.net [68.228.71.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTPSA id 8037038A059; Thu, 14 Jul 2016 12:29:39 -0700 (PDT)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <4324.1468145426@critter.freebsd.dk>
Date: Thu, 14 Jul 2016 12:29:39 -0700
Cc: Julian Reschke <julian.reschke@gmx.de>, Phil Hunt <phil.hunt@oracle.com>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <35E62B8B-FAEF-4C61-AFD0-D07B90F237B7@gbiv.com>
References: <74180.1468000149@critter.freebsd.dk> <A17D3EFD-A935-4971-BCF6-DC9D38302CAD@oracle.com> <564a72e8-b9d3-1f9c-5982-48f2b07272e5@greenbytes.de> <3924.1468137899@critter.freebsd.dk> <683f5f58-6046-d9fb-cc75-d0ab3890ce23@greenbytes.de> <4105.1468141779@critter.freebsd.dk> <5cdf0fa8-063c-7eaa-a9e3-fb6db7417254@gmx.de> <4213.1468143913@critter.freebsd.dk> <94e4a5c2-3465-fef3-6221-d9f4fcccb5fa@gmx.de> <4324.1468145426@critter.freebsd.dk>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
X-Mailer: Apple Mail (2.2104)
Received-SPF: none client-ip=208.113.200.129; envelope-from=fielding@gbiv.com; helo=homiemail-a94.g.dreamhost.com
X-W3C-Hub-Spam-Status: No, score=-6.3
X-W3C-Hub-Spam-Report: AWL=-0.316, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1bNmKg-0007L7-DC 21a6c7d5af4b9fa256c4c0779d547ed7
X-Original-To: ietf-http-wg@w3.org
Subject: Re: JSON headers
Archived-At: <http://www.w3.org/mid/35E62B8B-FAEF-4C61-AFD0-D07B90F237B7@gbiv.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31967
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 Jul 10, 2016, at 3:10 AM, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> 
> --------
> In message <94e4a5c2-3465-fef3-6221-d9f4fcccb5fa@gmx.de>, Julian Reschke writes
> :
> 
>> But right now the spec *is* written to use the list construct, and I 
>> believe that's a good thing, as it's IMHO better to consider multiple 
>> instances as legal, and require the definition of the header field to 
>> deal with it.
> 
> I think it is a bad thing.
> 
> It prevents streaming processing of headers, since you never know
> when you have the full picture for a particular header, until you've
> received them all and seen that there are no more instances.

Which is the nature of header fields in general, since we don't know if
a spoofing attempt is being made until we read all of the headers,
including the ones not defined as a list.  In any case, we can certainly
process them as a stream as long as we remember what has already been
processed so that an appropriate action can be taken for duplicates.

> It means also means that either you have to rewrite the headers, or
> all your code needs to do the brute-force collection scan and handle
> an array of headers for further processing.  Both of which is wasteful
> in terms of CPU and memory.

Umm, no; we can just use a bit to indicate that, or a pointer for speed.

> I see no advantages that come even close to compensating for those
> disadvantages, but if I have overlooked something, please enlighten me...

The reason duplicate header fields exist is because email wanted them for
stuff like Received being appended to header blocks, so the RFC822 syntax
enables them and recipients need to deal with that regardless of semantics.
The semantics we defined for HTTP/1 allow for new field values to be
processed and forwarded by a recipient without knowing its definition.
This is used in practice today by high-speed message forwarding with
zero-copy constraints to append certain fields at the end of each
header block.

It is theoretically possible to do the same thing within a special encoding
of a header field value, but then every recipient MUST implement that special
encoding in that special way prior to any deployed instances of that protocol,
which cannot happen for HTTP/1.x.  No, changing the minor version is not sufficient,
since the fields are required to be processable regardless of field definition
by existing intermediaries, which means duplicates will mess up the field in
unexpected ways unless the value encoding assumes a list syntax will happen
whether you like it or not.

In any case, this discussion has nothing to do with Julian's proposal, which
is to define a common field syntax for HTTP/1.x field values that for some
insane reason want to use JSON for field processing.  Maybe that's just to add
UTF-8 characters, or for embedding field name-value pairs within other fields
(as was the case for logic bags, ages ago, or Key today), but it deserves to
be discussed in terms of what the draft defines and not hijacked into a
general discussion of HTTP/3.

....Roy