Leading zeroes in 1*DIGIT productions

Many places in RFC2616 which specify decimal numbers do so using 1*DIGIT, e.g.

first-byte-pos  = 1*DIGIT

This production admits the possibility of leading zeroes in a non-zero number, so, for example, you might have this header:

Content-Length: 017

I'm not sure whether this is intentional or not (HTTP-Version makes it explicit, but e.g. Content-Length does not), but it's slightly confusing if the number (as above) matches the common format for octal numbers, not to mention a little bit nonsensical to include gratuitous leading zeroes.  I would prefer if something like the following were used instead:

nonzero-decimal-digit  = "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
decimal-digit   = "0" / nonzero-decimal-digit
decimal-number  = "0" / nonzero-decimal-digit*decimal-digit
first-byte-pos  = decimal-number

Alternately, making it clear that leading zeroes are allowed but (perhaps) MUST NOT be sent  would be acceptable.

Jeff

Received on Thursday, 18 December 2008 19:42:19 UTC