Socket
Socket
Sign inDemoInstall

cluster-service

Package Overview
Dependencies
6
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.7 to 0.5.8

33

lib/http-client.js
var
util = require("util"),
request = require("request"),
http = require("http"),
querystring = require("querystring"),

@@ -42,8 +42,25 @@ locals = null,

cservice.log("Running remote command: ".warn + url.replace(/accessKey=.*/i, "accessKey={ACCESS_KEY}").data);
request.post(url, function (err, res, body) {
if (res.statusCode !== 200 && !err && body) {
err = body;
}
onCallback(err, body, res, cb);
});
var body = "", err;
http.request(
{
host: options.host || "localhost",
port: options.port || 11987,
path: "/cli?" + qs,
method: "POST"
}, function(res) {
res.setEncoding('utf8');
res.on("data", function(chunk) {
body += chunk;
});
res.on("end", function() {
if (res.statusCode !== 200 && body) {
err = body;
}
onCallback(err, body, res, cb);
});
}
).on("error", function(err) {
body = err;
onCallback(err, body, res, cb);
}).end();
}

@@ -54,3 +71,3 @@

cservice.error("Error: ", err);
result = { statusCode: res.statusCode, error: err };
result = { statusCode: res ? res.statusCode : "unknown", error: err };
} else if (result) {

@@ -57,0 +74,0 @@ if (typeof result === "string" && (result.indexOf("{") === 0 || result.indexOf("[") === 0)) {

var
util = require("util"),
request = require("request"),
http = require("http"),
querystring = require("querystring"),

@@ -28,22 +28,37 @@ options = null,

cservice.log("Running remote command: ".warn + url.replace(/accessKey=.*/i, "accessKey={ACCESS_KEY}").data);
request.post(url, function (err, res, body) {
if (res && res.statusCode !== 200 && !err && body) {
err = body;
}
if (err) {
cservice.error("Error: ", err);
body = { statusCode: res ? res.statusCode : "no response", error: err };
} else if (body) {
if (typeof body === "string" && (body.indexOf("{") === 0 || body.indexOf("[") === 0)) {
body = JSON.parse(body); // deserialize
}
}
if (options.json === true) {
cservice.results(JSON.stringify(body));
} else {
cservice.results(util.inspect(body, { depth: null, colors: true }));
}
var body = "", err;
http.request(
{
host: options.host || "localhost",
port: options.port || 11987,
path: "/cli?" + qs,
method: "POST"
}, function(res) {
res.setEncoding('utf8');
res.on("data", function(chunk) {
body += chunk;
});
res.on("end", function() {
if (res.statusCode !== 200 && body) {
err = body;
}
if (err) {
cservice.error("Error: ", err);
body = { statusCode: res ? res.statusCode : "no response", error: err };
} else if (typeof body === "string" && (body.indexOf("{") === 0 || body.indexOf("[") === 0)) {
body = JSON.parse(body); // deserialize
}
if (options.json === true) {
cservice.results(JSON.stringify(body));
} else {
cservice.results(util.inspect(body, { depth: null, colors: true }));
}
cb && cb(err, body);
});
cb && cb(err, body);
});
}
).on("error", function(err) {
body = err;
cb && cb(err, body);
}).end();
}
{
"name": "cluster-service",
"version": "0.5.7",
"version": "0.5.8",
"author": {

@@ -15,3 +15,2 @@ "name": "Aaron Silvas",

"async": ">=0.2.x",
"request": ">=2.21.0",
"optimist": ">=0.6.0",

@@ -23,2 +22,3 @@ "colors": ">=0.6.2",

"mocha": "~1.12.0",
"request": ">=2.21.0",
"istanbul": "~0.1.43"

@@ -25,0 +25,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc