-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18226 from MetaMask/Version-v10.26.2
Version v10.26.2 RC
- Loading branch information
Showing
9 changed files
with
86 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/lib/redirect.js b/lib/redirect.js | ||
index b9150e77c73d63367845c0aec15b5684d900943f..2864f9f2abc481ecf2b2dd96b1293f5b93393efd 100644 | ||
--- a/lib/redirect.js | ||
+++ b/lib/redirect.js | ||
@@ -14,6 +14,7 @@ function Redirect (request) { | ||
this.redirects = [] | ||
this.redirectsFollowed = 0 | ||
this.removeRefererHeader = false | ||
+ this.allowInsecureRedirect = false | ||
} | ||
|
||
Redirect.prototype.onRequest = function (options) { | ||
@@ -40,6 +41,9 @@ Redirect.prototype.onRequest = function (options) { | ||
if (options.followOriginalHttpMethod !== undefined) { | ||
self.followOriginalHttpMethod = options.followOriginalHttpMethod | ||
} | ||
+ if (options.allowInsecureRedirect !== undefined) { | ||
+ self.allowInsecureRedirect = options.allowInsecureRedirect | ||
+ } | ||
} | ||
|
||
Redirect.prototype.redirectTo = function (response) { | ||
@@ -108,7 +112,7 @@ Redirect.prototype.onResponse = function (response) { | ||
request.uri = url.parse(redirectTo) | ||
|
||
// handle the case where we change protocol from https to http or vice versa | ||
- if (request.uri.protocol !== uriPrev.protocol) { | ||
+ if (request.uri.protocol !== uriPrev.protocol && self.allowInsecureRedirect) { | ||
delete request.agent | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters