W3C home > Mailing lists > Public > ietf-http-wg@w3.org > April to June 2008

Re: ABNF switch: list rules

From: Zed A. Shaw <zedshaw@zedshaw.com>
Date: Sat, 24 May 2008 05:05:19 -0400
To: HTTP Working Group <ietf-http-wg@w3.org>
Message-Id: <20080524050519.3395366e.zedshaw@zedshaw.com>

On Sat, 24 May 2008 10:10:12 +0200
Julian Reschke <julian.reschke@gmx.de> wrote:

> > AC-QValue = ";" "q" "=" qvalue
> > AC-Type = (charset | "*")
> > AC-Expression = AC-Type [AC-QValue]
> > AC-Element = *LWS [AC-Expression] [","]
> > Accept-Charset = "Accept-Charset" ":" *(AC-Element)
 
> > "AC is 'Accept-Charset:' followed by any number of elements.  Elements
> > have any amount of leading white-space, an optional expression, and an
> > optional comma.  Expressions have a type and optional q-value."
> 
> Right, but RFC2616 requires that the list includes at least one 
> none-empty element :-)

Well, if it were a programming language I would say that's for
semantic analysis, rather than trying to cram that into the parser.
But yes, my version doesn't do that.

   AC-f = ( ( charset | "*" )[ ";" "q" "=" qvalue ] )
   AC-e = *LWS AC-f
   COMMA = *LWS ","

   Accept-Charset = "Accept-Charset" ":" *COMMA AC-e *( COMMA [ AC-e ])

And looking at your's that's the way you have to do it to
enforce at least one element in the list.  Interesting.

On another note, is there a reason why it's specified this way with
the allowed empty elements at random locations? 

It makes more sense to just not send anything that'd be empty, rather
than using empty elements.  In theory someone could just stream a ton of
',' to make the server do useless work, which could thwart some poorly
implemented parsers.

I'm curious about the history if anyone knows it.

-- 
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
Received on Saturday, 24 May 2008 09:12:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 06:50:48 GMT