npm-registry-client
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -22,5 +22,5 @@ var assert = require("assert") | ||
req.on("error", function (err) { | ||
if (operation.retry(err)) { | ||
client.log.info("retry", "will retry, error on last attempt: " + err) | ||
req.on("error", function (er) { | ||
if (operation.retry(er)) { | ||
client.log.info("retry", "will retry, error on last attempt: " + er) | ||
} | ||
@@ -32,22 +32,26 @@ }) | ||
// Only retry on 408, 5xx or no `response`. | ||
var er | ||
var statusCode = res && res.statusCode | ||
if (statusCode === 200) { | ||
// Work around bug in node v0.10.0 where the CryptoStream | ||
// gets stuck and never starts reading again. | ||
res.resume() | ||
if (process.version === "v0.10.0") unstick(res) | ||
var timeout = statusCode === 408 | ||
if (timeout) er = new Error("request timed out") | ||
return cb(null, res) | ||
} | ||
// Only retry on 408, 5xx or no `response`. | ||
else if (statusCode === 408) { | ||
er = new Error("request timed out") | ||
} | ||
else if (statusCode >= 500) { | ||
er = new Error("server error " + statusCode) | ||
} | ||
var serverError = statusCode >= 500 | ||
if (serverError) er = new Error("server error " + statusCode) | ||
if (er && operation.retry(er)) { | ||
client.log.info("retry", "will retry, error on last attempt: " + er) | ||
return | ||
} | ||
// Work around bug in node v0.10.0 where the CryptoStream | ||
// gets stuck and never starts reading again. | ||
res.resume() | ||
if (process.version === "v0.10.0") unstick(res) | ||
cb(null, res) | ||
else { | ||
cb(new Error("fetch failed with status code " + statusCode)) | ||
} | ||
}) | ||
@@ -54,0 +58,0 @@ }) |
@@ -5,3 +5,3 @@ { | ||
"description": "Client for the npm registry", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "git://github.com/isaacs/npm-registry-client" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258680
56
2546