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 CHANGED
@@ -10,6 +10,7 @@
10
10
  - `schema` renamed to `action`
11
11
  - disabled auto-cleaning files in FlowStream workers
12
12
  - improved loading static files in release mode
13
+ - added support for `HEAD` method
13
14
 
14
15
  ========================
15
16
  0.0.13
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.res.end(buffer, 'utf8');
400
- F.stats.performance.upload += buffer.length / 1024 / 1024;
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.res.end(buffer);
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
- reader = F.Fs.createReadStream(path, { start: beg, end: end });
1651
- reader.pipe(ctrl.res);
1652
- F.stats.response.streaming++;
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 (compress)
1664
- reader.pipe(F.Zlib.createGzip(GZIP_FILE)).pipe(ctrl.res);
1665
- else
1666
- reader.pipe(ctrl.res);
1667
-
1668
- F.stats.response.file++;
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.14-1",
3
+ "version": "0.0.14-2",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {