Mercurial > hg > nginx
comparison src/http/modules/ngx_http_range_filter_module.c @ 7043:aeaac3ccee4f
Range filter: allowed ranges on empty files (ticket #1031).
As per RFC 2616 / RFC 7233, any range request to an empty file
is expected to result in 416 Range Not Satisfiable response, as
there cannot be a "byte-range-spec whose first-byte-pos is less
than the current length of the entity-body". On the other hand,
this makes use of byte-range requests inconvenient in some cases,
as reported for the slice module here:
http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010177.html
This commit changes range filter to instead return 200 if the file
is empty and the range requested starts at 0.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 27 Jun 2017 00:53:46 +0300 |
parents | 0cdee26605f3 |
children | e02555553d0b |
comparison
equal
deleted
inserted
replaced
7042:bd2f97a3aecc | 7043:aeaac3ccee4f |
---|---|
380 size += end - start; | 380 size += end - start; |
381 | 381 |
382 if (ranges-- == 0) { | 382 if (ranges-- == 0) { |
383 return NGX_DECLINED; | 383 return NGX_DECLINED; |
384 } | 384 } |
385 | |
386 } else if (start == 0) { | |
387 return NGX_DECLINED; | |
385 } | 388 } |
386 | 389 |
387 if (*p++ != ',') { | 390 if (*p++ != ',') { |
388 break; | 391 break; |
389 } | 392 } |