httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <>
Subject Re: How to treat "Range: bytes=0-"
Date Mon, 26 Sep 2011 18:00:19 GMT
Looking this over, I started with the below section:

    if (sum_lengths >= clength) {
        ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
                      "Sum of ranges not smaller than file, ignoring.");
        return 0;

which, at 1st blush looks like what we need to worry about… if
sum_lengths == clength, we can assume they sent 0-…

But then I noticed how we are counting sum_lengths, and saw that
we have an issue.

Assume they send:


and clen is 10000. When this is merged, we get the following


and we see that the subsequent sum of lengths is > clength
and we decide to go 200 on 'em. Anyway, this means we can't
use sum_lengths == clength as a check… It 

And since we only merge once, we can get the absolute smallest
list of ranges that cover what they sent…

Sooooo, I suggest we look for an actual '0-' in their input
as the trigger for the 200/206 decision.

If we DO see that, should be force a single range? That is, if
they send:

   1-100, 200-300, 0-, 30-9999

Should we ignore all but the 0- and send a single range
and 206?
View raw message