forked from svrjs/svrjs
Reduced calls to "mime-types" library
This commit is contained in:
parent
87ba2dd985
commit
6c3a5bd9ee
1 changed files with 5 additions and 2 deletions
7
svr.js
7
svr.js
|
@ -3684,7 +3684,9 @@ if (!cluster.isPrimary) {
|
||||||
if (end > filelen - 1) end = filelen - 1;
|
if (end > filelen - 1) end = filelen - 1;
|
||||||
rhd["Content-Range"] = "bytes " + begin + "-" + end + "/" + filelen;
|
rhd["Content-Range"] = "bytes " + begin + "-" + end + "/" + filelen;
|
||||||
rhd["Content-Length"] = end - begin + 1;
|
rhd["Content-Length"] = end - begin + 1;
|
||||||
if (!(mime.contentType(ext) == false) && ext != "") rhd["Content-Type"] = mime.contentType(ext);
|
delete mtype["Content-Type"];
|
||||||
|
var mtype = mime.contentType(ext);
|
||||||
|
if (mtype && ext != "") rhd["Content-Type"] = mtype;
|
||||||
if (fileETag) rhd["ETag"] = fileETag;
|
if (fileETag) rhd["ETag"] = fileETag;
|
||||||
|
|
||||||
if (req.method != "HEAD") {
|
if (req.method != "HEAD") {
|
||||||
|
@ -3793,7 +3795,8 @@ if (!cluster.isPrimary) {
|
||||||
}
|
}
|
||||||
if (ext != "html") hdhds["Accept-Ranges"] = "bytes";
|
if (ext != "html") hdhds["Accept-Ranges"] = "bytes";
|
||||||
delete hdhds["Content-Type"];
|
delete hdhds["Content-Type"];
|
||||||
if (!(mime.contentType(ext) == false) && ext != "") hdhds["Content-Type"] = mime.contentType(ext);
|
var mtype = mime.contentType(ext);
|
||||||
|
if (mtype && ext != "") hdhds["Content-Type"] = mtype;
|
||||||
if (fileETag) hdhds["ETag"] = fileETag;
|
if (fileETag) hdhds["ETag"] = fileETag;
|
||||||
|
|
||||||
if (req.method != "HEAD") {
|
if (req.method != "HEAD") {
|
||||||
|
|
Reference in a new issue