[patch-1] Range filter: support multiple ranges.

Maxim Dounin mdounin at mdounin.ru
Thu Nov 9 14:48:24 UTC 2017


Hello!

On Fri, Oct 27, 2017 at 06:50:32PM +0800, 胡聪 (hucc) wrote:

> # HG changeset patch
> # User hucongcong <hucong.c at foxmail.com>
> # Date 1509099940 -28800
> #      Fri Oct 27 18:25:40 2017 +0800
> # Node ID 62c100a0d42614cd46f0719c0acb0ad914594217
> # Parent  b9850d3deb277bd433a689712c40a84401443520
> Range filter: support multiple ranges.

This summary line is at least misleading.

> When multiple ranges are requested, nginx will coalesce any of the ranges
> that overlap, or that are separated by a gap that is smaller than the
> NGX_HTTP_RANGE_MULTIPART_GAP macro.

(Note that the patch also does reordering of ranges.  For some 
reason this is not mentioned in the commit log.  There are also 
other changes not mentioned in the commit log - for example, I see 
ngx_http_range_t was moved to ngx_http_request.h.  These are 
probably do not belong to the patch at all.)

Reordering and/or coalescing ranges is not something that clients 
usually expect to happen.  This was widely discussed at the time 
of CVE-2011-3192 vulnerability in Apache.  As a result, RFC 7233 
introduced the "MAY coalesce" clause.  But this doesn't make 
clients, especially old ones, magically prepared for this.

Moreover, this will certainly break some use cases like "request 
some metadata first, and then rest of the file".  So this is 
certainly not a good idea to always reorder / coalesce ranges 
unless this is really needed for some reason.  (Or even at all, 
as just returning 200 might be much more compatible with various 
clients, as outlined above.)

It is also not clear what you are trying to achieve with this 
patch.  You may want to elaborate more on what problem you are 
trying to solve, may be there are better solutions.

[...]

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list