Re: Leading zeroes in 1*DIGIT productions

Jeff Walden wrote:
> 
> 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

Right.

> 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

That would be an incompatible change, something we can't make with this 
revision.

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

How would that help? As far as I can tell, leading zeros are totally 
harmless. Do you have evidence of problems caused by them?

BR, Julian

Received on Thursday, 18 December 2008 19:59:21 UTC