Skip to content

Commit

Permalink
implemented fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dhanielo committed Oct 8, 2014
1 parent 21283dc commit bf94445
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions httpd/config.js
Expand Up @@ -39,6 +39,7 @@
watchdogTimeout: 30, // if process runs this long for a request, the alarm handler will exit()
listenIp: '0.0.0.0', // listen socket will be bound to this IP. '0.0.0.0' means ANY IP on this machine.
documentRoot: docRoot,
sendFile: true, // Enable/Disable linux sendFile()
logFile: '/tmp/httpd-silkjs.log',
directoryIndex: [
'index.sjs',
Expand Down
9 changes: 8 additions & 1 deletion httpd/response.js
Expand Up @@ -207,7 +207,14 @@ res = function() {
}
res.contentLength = size;
res.sendHeaders();
net.sendFile(res.sock, fn, 0, size); // (FileSystem.readfile64(fn));
if (Config.sendFile || Config.sendFile == undefined) {
net.sendFile(res.sock, fn, 0, size); // (FileSystem.readfile64(fn));
} else {
var file = fs.open(fn, fs.O_RDONLY);
var content = net.read(file, size, size);
net.write(res.sock, content, size);
fs.close(file);
}
}
catch (e) {
throw e;
Expand Down

0 comments on commit bf94445

Please sign in to comment.