httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Ames <>
Subject Re: [PATCH] daedalus coredump from 2.0.35c
Date Wed, 10 Apr 2002 20:31:04 GMT
Greg Ames wrote:
> OK, I had a look at RFC 2616.  The current ordering now makes sense to me,
> because the Content-Length: header we put on the wire has to be the the length
> of the partial GET limited by the ranges, not the length of the whole thing if
> there weren't ranges.  It's clearly explained in section 10.2.7.
> Ryan Bloom wrote:
> > > Clearly there is a bug.  As I explained, with the current ordering, the
> > > byterange filter can take itself out of the chain the first time it is
> > > called,
> > > before the true content length is known.
> >
> > The problem here is that the byterange filter is removing itself before
> > it should.  Moving it shouldn't actually solve this problem at all.  The
> > byterange filter should ONLY remove itself if it looks at the request
> > headers, and there is no Range header at all.
> Well, that's not what it's doing, but it should be pretty easy to fix.

ummm, no, it won't be pretty easy to fix.

The current code generates a Content-Range: header before the total length of
the response body is known, in addition to deciding whether to keep the b-r
filter in the chain.  The Content-Range: header is supposed to contain the total
length of the response body, as well as the range returned to the client.  

So if we just change it to just keep the filter in the chain when there's a
range, we will continue to generate invalid Content-Range headers, as we are


[gregames@daedalus gregames]$ ls -l /www/
-rw-r--r--  1 rbowen  httpd  20419 Oct  7  2001

[gregames@gandalf netcat]$ cat br0
HEAD /docs/cygwin.html HTTP/1.1
Range: bytes=0-

[gregames@gandalf netcat]$ nc 80 < br0
HTTP/1.1 206 Partial Content
Date: Wed, 10 Apr 2002 20:24:24 GMT
Server: Apache/2.0.35 (Unix)
Accept-Ranges: bytes
Content-Range: bytes 0-20418/20419
Content-Type: text/html
Content-Length: 20603

The whole response body is 20603 bytes long, but the Content-Range: header is
generated from the length of one file.


View raw message