follow-redirects
Advanced tools
Comparing version 1.14.3 to 1.14.4
21
index.js
@@ -150,6 +150,4 @@ var url = require("url"); | ||
var self = this; | ||
if (callback) { | ||
this.on("timeout", callback); | ||
} | ||
// Destroys the socket on timeout | ||
function destroyOnTimeout(socket) { | ||
@@ -173,9 +171,12 @@ socket.setTimeout(msecs); | ||
// Prevent a timeout from triggering | ||
// Stops a timeout from triggering | ||
function clearTimer() { | ||
clearTimeout(self._timeout); | ||
if (self._timeout) { | ||
clearTimeout(self._timeout); | ||
self._timeout = null; | ||
} | ||
if (callback) { | ||
self.removeListener("timeout", callback); | ||
} | ||
if (!this.socket) { | ||
if (!self.socket) { | ||
self._currentRequest.removeListener("socket", startTimer); | ||
@@ -185,3 +186,8 @@ } | ||
// Start the timer when the socket is opened | ||
// Attach callback if passed | ||
if (callback) { | ||
this.on("timeout", callback); | ||
} | ||
// Start the timer if or when the socket is opened | ||
if (this.socket) { | ||
@@ -194,2 +200,3 @@ startTimer(this.socket); | ||
// Clean up on events | ||
this.on("socket", destroyOnTimeout); | ||
@@ -196,0 +203,0 @@ this.once("response", clearTimer); |
{ | ||
"name": "follow-redirects", | ||
"version": "1.14.3", | ||
"version": "1.14.4", | ||
"description": "HTTP and HTTPS modules that follow redirects.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
25464
498