Subject: [apps-discuss] RFC3023: Is note about HTTP Accept header wrong

From: Raphael Bossek <[email-masked]>
Date: Thu, 1 Sep 2011 15:26:13 +0200

Need your help,

Study the RFC 3023 found the following note that seams to be incorrect
for me. Here the note at page 17
(http://tools.ietf.org/html/rfc3023#page-17):

NOTE: Section 14.1 of HTTP[RFC2616] does not support Accept
headers of the form "Accept: */*+xml" and so this header MUST NOT
be used in this way.

In RFC 2616 section 14.1 Accept at page 100
(http://tools.ietf.org/html/rfc2616#section-14.1) the BNF says:

       Accept         = "Accept" ":"
                        #( media-range [ accept-params ] )

       media-range    = ( "*/*"
                        | ( type "/" "*" )
                        | ( type "/" subtype )
                        ) *( ";" parameter )
       accept-params  = ";" "q" "=" qvalue *( accept-extension )
       accept-extension = ";" token [ "=" ( token | quoted-string ) ]

Let us focus on the definition of `subtype` in section 3.7 Media types
(http://tools.ietf.org/html/rfc2616#section-3.7):

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

We have now to find the definition of `token` in section 2.2 Basic
rules at page 17 (http://tools.ietf.org/html/rfc2616#page-17):

       token          = 1*<any CHAR except CTLs or separators>
       separators     = "(" | ")" | "<" | ">" | "@"
                      | "," | ";" | ":" | "\" | <">
                      | "/" | "[" | "]" | "?" | "="
                      | "{" | "}" | SP | HT

CTL and seperator does not define a + (plus) char too. In other word +
(plus) is allowed. Please refer to section 2.2 Basic rules at page 17
(http://tools.ietf.org/html/rfc2616#page-16):

       OCTET          = <any 8-bit sequence of data>
       CHAR           = <any US-ASCII character (octets 0 - 127)>
       UPALPHA        = <any US-ASCII uppercase letter "A".."Z">
       LOALPHA        = <any US-ASCII lowercase letter "a".."z">
       ALPHA          = UPALPHA | LOALPHA
       DIGIT          = <any US-ASCII digit "0".."9">
       CTL            = <any US-ASCII control character
                        (octets 0 - 31) and DEL (127)>
       CR             = <US-ASCII CR, carriage return (13)>
       LF             = <US-ASCII LF, linefeed (10)>
       SP             = <US-ASCII SP, space (32)>
       HT             = <US-ASCII HT, horizontal-tab (9)>
       <">            = <US-ASCII double-quote mark (34)>

Where is my mistake?
Raphael

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Thu, 01 Sep 2011 18:03:54 +0200

>Where is my mistake?

The assumption is that the second `*` above would be treated as a wild-
card rather than as part of the type name. That is not the case with RFC
2616, so `*+xml` refers to one subtype and not many.
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/