Re: Ambiguities in header-field rules (p1-messaging)

Amos Jeffries <squid3@treenet.co.nz> Thu, 18 August 2011 08:38 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 B27CF21F8A4B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 18 Aug 2011 01:38:20 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.543
X-Spam-Level:
X-Spam-Status: No, score=-10.543 tagged_above=-999 required=5 tests=[AWL=0.056, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bSYFThQebghK for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 18 Aug 2011 01:38:20 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 0AADD21F8782 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 18 Aug 2011 01:37:52 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1Qty76-0007rP-R0 for ietf-http-wg-dist@listhub.w3.org; Thu, 18 Aug 2011 08:38:08 +0000
Received: from aji.keio.w3.org ([133.27.228.206]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <squid3@treenet.co.nz>) id 1Qty6x-0007q1-Rp for ietf-http-wg@listhub.w3.org; Thu, 18 Aug 2011 08:38:00 +0000
Received: from [2002:3a1c:99e9:0:206:5bff:fe7c:b8a] (helo=treenet.co.nz) by aji.keio.w3.org with esmtp (Exim 4.72) (envelope-from <squid3@treenet.co.nz>) id 1Qty6t-0002lP-NO for ietf-http-wg@w3.org; Thu, 18 Aug 2011 08:37:58 +0000
Received: from troja.treenetnz.com (unknown [119.224.36.238]) by treenet.co.nz (Postfix) with ESMTP id A62F1E6FA2 for <ietf-http-wg@w3.org>; Thu, 18 Aug 2011 20:36:57 +1200 (NZST)
Message-ID: <4E4CCEE4.7000804@treenet.co.nz>
Date: Thu, 18 Aug 2011 20:35:48 +1200
From: Amos Jeffries <squid3@treenet.co.nz>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11
MIME-Version: 1.0
To: ietf-http-wg@w3.org
References: <4E4C013D.2090407@cyblogic.de> <88b489507e504d9eef318438194f929e@treenet.co.nz> <4E4CC609.7070500@cyblogic.de>
In-Reply-To: <4E4CC609.7070500@cyblogic.de>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Received-SPF: permerror client-ip=2002:3a1c:99e9:0:206:5bff:fe7c:b8a; envelope-from=squid3@treenet.co.nz; helo=treenet.co.nz
X-W3C-Hub-Spam-Status: No, score=-1.1
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, RDNS_NONE=0.793, TO_NO_BRKTS_NORDNS=0.001
X-W3C-Scan-Sig: aji.keio.w3.org 1Qty6t-0002lP-NO 95e0f8b63bba84b7021c3516704524d7
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Ambiguities in header-field rules (p1-messaging)
Archived-At: <http://www.w3.org/mid/4E4CCEE4.7000804@treenet.co.nz>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/11215
X-Loop: ietf-http-wg@w3.org
Sender: ietf-http-wg-request@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>
Resent-Message-Id: <E1Qty76-0007rP-R0@frink.w3.org>
Resent-Date: Thu, 18 Aug 2011 08:38:08 +0000

On 18/08/11 19:58, Frank Mertens wrote:
> On 08/18/2011 05:16 AM, Amos Jeffries wrote:
>> On Wed, 17 Aug 2011 19:58:21 +0200, Frank Mertens wrote:
>>> Hi,
>>>
>>> I played around with the ABNF published by this WG and stumbled
>>> over some rough edges.
>>>
>>> Current rules:
>>>
>>> OWS = *( [ obs-fold ] WSP )
>>> header-field = field-name ":" OWS [ field-value ] OWS
>>> field-value = *( field-content / OWS )
>>> field-content = *( WSP / VCHAR / obs-text )
>>>
>>> Problems:
>>>
>>> - field-value and field-content match the empty symbol,
>>> which requires searching for the longest match, which is costly
>>> (and confusing for the human reader)
>>> - because field-value matches the empty symbol claiming it optional
>>> in header-field allows ambiguous productions of same length
>>> (with or without field-value of zero length?)
>>>
>>> Suggested improvement:
>>>
>>> field-value = 1*( field-content OWS )
>>> field-content = 1*( VCHAR / WSP / obs-text )
>>>
>>> Best Regards,
>>> Frank Mertens.
>>
>>
>> The OWS on header-field remains ambiguous as well.
>>
>> Also, with WSP being in field-content there is the possibility of
>> header-field matching:
>>
>> field-name ":" [ obs-fold ] 1*( WSP OWS ) OWS
>>
>> Nasty. But section 3.2 comes to the rescue:
>> "The field value does not include any leading or trailing white space"
>> and
>> "HTTP/1.1 senders MUST NOT produce messages that include line folding"
>>
>> So OWS in the field-value ABNF appears to be invalid in several ways
>> going by the text.
>>
>>
>> Perhapse this would be better:
>>
>> header-field = field-name ":" [ WSP ] BWS [ field-value ]
>> field-value = 1*( field-content BWS )
>> field-content = 1*( VCHAR / WSP / obs-text )
>>
>>
>>
>>
>> Nit: section 1.2.2 currently says:
>>
>> "Multiple OWS octets that occur within field-content
>> SHOULD be replaced with a single SP before interpreting the field
>> value or forwarding the message downstream."
>> ...
>> "Multiple RWS octets that occur within field-content SHOULD be
>> replaced with a single SP before interpreting the field value or
>> forwarding the message downstream.
>> "
>>
>> When there is no OWS or RWS in the field-content ABNF.
>>
>> I think both should say header-field instead of field-content. Or
>> maybe drop the "within field-content" condition to make it general.
>>
>>
>> AYJ
>>
>>
>
> Yes, maybe we should also have a strict version of the grammar.
> But for now, I'm happy with a working tolerant one;)
> Replacing OWS by BWS would also disable support for line folding.

BWS accepts input which is folded. Look at its description in section 1.2.2

section 3.2 already prohibits folding with a MUST NOT which I quoted.

AYJ