total5 0.0.14-1 → 0.0.14-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.txt +1 -0
- package/controller.js +27 -12
- package/http.js +0 -7
- package/package.json +1 -1
package/changelog.txt
CHANGED
package/controller.js
CHANGED
|
@@ -396,8 +396,12 @@ Controller.prototype.flush = function() {
|
|
|
396
396
|
} else {
|
|
397
397
|
response.headers['content-encoding'] = 'gzip';
|
|
398
398
|
ctrl.res.writeHead(response.status, response.headers);
|
|
399
|
-
ctrl.
|
|
400
|
-
|
|
399
|
+
if (ctrl.method === 'HEAD') {
|
|
400
|
+
ctrl.res.end();
|
|
401
|
+
} else {
|
|
402
|
+
ctrl.res.end(buffer, 'utf8');
|
|
403
|
+
F.stats.performance.upload += buffer.length / 1024 / 1024;
|
|
404
|
+
}
|
|
401
405
|
ctrl.free();
|
|
402
406
|
}
|
|
403
407
|
});
|
|
@@ -410,7 +414,10 @@ Controller.prototype.flush = function() {
|
|
|
410
414
|
|
|
411
415
|
try {
|
|
412
416
|
ctrl.res.writeHead(response.status, response.headers);
|
|
413
|
-
ctrl.
|
|
417
|
+
if (ctrl.method === 'HEAD')
|
|
418
|
+
ctrl.res.end();
|
|
419
|
+
else
|
|
420
|
+
ctrl.res.end(buffer);
|
|
414
421
|
} finally {
|
|
415
422
|
ctrl.free();
|
|
416
423
|
}
|
|
@@ -1647,9 +1654,14 @@ function send_file(ctrl, path, ext) {
|
|
|
1647
1654
|
ctrl.response.headers['content-length'] = (end - beg) + 1;
|
|
1648
1655
|
ctrl.response.headers['content-range'] = 'bytes ' + beg + '-' + end + '/' + cache.size;
|
|
1649
1656
|
ctrl.res.writeHead(206, ctrl.response.headers);
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1657
|
+
|
|
1658
|
+
if (ctrl.method === 'HEAD') {
|
|
1659
|
+
ctrl.res.end();
|
|
1660
|
+
} else {
|
|
1661
|
+
reader = F.Fs.createReadStream(path, { start: beg, end: end });
|
|
1662
|
+
reader.pipe(ctrl.res);
|
|
1663
|
+
F.stats.response.streaming++;
|
|
1664
|
+
}
|
|
1653
1665
|
|
|
1654
1666
|
} else {
|
|
1655
1667
|
|
|
@@ -1660,12 +1672,15 @@ function send_file(ctrl, path, ext) {
|
|
|
1660
1672
|
|
|
1661
1673
|
ctrl.res.writeHead(ctrl.response.status, ctrl.response.headers);
|
|
1662
1674
|
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1665
|
-
else
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1675
|
+
if (ctrl.method === 'HEAD') {
|
|
1676
|
+
ctrl.res.end();
|
|
1677
|
+
} else {
|
|
1678
|
+
if (compress)
|
|
1679
|
+
reader.pipe(F.Zlib.createGzip(GZIP_FILE)).pipe(ctrl.res);
|
|
1680
|
+
else
|
|
1681
|
+
reader.pipe(ctrl.res);
|
|
1682
|
+
F.stats.response.file++;
|
|
1683
|
+
}
|
|
1669
1684
|
}
|
|
1670
1685
|
};
|
|
1671
1686
|
|
package/http.js
CHANGED
|
@@ -20,13 +20,6 @@ exports.listen = function(req, res) {
|
|
|
20
20
|
|
|
21
21
|
F.stats.request.request++;
|
|
22
22
|
|
|
23
|
-
// Not supported
|
|
24
|
-
if (req.method === 'HEAD') {
|
|
25
|
-
F.stats.request.blocked++;
|
|
26
|
-
req.destroy();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
var ctrl = new F.TController.Controller(req, res);
|
|
31
24
|
|
|
32
25
|
if (F.paused.length) {
|