diff --git a/lib/httpha.js b/lib/httpha.js index c4edf88..437d896 100644 --- a/lib/httpha.js +++ b/lib/httpha.js @@ -104,6 +104,13 @@ exports.create = function (options, helper) { throw new Error('EmptyServerListException'); }; + _me.status = function(){ + return { + online : _online.map(function(it){return _extend({},it)}), + backup : _backup.map(function(it){return _extend({},it)}) + } + }; + return _me; }; @@ -116,6 +123,7 @@ exports.httpStatusChecker = function (request, options) { var configs = _extend({ 'timeout' : 1000, 'useragent' : 'HttpHA/0.1.0', + 'method':'HEAD' }, options); return function (one, done) { @@ -129,7 +137,7 @@ exports.httpStatusChecker = function (request, options) { }; var req = http.request(_extend(_extend({}, one), { - 'method' : 'HEAD', + 'method' : configs.method, 'path' : request, 'headers' : { 'User-Agent' : configs.useragent, @@ -139,7 +147,6 @@ exports.httpStatusChecker = function (request, options) { clearTimeout(tmo); tmo = null; } - var ret = res.statusCode - 0; callback(null, ret >= 200 && ret < 300); });