Re: draft-ietf-httpbis-header-structure: handling multiple field values

Julian Reschke <julian.reschke@gmx.de> Wed, 13 May 2020 03:22 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 B5E403A07BA for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 May 2020 20:22:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.648
X-Spam-Level:
X-Spam-Status: No, score=-2.648 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=gmx.net
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 qT9AQyMkZ-4e for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 May 2020 20:22:12 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (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 974CD3A07B6 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 12 May 2020 20:22:12 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1jYhvE-00050f-Lo for ietf-http-wg-dist@listhub.w3.org; Wed, 13 May 2020 03:19:04 +0000
Resent-Date: Wed, 13 May 2020 03:19:04 +0000
Resent-Message-Id: <E1jYhvE-00050f-Lo@lyra.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <julian.reschke@gmx.de>) id 1jYhvC-0004zu-W7 for ietf-http-wg@listhub.w3.org; Wed, 13 May 2020 03:19:03 +0000
Received: from mout.gmx.net ([212.227.15.15]) by mimas.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <julian.reschke@gmx.de>) id 1jYhv7-0005Kq-3e for ietf-http-wg@w3.org; Wed, 13 May 2020 03:19:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1589339901; bh=FCyZtMdfjLy0E7eJ7Xg6HYIbOVlGp8TOjgeyCLz0OuM=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=Tpdfh6R0SwbOZ8p1RGc7XLu9w1RLZPriGbDLnxvRz2p4J2Hmsuc8o1+n30v2fwVtk elMgFKjPuIMPcY9g7Ct887cl3DQA2UyXw2ziBVTcRUWBaEN/oG7tTPkVGH7aM2sQJu w+RGnzAu6ExOtnxFFxVv/XNZdxfh/qiQ0rU53Wsg=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.178.182] ([84.171.147.129]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MMGN2-1jqmSZ1E0M-00JKXC; Wed, 13 May 2020 05:18:21 +0200
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Ian Clelland <iclelland@google.com>, Willy Tarreau <w@1wt.eu>, HTTP Working Group <ietf-http-wg@w3.org>
References: <f55521dd-e1d3-d925-688c-c472ad67bfb4@gmx.de> <20200512172347.GB4817@1wt.eu> <CAK_TSXJ3o7F9x63MSYyEhr7de0vO1Yu2s8JnjkhT7n4BQiQp+A@mail.gmail.com> <706ee02a-2ecc-6cce-0754-909d6b9f4edd@gmx.de> <CAK_TSXJxex1t32EnfPqYUKhTdqJZFbRf36_FLKJeP2Tqu7RXMg@mail.gmail.com> <4045931b-06b3-9b76-106f-773499b8374b@gmx.de> <11162.1589312096@critter.freebsd.dk> <6121e33e-46d3-e361-9e4e-ad0158a0a8c5@gmx.de> <11779.1589318551@critter.freebsd.dk>
From: Julian Reschke <julian.reschke@gmx.de>
Message-ID: <9f926a4c-697d-e9f5-ee00-91a6f2df9b81@gmx.de>
Date: Wed, 13 May 2020 05:18:19 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0
MIME-Version: 1.0
In-Reply-To: <11779.1589318551@critter.freebsd.dk>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:ByeIvTAfL9HbOxaQLfRVeHr9a8mCn1XOvW91C4Qd1gSu9STxjDE 96UN20lYgMyOpppqw+0satZk/Aw8lqPBklf3lc4prmKcRkk0RJN7BIArN6F1ABrIXMt+QMx knsUyFYNBvTSeaYvxnRycHOfUewB/76LFjIUiSovljaqgS3kblDL2vnDx+EqWXfliHHVEcf BR9hLscOH1hG8xe7NxJvA==
X-UI-Out-Filterresults: notjunk:1;V03:K0:/cr73KnxSi0=:3zybh1cO2JKDNZvXxwylJZ 7I7ZZQuX6mIXJxeID22QBWO8bZKzbfbAKw2dG++eBORkhjwm6oNSaS3vvMiP+ql7rYFcFOdON T7VfQSVCz72W350sZ9ydB+oWRV5+I9hcCVL/gJ+rRHVPSH7hd0LZG9hIgWJ/M996XzoQWDucw Qqwdngir6kpVLRHVMKfE1Nd9RVCEN13ciGYks06KsD9pWIMxXRuRtImVOr3RwuIV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envelope-from=julian.reschke@gmx.de; helo=mout.gmx.net
X-W3C-Hub-Spam-Status: No, score=-5.6
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1jYhv7-0005Kq-3e d7c46b179d14760c3c9a82ddff9d29e2
X-Original-To: ietf-http-wg@w3.org
Subject: Re: draft-ietf-httpbis-header-structure: handling multiple field values
Archived-At: <https://www.w3.org/mid/9f926a4c-697d-e9f5-ee00-91a6f2df9b81@gmx.de>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/37613
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: <https://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.05.2020 23:22, Poul-Henning Kamp wrote:
> --------
> In message <6121e33e-46d3-e361-9e4e-ad0158a0a8c5@gmx.de>de>, Julian Reschke writes
> :
>
>> The issue here is that combining
>>
>>    Foo: "a
>>
>> and
>>
>>    Foo: b"
>>
>> into
>>
>>    Foo: "a, b"
>>
>> *hides* an issue, and no failure will occur. Furthermore, we not only
>> get no failure, but the resulting string may vary depending on how the
>> fields were combined.
>>
>> I get that it's unavoidable that this *can* happen, but does this mean
>> we should *disallow* failing for that input?
>
> Yes, we should disallow it, because that would cause a valid request
> to fail unless a proxy implemented a particular way is in the path.

How can the request be valid, if the resulting string is not fully
predictable?
(https://greenbytes.de/tech/webdav/draft-ietf-httpbis-header-structure-18.html#rfc.section.4.2.p.6)

> I think we say this very clearly on page 23:
>
>     When generating input_bytes, parsers MUST combine all lines in the
>     same section (header or trailer) that case-insensitively match the
>     field name into one comma-separated field-value, as per [RFC7230],
>     Section 3.2.2; this assures that the entire field value is processed
>     correctly.
>
> Poul-Henning
>
> PS: I think your example is wrong, the combined header would be:
>
>      Foo: "a,b"
>
> Because there is an important asymmetry in RFC7230/3.2.2.
>
> A sender is required to know the syntax of the header is a comma
> separated list, before can split the header.
>
> A receiver on the other hand is under no such obligation, and therefore
>
>     "…by appending each subsequent field value to
>     the combined field value in order, separated by a comma."
>
> should be interpreted narrowly:  Only a comma, not whitespace.

(see Willy's reply) FWIW, the latest spec says:

"A recipient MAY combine multiple field lines with the same field name
into one field line, without changing the semantics of the message, by
appending each subsequent field line value to the initial field line
value in order, separated by a comma and optional whitespace. For
consistency, use comma SP."
<https://greenbytes.de/tech/webdav/draft-ietf-httpbis-semantics-latest.html#rfc.section.4.1.p.2>

We go on with

"This means that, aside from the well-known exception noted below, a
sender MUST NOT generate multiple field lines with the same name in a
message (whether in the headers or trailers), or append a field line
when a field line of the same name already exists in the message, unless
that field's definition allows multiple field line values to be
recombined as a comma-separated list [i.e., at least one alternative of
the field's definition allows a comma-separated list, such as an ABNF
rule of #(values) defined in Section 4.5]."

I wonder whether we should point out that each *individual* field line
needs to conform to the syntax defined for the field value, so that
splitting strings over lines would be disallowed.

Best regards, Julian