total5 0.0.15-2 → 0.0.15-4

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
@@ -6,6 +6,11 @@
6
6
  - improved `keepalive` option in the `REQUEST()` method (it can contain HttpAgent or options for it)
7
7
  - updated `RESTBuilder.keepalive()` method by adding `val` argument
8
8
  - fixed column indexer in the CSV parser
9
+ - fixed proxy timeout
10
+ - fixed string slug method
11
+ - fixed an issue with generating file names when merging files directly in the view engine
12
+ - fixed handling of case-sensitive file names
13
+ - fixed unexpected errors with the stream when handling static files
9
14
 
10
15
  ========================
11
16
  0.0.14
package/controller.js CHANGED
@@ -1659,6 +1659,14 @@ function send_file(ctrl, path, ext) {
1659
1659
  ctrl.res.end();
1660
1660
  } else {
1661
1661
  reader = F.Fs.createReadStream(path, { start: beg, end: end });
1662
+
1663
+ // Unexpected error
1664
+ reader.on('error', function(err) {
1665
+ delete F.temporary.tmp[ctrl.uri.cache];
1666
+ ctrl.destroyed = true;
1667
+ ctrl.req.destroy();
1668
+ });
1669
+
1662
1670
  reader.pipe(ctrl.res);
1663
1671
  F.stats.response.streaming++;
1664
1672
  }
@@ -1675,10 +1683,19 @@ function send_file(ctrl, path, ext) {
1675
1683
  if (ctrl.method === 'HEAD') {
1676
1684
  ctrl.res.end();
1677
1685
  } else {
1686
+
1687
+ // Unexpected error
1688
+ reader.on('error', function(err) {
1689
+ delete F.temporary.tmp[ctrl.uri.cache];
1690
+ ctrl.destroyed = true;
1691
+ ctrl.req.destroy();
1692
+ });
1693
+
1678
1694
  if (compress)
1679
1695
  reader.pipe(F.Zlib.createGzip(GZIP_FILE)).pipe(ctrl.res);
1680
1696
  else
1681
1697
  reader.pipe(ctrl.res);
1698
+
1682
1699
  F.stats.response.file++;
1683
1700
  }
1684
1701
  }
package/index.js CHANGED
@@ -1538,7 +1538,8 @@ F.merge = function(url) {
1538
1538
  if (url[0] !== '/')
1539
1539
  url = '/' + url;
1540
1540
 
1541
- url = F.virtualpath(url.toLowerCase());
1541
+ // url = F.virtualpath(url.toLowerCase());
1542
+ url = F.virtualpath(url);
1542
1543
 
1543
1544
  var ext = F.TUtils.getExtension(url);
1544
1545
  var key = url.substring(1).replace(/\//g, '-').replace(/\.(js|html|css)$/, '') + '-min.' + ext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.15-2",
3
+ "version": "0.0.15-4",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/routing.js CHANGED
@@ -1000,11 +1000,11 @@ function proxycreate(proxy, ctrl) {
1000
1000
 
1001
1001
  request.$controller = ctrl;
1002
1002
  request.$proxy = proxy;
1003
- request.$timeout = proxy.timeout || F.config.$proxytimeout;
1003
+ request.$timeout = ctrl.timeout = proxy.$timeout || F.config.$proxytimeout;
1004
1004
  request.iswebsocket = !!ctrl.iswebsocket;
1005
1005
  request.$destroy = proxyerror;
1006
1006
 
1007
- if (!ctrl.iswebsocket && proxy.timeout) {
1007
+ if (!ctrl.iswebsocket && request.$timeout) {
1008
1008
  F.temporary.pending.push(ctrl);
1009
1009
  F.TUtils.onfinished(ctrl.res, function() {
1010
1010
  request.$destroyed = true;
package/utils.js CHANGED
@@ -4040,7 +4040,7 @@ SP.slug = function(max) {
4040
4040
  builder += c;
4041
4041
  }
4042
4042
 
4043
- if (builder.length > 1) {
4043
+ if (builder.length > 0) {
4044
4044
  length = builder.length - 1;
4045
4045
  return builder[length] === '-' ? builder.substring(0, length) : builder;
4046
4046
  } else if (!length)
@@ -6283,7 +6283,7 @@ exports.parseURI2 = function(url) {
6283
6283
  if (index != -1)
6284
6284
  url = url.replace(REG_TRAVELSE, '');
6285
6285
 
6286
- let key = url.toLowerCase();
6286
+ let key = index === -1 ? url.toLowerCase() : url;
6287
6287
  return { key: key, cache: key, pathname: url, search: search, file: index != -1, ext: index == -1 ? '' : url.substring(index + 1), split: split };
6288
6288
  };
6289
6289
 
@@ -6444,4 +6444,4 @@ exports.paginate = function(page, pages, max) {
6444
6444
  response.pages.push(i);
6445
6445
 
6446
6446
  return response;
6447
- };
6447
+ };
package/viewengine.js CHANGED
@@ -857,7 +857,13 @@ View.prototype.import = function() {
857
857
 
858
858
  if (m.includes('+')) {
859
859
  let iscss = REG_CHECKCSS.test(m);
860
- let path = '/' + F.TUtils.random_string(10).toLowerCase() + '-min.' + (iscss ? 'css' : 'js');
860
+ let key2 = 'file_' + HASH(m instanceof Array ? m.join('+') : m).toString(36);
861
+ let filename = F.temporary.merged[key2];
862
+ if (!filename) {
863
+ filename = F.TUtils.random_string(10).toLowerCase();
864
+ F.temporary.merged[key2] = filename;
865
+ }
866
+ let path = '/' + filename + '-min.' + (iscss ? 'css' : 'js');
861
867
  F.merge(path, m);
862
868
  if (iscss)
863
869
  tmp = '<link rel="stylesheet" href="' + F.virtualpath(path) + version + '" />';