Socket
Socket
Sign inDemoInstall

follow-redirects

Package Overview
Dependencies
Maintainers
3
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.10.0 to 1.11.0

16

index.js

@@ -338,5 +338,4 @@ var url = require("url");

// Drop the Host header, as the redirect might lead to a different host
if (!this._isRedirect) {
removeMatchingHeaders(/^host$/i, this._options.headers);
}
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
url.parse(this._currentUrl).hostname;

@@ -347,4 +346,10 @@ // Create the redirected request

this._isRedirect = true;
Object.assign(this._options, url.parse(redirectUrl));
var redirectUrlParts = url.parse(redirectUrl);
Object.assign(this._options, redirectUrlParts);
// Drop the Authorization header if redirecting to another host
if (redirectUrlParts.hostname !== previousHostName) {
removeMatchingHeaders(/^authorization$/i, this._options.headers);
}
// Evaluate the beforeRedirect callback

@@ -470,7 +475,10 @@ if (typeof this._options.beforeRedirect === "function") {

function removeMatchingHeaders(regex, headers) {
var lastValue;
for (var header in headers) {
if (regex.test(header)) {
lastValue = headers[header];
delete headers[header];
}
}
return lastValue;
}

@@ -477,0 +485,0 @@

{
"name": "follow-redirects",
"version": "1.10.0",
"version": "1.11.0",
"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