Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix HTTP file server for binary files

Fixes #29
  • Loading branch information...
commit 7bb3c3bb93a0da2988b09ee7ac2c47c1c443fc18 1 parent fad02b0
@kriskowal authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 http-apps/fs.js
View
9 http-apps/fs.js
@@ -80,7 +80,10 @@ exports.file = function (request, path, contentType, fs) {
contentType = contentType || MimeTypes.lookup(path);
return Q.when(fs.stat(path), function (stat) {
var etag = exports.etag(stat);
- var range; // undefined or {begin, end}
+ var options = {
+ flags: "rb"
+ };
+ var range;
var status = 200;
var headers = {
"content-type": contentType,
@@ -110,6 +113,8 @@ exports.file = function (request, path, contentType, fs) {
);
headers["content-length"] = "" + (range.end - range.begin);
}
+ options.begin = range.begin;
+ options.end = range.end;
}
// Full requests
} else {
@@ -125,7 +130,7 @@ exports.file = function (request, path, contentType, fs) {
return {
status: status,
headers: headers,
- body: fs.open(path, range),
+ body: fs.open(path, options),
file: path,
range: range
};
Please sign in to comment.
Something went wrong with that request. Please try again.