On Wed, Feb 17, 2010 at 02:04:03AM +0000, Stuart Henderson wrote:
> On 2010-02-16, [email protected] <[email protected]> wrote:
> > I've seen examples of earlier versions than Apache 1.3.29 said to be working
> > with byte-range requests, has anyone got the byte range requests to work
> > with
> > openbsd without using php code or know how this can be done or if it works
> > by
> > default.
>
> sorry, it's broken, maybe someone who uses base httpd and has some
> spare time might like to look into fixing it...
>
> http://permalink.gmane.org/gmane.os.openbsd.misc/169541
>
This appears to be due to the format of the string being passed to
strtonum(). ap_strtol() was tolerant of it. It's being passed the
string from the Range: header.
For example, the following valid request (taken directly from sniffing a
wget session).
GET /testfile HTTP/1.0
Range: bytes=300417024-
This ends up following the code path of the first strtonum() call around
line 159 in http_protocol.c in the parse_byterange() function. The
string passed to strtonum to convert (r->range) not only contains the
number from the header, but the trailing dash ("300417024-"), which
strtonum does not like. As strtonum fails, the start offset is set to
0.
This bug should be present on a 64-bit arch as well.