[nginx] Range filter: allowed ranges on empty files (ticket #1031).

Maxim Dounin mdounin at mdounin.ru
Fri Nov 10 11:55:51 UTC 2017


Hello!

On Fri, Nov 10, 2017 at 05:11:50AM +0800, 胡聪 (hucc) wrote:

> Hi,
> 
> >details:   http://hg.nginx.org/nginx/rev/aeaac3ccee4f
> >branches:
> >changeset: 7043:aeaac3ccee4f
> >user:      Maxim Dounin <mdounin at mdounin.ru>
> >date:      Tue Jun 27 00:53:46 2017 +0300
> >description:
> >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.
> 
> With this commit, the problem I mentioned is still unsolved.
> http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010198.html
> http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010178.html
> 
> Because we can not ask that the backend must be nginx, and it is
> nginx who convert ordinary request to a range request in slice
> module. So is there a safe solution?

There are at least a couple of them:

- avoid using slice module if there are empty files and your 
  backend return 416 on range requests to them;

- change your backend to allow range requests on empty files.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list