Re: p2: section 5.3.2 (Accept header)

Mark Nottingham <mnot@mnot.net> Thu, 09 May 2013 05:26 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 A45D921F8DCF for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 8 May 2013 22:26:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.584
X-Spam-Level:
X-Spam-Status: No, score=-10.584 tagged_above=-999 required=5 tests=[AWL=0.015, 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 o+MP-9COMZNz for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 8 May 2013 22:26:50 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 737D521F8E06 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 8 May 2013 22:26:50 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UaJLW-0008KG-G9 for ietf-http-wg-dist@listhub.w3.org; Thu, 09 May 2013 05:24:50 +0000
Resent-Date: Thu, 09 May 2013 05:24:50 +0000
Resent-Message-Id: <E1UaJLW-0008KG-G9@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <mnot@mnot.net>) id 1UaJLI-0008JO-8F for ietf-http-wg@listhub.w3.org; Thu, 09 May 2013 05:24:36 +0000
Received: from mxout-07.mxes.net ([216.86.168.182]) by maggie.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <mnot@mnot.net>) id 1UaJLG-0002h9-R2 for ietf-http-wg@w3.org; Thu, 09 May 2013 05:24:36 +0000
Received: from mnot-mini.mnot.net (unknown [118.209.105.214]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id AC4DE22E1F4; Thu, 9 May 2013 01:24:12 -0400 (EDT)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <b3bef7bc7c2a4cc0b8d2849a38088bfb@SN2PR03MB046.namprd03.prod.outlook.com>
Date: Thu, 9 May 2013 15:24:09 +1000
Cc: "ietf-http-wg@w3.org Group" <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <38634FA9-E0A3-439B-98E8-E3D0C32C32DB@mnot.net>
References: <b3bef7bc7c2a4cc0b8d2849a38088bfb@SN2PR03MB046.namprd03.prod.outlook.com>
To: Osama Mazahir <OSAMAM@microsoft.com>
X-Mailer: Apple Mail (2.1503)
Received-SPF: pass client-ip=216.86.168.182; envelope-from=mnot@mnot.net; helo=mxout-07.mxes.net
X-W3C-Hub-Spam-Status: No, score=-3.4
X-W3C-Hub-Spam-Report: AWL=-3.387, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1UaJLG-0002h9-R2 fb0e35c2dcf2fa4db7db8dcdef38d979
X-Original-To: ietf-http-wg@w3.org
Subject: Re: p2: section 5.3.2 (Accept header)
Archived-At: <http://www.w3.org/mid/38634FA9-E0A3-439B-98E8-E3D0C32C32DB@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17904
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>

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/