Re: p2: section 5.3.2 (Accept header)

Hi Osama,

On 09/05/2013, at 10:36 AM, Osama Mazahir <OSAMAM@microsoft.com> wrote:

> In section 5.3.1, the weight is defined as:
> ------------
>      weight = OWS ";" OWS "q=" qvalue
>      qvalue = ( "0" [ "." 0*3DIGIT ] )
>             / ( "1" [ "." 0*3("0") ] )
> ------------
>  
> In section 5.3.2, the Accept header grammar is defined as:
> ------------
>      Accept = #( media-range [ accept-params ] )
>  
>      media-range    = ( "*/*"
>                       / ( type "/" "*" )
>                       / ( type "/" subtype )
>                       ) *( OWS ";" OWS parameter )
>      accept-params  = weight *( accept-ext )
>      accept-ext     = OWS ";" OWS token [ "=" word ]
> ------------
>  
> The grammar seems to imply that the weight is always the first parameter.  But then the example shows that the weight is not the first parameter (e.g. the level=2 case):
> ------------
>      Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
>              text/html;level=2;q=0.4, */*;q=0.5
> ------------
>  
> Which way is correct?

Note that the media-range grammar allows a parameter, separately from accept-params. This is because:

> The media-range can include media type parameters that are applicable to that range.
> 
> Each media-range might be followed by zero or more applicable media type parameters (e.g., charset), an optional "q" parameter for indicating a relative weight (Section 5.3.1), and then zero or more extension parameters. The "q" parameter is necessary if any extensions (accept-ext) are present, since it acts as a separator between the two parameter sets.

<https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p2-semantics.html#header.accept>

I.e., there's a difference parameters on the media-range itself (usually, defined by the media type itself) and the extensions to the Accept header value.

Cheers,

--
Mark Nottingham   http://www.mnot.net/

Received on Thursday, 9 May 2013 05:24:36 UTC