W3C home > Mailing lists > Public > ietf-http-wg-old@w3.org > May to August 1996

is Accept header BNF ambiguous ?

From: Anselm Baird-Smith <abaird@w3.org>
Date: Thu, 6 Jun 1996 12:58:53 +0500
Message-Id: <9606061658.AA20693@www18.w3.org>
To: http-wg%cuckoo.hpl.hp.com@hplb.hpl.hp.com

I have started writing the parsers for the 1.1 headers, starting with
the beginning, I am trying to parse the Accept header, whose
definition is given by (section 14.1):

       Accept         = "Accept" ":" #(
                             media-range
                             [ ( ":" | ";" )
                               range-parameter
                               *( ";" range-parameter ) ]
                            | extension-token )

       media-range    = ( "*/*"
                        | ( type "/" "*" )
                        | ( type "/" subtype )
                        ) *( ";" parameter )

       range-parameter = ( "q" "=" qvalue )
                       | extension-range-parameter

       extension-range-parameter = ( token "=" token )

       extension-token = token

FYI, parameter is defined as (section 3.7):

       parameter      = attribute "=" value
       attribute      = token
       value          = token | quoted-string

If the media-range is separated from the range-parameter by a ':',
then I am happy, everything is fine (note that for 1.1 server this is
only a SHOULD, not a MUST, I can't see why). However, if media-range
is separated from range-parameter by a ';' (as some clients did in
HTTP/1.0), then I have no ways to know wether the given parameter is
to be attached to the media-range clause rather then to the
range-parameter one. As far as I understand the problem is that both
the parameter and the range-parameter are extensible.

More pragmatically when I am parsing:

Accept: text/html;x=1;y=2

I have to be able to select one of the following interpretations:

a) media-range=text/html;x=1;y=2
   range-paramer=EMPTY
b) media-range=text/html;x=1
   range-parameter=y=2
c) media-range=text/html
   range-parameter=x=1;y=2

And I don't know how to do it.

Anselm.
Received on Thursday, 6 June 1996 10:01:08 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 06:32:03 EDT