Commit efb10270 authored by Eric Covener's avatar Eric Covener
Browse files

merge some more adjacent ranges such as a-n,n+1-b, and

refactor/reduce the tests on the start/end positions.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1162440 13f79535-47bb-0310-9956-ffa450edef68
parent c5a97a06
Loading
Loading
Loading
Loading
+7 −10
Changes for modules/http/byterange_filter.c: 7 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -532,23 +532,20 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
        }
        in_merge = 0;
      
        if (!(end <= ostart || start-1 >= oend)) {
            if (start < ostart) {
                ostart = start;
                reversals++;
        if (start >= ostart && end <= oend) { 
            in_merge = 1;
        } 
            else if (start < oend || start == ostart) {

        if (start < ostart && end >= ostart-1) {
            ostart = start;
            reversals++;
            in_merge = 1;
        }
            if (end >= oend && (start-1) <= oend) {
        if (end >= oend && start <= oend+1 ) {
            oend = end;
            in_merge = 1;
        }
            else if (end > ostart && end <= oend) {
                in_merge = 1;
            }
        }

        if (in_merge) {
            overlaps++;
            continue;