summaryrefslogtreecommitdiff
path: root/lib/login.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/login.js')
-rw-r--r--lib/login.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/login.js b/lib/login.js
index d7f3fdf..01ecd6d 100644
--- a/lib/login.js
+++ b/lib/login.js
@@ -193,5 +193,20 @@ module.exports = {
callback(new Error(res.statusCode));
});
+ },
+
+ checkProxy: function checkProxy(target, callback) {
+ request(target, function get(err, response) {
+ if (err !== null) { return callback(err); }
+ if (response.statusCode === 200) {
+ var stack = '';
+ if (response.headers.server) { stack = 'Proxy Server: '.bold + response.headers.server.cyan + ' '; }
+ if (response.headers['x-powered-by']) { stack += 'Powered-by: '.bold + response.headers['x-powered-by'].cyan + ' '; }
+ stack.trim();
+ if (stack === '') { stack = target; }
+ return callback(null, stack);
+ }
+ callback(new Error('Server Response: '.red + response.statusCode));
+ });
}
};