cloudcms-server 3.2.294 → 3.2.296

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.
@@ -245,6 +245,7 @@ exports = module.exports = function()
245
245
  }
246
246
 
247
247
  proxyFactory.acquireProxyHandler(proxyTarget, null, function(err, proxyHandler) {
248
+
248
249
  if (err) {
249
250
  return next(err);
250
251
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "cloudcms-server",
8
8
  "description": "Cloud CMS Application Server Module",
9
- "version": "3.2.294",
9
+ "version": "3.2.296",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git://github.com/gitana/cloudcms-server.git"
@@ -33,6 +33,7 @@
33
33
  "consolidate": "^0.14.5",
34
34
  "cookie-parser": "^1.4.4",
35
35
  "debug": "^2.6.9",
36
+ "dns-lookup-cache": "^1.0.4",
36
37
  "dustjs-helpers": "1.7.4",
37
38
  "dustjs-linkedin": "3.0.1",
38
39
  "errorhandler": "^1.5.1",
@@ -9,6 +9,8 @@ var oauth2 = require("./oauth2")();
9
9
 
10
10
  var LRU = require("lru-cache");
11
11
 
12
+ const { lookup } = require('dns-lookup-cache');
13
+
12
14
  var exports = module.exports;
13
15
 
14
16
  var _LOCK = function(lockIdentifiers, workFunction)
@@ -34,35 +36,39 @@ var acquireProxyHandler = exports.acquireProxyHandler = function(proxyTarget, pa
34
36
  return callback(null, _cachedHandler);
35
37
  }
36
38
 
37
- // take out a thread lock
38
- _LOCK(["acquireProxyHandler", name], function(err, releaseLockFn) {
39
-
40
- if (err)
41
- {
42
- console.log("Failed to acquire proxy handler: " + name + ", err: ", err);
43
-
44
- // failed to acquire lock
45
- return callback(err);
46
- }
47
-
48
- // second check to make sure another thread didn't create the handler in the meantime
49
- _cachedHandler = NAMED_PROXY_HANDLERS_CACHE[name];
50
- if (_cachedHandler)
51
- {
52
- releaseLockFn();
53
- return callback(null, _cachedHandler);
54
- }
55
-
56
- // create the proxy handler and cache it into LRU cache
57
- //console.log("Acquiring proxy handler: " + name + ", for target: " + proxyTarget + " and prefix: " + pathPrefix);
58
- _cachedHandler = createProxyHandler(proxyTarget, pathPrefix);
39
+ // // take out a thread lock
40
+ // _LOCK(["acquireProxyHandler", name], function(err, releaseLockFn) {
41
+ //
42
+ // if (err)
43
+ // {
44
+ // console.log("Failed to acquire proxy handler: " + name + ", err: ", err);
45
+ //
46
+ // // failed to acquire lock
47
+ // return callback(err);
48
+ // }
49
+ //
50
+ // // second check to make sure another thread didn't create the handler in the meantime
51
+ // _cachedHandler = NAMED_PROXY_HANDLERS_CACHE[name];
52
+ // if (_cachedHandler)
53
+ // {
54
+ // releaseLockFn();
55
+ // return callback(null, _cachedHandler);
56
+ // }
57
+ //
58
+ // // create the proxy handler and cache it into LRU cache
59
+ // //console.log("Acquiring proxy handler: " + name + ", for target: " + proxyTarget + " and prefix: " + pathPrefix);
60
+ // _cachedHandler = createProxyHandler(proxyTarget, pathPrefix);
61
+ //
62
+ // // store back into LRU cache
63
+ // NAMED_PROXY_HANDLERS_CACHE[name] = _cachedHandler;
64
+ //
65
+ // releaseLockFn();
66
+ // callback(null, _cachedHandler);
67
+ // });
59
68
 
60
- // store back into LRU cache
61
- NAMED_PROXY_HANDLERS_CACHE[name] = _cachedHandler;
62
-
63
- releaseLockFn();
64
- callback(null, _cachedHandler);
65
- });
69
+ _cachedHandler = NAMED_PROXY_HANDLERS_CACHE[name] = createProxyHandler(proxyTarget, pathPrefix);
70
+
71
+ callback(null, _cachedHandler);
66
72
  };
67
73
 
68
74
 
@@ -238,11 +244,13 @@ var createProxyHandler = function(proxyTarget, pathPrefix)
238
244
  {
239
245
  return headers;
240
246
  };
247
+ // request invoke settings
248
+ proxyOptions.request = {};
249
+ proxyOptions.request.lookup = lookup;
241
250
 
242
251
  //////////////////////////////////////////////////////////////////////////
243
252
 
244
253
  var proxyRequestHandler = function(req, res) {
245
-
246
254
  proxy(req, res, pathPrefix, proxyOptions);
247
255
  };
248
256