Socket
Socket
Sign inDemoInstall

follow-redirects

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

follow-redirects - npm Package Compare versions

Comparing version 1.13.2 to 1.13.3

57

index.js

@@ -64,2 +64,13 @@ var url = require("url");

RedirectableRequest.prototype.abort = function () {
// Abort the internal request
this._currentRequest.removeAllListeners();
this._currentRequest.on("error", noop);
this._currentRequest.abort();
// Abort this request
this.emit("abort");
this.removeAllListeners();
};
// Writes buffered data to the current native request

@@ -144,14 +155,35 @@ RedirectableRequest.prototype.write = function (data, encoding, callback) {

RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
var self = this;
if (callback) {
this.once("timeout", callback);
this.on("timeout", callback);
}
// Sets up a timer to trigger a timeout event
function startTimer() {
if (self._timeout) {
clearTimeout(self._timeout);
}
self._timeout = setTimeout(function () {
self.emit("timeout");
clearTimer();
}, msecs);
}
// Prevent a timeout from triggering
function clearTimer() {
clearTimeout(this._timeout);
if (callback) {
self.removeListener("timeout", callback);
}
if (!this.socket) {
self._currentRequest.removeListener("socket", startTimer);
}
}
// Start the timer when the socket is opened
if (this.socket) {
startTimer(this, msecs);
startTimer();
}
else {
var self = this;
this._currentRequest.once("socket", function () {
startTimer(self, msecs);
});
this._currentRequest.once("socket", startTimer);
}

@@ -165,16 +197,5 @@

function startTimer(request, msecs) {
clearTimeout(request._timeout);
request._timeout = setTimeout(function () {
request.emit("timeout");
}, msecs);
}
function clearTimer() {
clearTimeout(this._timeout);
}
// Proxy all other public ClientRequest methods
[
"abort", "flushHeaders", "getHeader",
"flushHeaders", "getHeader",
"setNoDelay", "setSocketKeepAlive",

@@ -181,0 +202,0 @@ ].forEach(function (method) {

{
"name": "follow-redirects",
"version": "1.13.2",
"version": "1.13.3",
"description": "HTTP and HTTPS modules that follow redirects.",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc