Re: Leading zeroes in 1*DIGIT productions

Jeff Walden wrote:
> ...
> So actually, I do know of a server that had a problem specifically with 
> leading zeros because it was using an API which would treat such numbers 
> as octal, absent the use-base-10 hint I promptly added when I discovered 
> the problem:
> 
> http://hg.mozilla.org/mozilla-central/file/87267825681b/netwerk/test/httpserver/httpd.js#l1520 
> 
> 
> I didn't bring it up initially because it's more a matter of the person 
> who wrote that line not being familiar with how parseInt works in 

Right. It is a documentation/education problem, but not with HTTP/1.1 
but with Javascript.

> JavaScript than of a deficiency in the specification, but code which 
> properly processes /most/ Content-Length values may not necessarily 
> properly process /all/ such values, in particular numbers which have the 
> format of octal numbers with leading zeroes.  I think explicitly noting 
> leading zeroes in accompanying prose makes it more likely that care will 
> be taken in processing such values.

Disagreed.

First of all, anybody who makes this mistake is likely to find out 
*very* soon.

Furthermore, the spec already says "decimal". That implies leading 
zeros. Repeating this doesn't make the spec any clearer, just longer. 
So, in general, I'm in favor of removing redundant text such as this 
would be.

 > ...

BR, Julian

Received on Wednesday, 24 December 2008 09:03:01 UTC