From 537e630e405bfd17a574ec6e80329627383473af Mon Sep 17 00:00:00 2001 From: Gabriel Clima Date: Thu, 20 Nov 2025 09:05:12 +0000 Subject: [PATCH] https://github.com/nginx/nginx/issues/988 --- src/http/modules/ngx_http_range_filter_module.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index 27d1875c8..439deffee 100644 --- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c @@ -272,7 +272,7 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx, { u_char *p; off_t start, end, size, content_length, cutoff, - cutlim; + cutlim, multirange_boundary_size; ngx_uint_t suffix; ngx_http_range_t *range; ngx_http_range_filter_ctx_t *mctx; @@ -401,6 +401,18 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx, return NGX_HTTP_RANGE_NOT_SATISFIABLE; } + if (ctx->ranges.nelts > 1) { + multirange_boundary_size = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN + + sizeof(CRLF "Content-Type: ") - 1 + r->headers_out.content_type.len + + sizeof(CRLF "Content-Range: bytes ") - 1; + + size += multirange_boundary_size * ctx->ranges.nelts; + + ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + "multirange: ranges total size:%O, content length: %O", + size, content_length); + } + if (size > content_length) { return NGX_DECLINED; }