From e800d3c63f069dcb677beb680187a07e660e048f Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Sat, 27 Aug 2011 20:37:58 +0000 Subject: [PATCH] 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 --- modules/http/byterange_filter.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/http/byterange_filter.c b/modules/http/byterange_filter.c index 046aa51d77..a1cbd9c6db 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -531,24 +531,21 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength, continue; } in_merge = 0; + + if (start >= ostart && end <= oend) { + in_merge = 1; + } - if (!(end <= ostart || start-1 >= oend)) { - if (start < ostart) { - ostart = start; - reversals++; - in_merge = 1; - } - else if (start < oend || start == ostart) { - in_merge = 1; - } - if (end >= oend && (start-1) <= oend) { - oend = end; - in_merge = 1; - } - else if (end > ostart && end <= oend) { - in_merge = 1; - } + if (start < ostart && end >= ostart-1) { + ostart = start; + reversals++; + in_merge = 1; } + if (end >= oend && start <= oend+1 ) { + oend = end; + in_merge = 1; + } + if (in_merge) { overlaps++; continue; -- 2.40.0