mirror of
https://github.com/nginx/nginx.git
synced 2025-01-07 14:43:00 -06:00
Now unsatisfiable ranges are processed according to RFC 2616.
This commit is contained in:
parent
584703b84a
commit
451df22b3f
@ -264,7 +264,7 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start >= r->headers_out.content_length_n) {
|
if (start >= r->headers_out.content_length_n) {
|
||||||
return NGX_HTTP_RANGE_NOT_SATISFIABLE;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*p == ' ') { p++; }
|
while (*p == ' ') { p++; }
|
||||||
@ -299,14 +299,10 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
return NGX_HTTP_RANGE_NOT_SATISFIABLE;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end >= r->headers_out.content_length_n) {
|
if (end >= r->headers_out.content_length_n) {
|
||||||
/*
|
|
||||||
* Download Accelerator sends the last byte position
|
|
||||||
* that equals to the file length
|
|
||||||
*/
|
|
||||||
end = r->headers_out.content_length_n;
|
end = r->headers_out.content_length_n;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -325,11 +321,17 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
|
|
||||||
size += end - start;
|
size += end - start;
|
||||||
|
|
||||||
|
skip:
|
||||||
|
|
||||||
if (*p++ != ',') {
|
if (*p++ != ',') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->ranges.nelts == 0) {
|
||||||
|
return NGX_HTTP_RANGE_NOT_SATISFIABLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (size > r->headers_out.content_length_n) {
|
if (size > r->headers_out.content_length_n) {
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user