Re: JSON headers

Willy Tarreau <w@1wt.eu> Tue, 12 July 2016 03:27 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 D41EB12D0DF for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 11 Jul 2016 20:27:57 -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 1KUN_cTMppt7 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 11 Jul 2016 20:27:56 -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 77D7112D094 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 11 Jul 2016 20:27:56 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bMoI9-000502-IF for ietf-http-wg-dist@listhub.w3.org; Tue, 12 Jul 2016 03:23:25 +0000
Resent-Date: Tue, 12 Jul 2016 03:23:25 +0000
Resent-Message-Id: <E1bMoI9-000502-IF@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <w@1wt.eu>) id 1bMoI5-0004zB-Be for ietf-http-wg@listhub.w3.org; Tue, 12 Jul 2016 03:23:21 +0000
Received: from wtarreau.pck.nerim.net ([62.212.114.60] helo=1wt.eu) by lisa.w3.org with esmtp (Exim 4.80) (envelope-from <w@1wt.eu>) id 1bMoHr-0006Pa-W3 for ietf-http-wg@w3.org; Tue, 12 Jul 2016 03:23:17 +0000
Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id u6C3MbJ8010200; Tue, 12 Jul 2016 05:22:37 +0200
Date: Tue, 12 Jul 2016 05:22:37 +0200
From: Willy Tarreau <w@1wt.eu>
To: Yanick Rochon <yanick.rochon@gmail.com>
Cc: Julian Reschke <julian.reschke@gmx.de>, Poul-Henning Kamp <phk@phk.freebsd.dk>, Phil Hunt <phil.hunt@oracle.com>, HTTP Working Group <ietf-http-wg@w3.org>
Message-ID: <20160712032237.GA10172@1wt.eu>
References: <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> <20160711192515.GA9614@1wt.eu> <CAB0No9kgPJqMZQ2=qpMw4yh7Tq-1V+nkuagrN71HTTeXYpJ9kA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAB0No9kgPJqMZQ2=qpMw4yh7Tq-1V+nkuagrN71HTTeXYpJ9kA@mail.gmail.com>
User-Agent: Mutt/1.6.0 (2016-04-01)
Received-SPF: pass client-ip=62.212.114.60; envelope-from=w@1wt.eu; helo=1wt.eu
X-W3C-Hub-Spam-Status: No, score=-5.5
X-W3C-Hub-Spam-Report: AWL=-0.574, BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: lisa.w3.org 1bMoHr-0006Pa-W3 3f5253312b975bdad7d7aee2ea702f13
X-Original-To: ietf-http-wg@w3.org
Subject: Re: JSON headers
Archived-At: <http://www.w3.org/mid/20160712032237.GA10172@1wt.eu>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31912
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 Mon, Jul 11, 2016 at 03:47:32PM -0400, Yanick Rochon wrote:
> On 11 July 2016 at 15:25, Willy Tarreau <w@1wt.eu> wrote:
> 
> > On Mon, Jul 11, 2016 at 09:11:09PM +0200, Julian Reschke wrote:
> >
> > OK thanks for explaining. But then what situation could lead to this
> > confusing object to be emitted ? I thought that it was only related to
> > posting multiple headers in which case I don't see the issue if we
> > consider that all these headers are lists, and are then concatenated
> > by the recipient.
> >
> >
> If, for example, a sender sends a request such as
> 
> { ..., "Accept":
> "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
> ..., "Accept": "text/plain;q=0.9", ... }
> 
> through a clumsy string concatenation, what is the suggested behavior?

For me it means it sent two values for the Accept header defined as a list,
the first one being "appliation/xml...", and the second one "text/plain...".

I'm having an issue with the representation above though (and maybe I missed
certain things recently), because my understanding of JSON headers till now
was that one would send :

   { "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" }

as the value of the first Accept header field, then

   { "text/plain;q=0.9" }

as the value of the second Accept header field.

And it's the recipient which would then decide to make a list of it because
we'd specifiy that each JSON-encoded header is a clearly defined list, so on
first header received it would do something like this (I'm not 100% sure about
the syntax as I'm not good at JSON) :

   { "Accept": {
        "application/xml", "application/xhtml+xml", "text/html;q=0.9",
        "text/plain;q=0.8", "image/png", "*/*;q=0.5" } }

Then when receiving the second header, it would simply append its value to
the list :

   { "Accept": {
        "application/xml", "application/xhtml+xml", "text/html;q=0.9",
        "text/plain;q=0.8", "image/png", "*/*;q=0.5", "text/plain;q=0.9" } }

Since it seams easy to me I'm having an issue understanding the deeper
problem and am pretty sure I missed something :-/

Regards,
Willy