summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2017-06-27 00:53:46 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2017-06-27 00:53:46 +0300
commit774f179a9b523cff2233846283dc35a5582aa1d1 (patch)
treea09cfd4c3a9ce4420dc90bce53603c305e23dfc6 /src
parent6433c841a0b66614e3ee448e14e1b32463c7106d (diff)
downloadnginx-774f179a9b523cff2233846283dc35a5582aa1d1.tar.gz
nginx-774f179a9b523cff2233846283dc35a5582aa1d1.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_range_filter_module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
index 8ffca82e6..7ad9db9dd 100644
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -382,6 +382,9 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
if (ranges-- == 0) {
return NGX_DECLINED;
}
+
+ } else if (start == 0) {
+ return NGX_DECLINED;
}
if (*p++ != ',') {