expressjs / serve-static

Serve static files
MIT License
1.39k stars 228 forks source link

Error when empty file served. #29

Closed shakyShane closed 9 years ago

shakyShane commented 9 years ago

serve-static - 1.9.0 node - 0.10.26

When an empty file is served, we now this this error

fs.js:1477
      throw new Error('start must be <= end');
            ^
Error: start must be <= end
    at new ReadStream (fs.js:1477:13)
    at Object.fs.createReadStream (fs.js:1438:10)
    at SendStream.stream (/Users/shakyshane/code/angular-bs/node_modules/serve-static/node_modules/send/index.js:668:19)
    at SendStream.send (/Users/shakyshane/code/angular-bs/node_modules/serve-static/node_modules/send/index.js:576:8)
    at onstat (/Users/shakyshane/code/angular-bs/node_modules/serve-static/node_modules/send/index.js:600:10)
    at Object.oncomplete (fs.js:107:15)

reduced test case showing the bug https://github.com/shakyShane/serve-static-bug

example to reproduce

var connect     = require("connect");
var http        = require("http");
var serveStatic = require("serve-static");

var app = connect();

app.use(serveStatic("./src"));

var server = http.createServer(app).listen();

console.log("http://localhost:" + server.address().port);
shakyShane commented 9 years ago

re: https://github.com/BrowserSync/browser-sync/issues/456#issuecomment-74639619

shakyShane commented 9 years ago

Tracked it down to this change in the send module