Re: Multiple header fields with the same field name - unwritten assumption about quoted commas in values?

Zhong Yu <zhong.j.yu@gmail.com> Wed, 16 January 2013 18:34 UTC

Return-Path: <ietf-http-wg-request@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 B27AA21F8AB8 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 16 Jan 2013 10:34:35 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.513
X-Spam-Level:
X-Spam-Status: No, score=-10.513 tagged_above=-999 required=5 tests=[AWL=0.086, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YV7zLEA2h5OT for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 16 Jan 2013 10:34:34 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id A8EDC21F8941 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 16 Jan 2013 10:34:34 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1TvXnB-0001ec-Jf for ietf-http-wg-dist@listhub.w3.org; Wed, 16 Jan 2013 18:32:53 +0000
Resent-Date: Wed, 16 Jan 2013 18:32:53 +0000
Resent-Message-Id: <E1TvXnB-0001ec-Jf@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <zhong.j.yu@gmail.com>) id 1TvXn7-0001dr-OD for ietf-http-wg@listhub.w3.org; Wed, 16 Jan 2013 18:32:49 +0000
Received: from mail-ob0-f171.google.com ([209.85.214.171]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <zhong.j.yu@gmail.com>) id 1TvXn6-0000Y6-M6 for ietf-http-wg@w3.org; Wed, 16 Jan 2013 18:32:49 +0000
Received: by mail-ob0-f171.google.com with SMTP id dn14so1685510obc.2 for <ietf-http-wg@w3.org>; Wed, 16 Jan 2013 10:32:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=zC/DSxf2HSmU/IR9Fx0WbmhVCI9TzIrfhLwz2DnLlU8=; b=ILGoOZva8chpDyh+ylvDtsHu06MMAGVYorjMoooniZvtbOD7e3yaMgpqZNFYGzHJYC QZyxtZfaGBFmBqVJgQKOqMqeWKudUSKRzhmkqL6C5DXc7ZLQIO7+F8gpECnp3+MAiJoV Veu71Vd0nzUBekLMGAaLhlqXf78MPZyn7oVWicGQoJlJAtr+zicfZn/1AVWLdBCyakl2 Vja9mau34WCyHHViRMWAgjSEK0Wu22PexSL809mpwLswtA0zv4PwqUXdTmnhfFliH6H1 c0FtF0NjWX5/XFutEPd1LUImrXd18dWgledLqE5IkfG9ioO7Qw8LBudAplUkjJiIjGVJ BkLA==
MIME-Version: 1.0
X-Received: by 10.60.32.39 with SMTP id f7mr1626740oei.86.1358361142604; Wed, 16 Jan 2013 10:32:22 -0800 (PST)
Received: by 10.76.12.227 with HTTP; Wed, 16 Jan 2013 10:32:22 -0800 (PST)
In-Reply-To: <20130116065254.GA12426@1wt.eu>
References: <BD31B7FE-1CB4-48AD-A119-37A3509EF8E9@opera.com> <6D9EA8FA-50A6-44B1-A2EF-BB428E94183C@mnot.net> <CAK3OfOj8G3gFbTK_vPSnjS0qij+SUB3t9CdG80FYW5tbGgKR3A@mail.gmail.com> <C6A43E78-4F94-4FE3-A049-678555896FEC@mnot.net> <CAK3OfOiS1UPqvsk5H8RWUKyw8MB=uykeMkXzZoffm6732=UjMg@mail.gmail.com> <86DE887E-B189-40D2-A867-C81CFB0434AB@mnot.net> <CAK3OfOiWzJqHr8VSzn6WFcWRGJEr59XiUyh+wGTDnf1ydVL=3g@mail.gmail.com> <1390897A-59CF-451B-B3CD-BB39906BDACD@mnot.net> <CAK3OfOg17M3LTPwFJXFuHrq4AZh505hq27xoeVwJsPTvA7_3aw@mail.gmail.com> <A9D632AF-448F-4B5A-B3A0-33CF9BFDC3B4@gbiv.com> <20130116065254.GA12426@1wt.eu>
Date: Wed, 16 Jan 2013 12:32:22 -0600
Message-ID: <CACuKZqH226evA0v26aop5oXtbjm8m=ePFip=1roJmrA3tygrGg@mail.gmail.com>
From: Zhong Yu <zhong.j.yu@gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: "Roy T. Fielding" <fielding@gbiv.com>, Nico Williams <nico@cryptonector.com>, Mark Nottingham <mnot@mnot.net>, Karl Dubost <karld@opera.com>, Julian Reschke <julian.reschke@gmx.de>, Piotr Dobrogost <p@ietf.dobrogost.net>, ietf-http-wg@w3.org
Content-Type: text/plain; charset="ISO-8859-1"
Received-SPF: pass client-ip=209.85.214.171; envelope-from=zhong.j.yu@gmail.com; helo=mail-ob0-f171.google.com
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.708, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1TvXn6-0000Y6-M6 6fe33f9873177785b231a812b441c364
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Multiple header fields with the same field name - unwritten assumption about quoted commas in values?
Archived-At: <http://www.w3.org/mid/CACuKZqH226evA0v26aop5oXtbjm8m=ePFip=1roJmrA3tygrGg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/15908
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 Wed, Jan 16, 2013 at 12:52 AM, Willy Tarreau <w@1wt.eu> wrote:
> On Tue, Jan 15, 2013 at 05:12:51PM -0800, Roy T. Fielding wrote:
>> On Jan 15, 2013, at 4:07 PM, Nico Williams wrote:
>>
>> > On Tue, Jan 15, 2013 at 6:01 PM, Mark Nottingham <mnot@mnot.net> wrote:
>> >> On 16/01/2013, at 10:57 AM, Nico Williams <nico@cryptonector.com> wrote:
>> >>> No.  I'm saying that it's OK for apps to do that but not any other
>> >>> entities (middleboxes), mostly because middleboxes can't possibly know
>> >>> about headers that hadn't been registered when they were implemented.
>> >>
>> >> OK. Is this an actual problem you've encountered?
>> >>
>> >> I'm fine with adding some clarifying text if it helps implementers, but I haven't seen this confusing any middlebox vendors; they tend to leave the bits alone...
>> >
>> > I noticed Poul's and someone else's replies that in their middlebox
>> > implementations they concluded that it's never safe to merge headers.
>> > If that's the case (and I do think it follows from the facts that it
>> > is the case) then we should say so rather than leave each implementor
>> > to figure this out on their own.
>>
>> The requirement is on generating headers, so it does not concern
>> middlebox vendors other than for the fields that they add to a message.
>>
>> Apache httpd merges header fields as they are read from the network.
>> So does any correctly written client that reads internet message format
>> (like all of the common MIME and libwww libraries).  If you want to
>> interoperate on the Web, field generators must obey that requirement.
>
> Roy, you're totally right here. If Apache merges multiple instances of
> a header, it is because the client did so, and as per the spec, it was
> allowed to do so because the headers were mergeable.
>
> However I've seen some corner cases caused by applications (not middleboxes)
> sometimes adding a header that was already present and not mergeable (eg:
> the Date or Location header). I know that Apache has a special handling of

If different applications interpret duplicate headers differently, we
have a serious problem

    Location: http://abc.com
    Location: http://xyz.com

Some chooses the 1st one, some chooses the 2nd one, and some may see
the merged `http://abc.com,http://xyz.com` (a valid URI)

We probably should require that an application either reject the
message, or merge the header first if it wants to parse the header.

Zhong Yu

> the Set-Cookie header, I don't know if it does so for other well-known
> non-mergeable headers which are supposed to contain commas.
>
> Due to this mess caused by bogus applications, I finally decided that I
> won't merge headers in haproxy, I didn't want to start dealing with a list
> of exceptions. And I think it's the same reasoning for Poul Henning.
>
> That said, I disagree with having the spec declare Apache non-compliant,
> as it is doing the correct job in my opinion, as long as clients are
> compliant.
>
> But probably we could discourage future middlebox implementors from merging,
> by making them aware of the difficulty of doing it right. This would just be
> a non-normative warning then.
>
> Willy
>
>