expressjs / serve-static

Serve static files
MIT License
1.38k stars 227 forks source link

Wrong behavior when handling discontinuous ranges. #113

Closed daveying closed 6 years ago

daveying commented 6 years ago

I use serve-static middleware with expressjs to serve a big file, when I request discontinuous partial content of that big file, serve-static will response with the whole file and the status code is 200 rather than 206. e.g. content of my big file (localhost:5052/test.txt) is:

0123456789

If I request with:

GET /test.txt HTTP/1.1
Host: localhost:5052
Range: bytes=1-3,6-8 // note, discontinuous
Cache-Control: no-cache

The response will be the whole file

0123456789

But if the range is continuous, it works fine.

Please give some advises. Thanks

daveying commented 6 years ago

I realized that this is a problem of send, and I noticed that there is a merge request to solve this problem, please update your send to latest version. Thanks!

dougwilson commented 6 years ago

The send version used is already the latest version.