Comparing version 7.5.6 to 7.5.7
@@ -685,2 +685,41 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */ | ||
if (opts.followRedirects) { | ||
if (websocket._redirects === 0) { | ||
websocket._originalHost = parsedUrl.host; | ||
const headers = options && options.headers; | ||
// | ||
// Shallow copy the user provided options so that headers can be changed | ||
// without mutating the original object. | ||
// | ||
options = { ...options, headers: {} }; | ||
if (headers) { | ||
for (const [key, value] of Object.entries(headers)) { | ||
options.headers[key.toLowerCase()] = value; | ||
} | ||
} | ||
} else if (parsedUrl.host !== websocket._originalHost) { | ||
// | ||
// Match curl 7.77.0 behavior and drop the following headers. These | ||
// headers are also dropped when following a redirect to a subdomain. | ||
// | ||
delete opts.headers.authorization; | ||
delete opts.headers.cookie; | ||
delete opts.headers.host; | ||
opts.auth = undefined; | ||
} | ||
// | ||
// Match curl 7.77.0 behavior and make the first `Authorization` header win. | ||
// If the `Authorization` header is set, then there is nothing to do as it | ||
// will take precedence. | ||
// | ||
if (opts.auth && !options.headers.authorization) { | ||
options.headers.authorization = | ||
'Basic ' + Buffer.from(opts.auth).toString('base64'); | ||
} | ||
} | ||
let req = (websocket._req = get(opts)); | ||
@@ -687,0 +726,0 @@ |
{ | ||
"name": "ws", | ||
"version": "7.5.6", | ||
"version": "7.5.7", | ||
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
121534
3536