This commit is contained in:
Gabriel Clima 2025-12-17 00:37:37 +00:00 committed by GitHub
commit e04a86f368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -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;
}