Changeset e29cc2e for trip-planner-front/node_modules/follow-redirects
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- Location:
- trip-planner-front/node_modules/follow-redirects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/follow-redirects/index.js
r59329aa re29cc2e 19 19 var RedirectionError = createErrorType( 20 20 "ERR_FR_REDIRECTION_FAILURE", 21 " "21 "Redirected request failed" 22 22 ); 23 23 var TooManyRedirectsError = createErrorType( … … 170 170 // Stops a timeout from triggering 171 171 function clearTimer() { 172 // Clear the timeout 172 173 if (self._timeout) { 173 174 clearTimeout(self._timeout); 174 175 self._timeout = null; 175 176 } 177 178 // Clean up all attached listeners 179 self.removeListener("abort", clearTimer); 180 self.removeListener("error", clearTimer); 181 self.removeListener("response", clearTimer); 176 182 if (callback) { 177 183 self.removeListener("timeout", callback); … … 197 203 // Clean up on events 198 204 this.on("socket", destroyOnTimeout); 199 this.once("response", clearTimer); 200 this.once("error", clearTimer); 205 this.on("abort", clearTimer); 206 this.on("error", clearTimer); 207 this.on("response", clearTimer); 201 208 202 209 return this; … … 362 369 363 370 // Drop the Host header, as the redirect might lead to a different host 364 var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || 365 url.parse(this._currentUrl).hostname; 371 var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); 372 373 // If the redirect is relative, carry over the host of the last request 374 var currentUrlParts = url.parse(this._currentUrl); 375 var currentHost = currentHostHeader || currentUrlParts.host; 376 var currentUrl = /^\w+:/.test(location) ? this._currentUrl : 377 url.format(Object.assign(currentUrlParts, { host: currentHost })); 378 379 // Determine the URL of the redirection 380 var redirectUrl; 381 try { 382 redirectUrl = url.resolve(currentUrl, location); 383 } 384 catch (cause) { 385 this.emit("error", new RedirectionError(cause)); 386 return; 387 } 366 388 367 389 // Create the redirected request 368 var redirectUrl = url.resolve(this._currentUrl, location);369 390 debug("redirecting to", redirectUrl); 370 391 this._isRedirect = true; … … 372 393 Object.assign(this._options, redirectUrlParts); 373 394 374 // Drop the Authorization header if redirecting to another host375 if ( redirectUrlParts.hostname !== previousHostName) {395 // Drop the Authorization header if redirecting to another domain 396 if (!(redirectUrlParts.host === currentHost || isSubdomainOf(redirectUrlParts.host, currentHost))) { 376 397 removeMatchingHeaders(/^authorization$/i, this._options.headers); 377 398 } … … 395 416 } 396 417 catch (cause) { 397 var error = new RedirectionError("Redirected request failed: " + cause.message); 398 error.cause = cause; 399 this.emit("error", error); 418 this.emit("error", new RedirectionError(cause)); 400 419 } 401 420 } … … 507 526 for (var header in headers) { 508 527 if (regex.test(header)) { 509 lastValue = headers[header] ;528 lastValue = headers[header].toString().trim(); 510 529 delete headers[header]; 511 530 } … … 515 534 516 535 function createErrorType(code, defaultMessage) { 517 function CustomError( message) {536 function CustomError(cause) { 518 537 Error.captureStackTrace(this, this.constructor); 519 this.message = message || defaultMessage; 538 if (!cause) { 539 this.message = defaultMessage; 540 } 541 else { 542 this.message = defaultMessage + ": " + cause.message; 543 this.cause = cause; 544 } 520 545 } 521 546 CustomError.prototype = new Error(); … … 534 559 } 535 560 561 function isSubdomainOf(subdomain, domain) { 562 const dot = subdomain.length - domain.length - 1; 563 return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); 564 } 565 536 566 // Exports 537 567 module.exports = wrap({ http: http, https: https }); -
trip-planner-front/node_modules/follow-redirects/package.json
r59329aa re29cc2e 1 1 { 2 "_args": [ 3 [ 4 "follow-redirects@1.14.4", 5 "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front" 6 ] 7 ], 8 "_development": true, 9 "_from": "follow-redirects@1.14.4", 10 "_id": "follow-redirects@1.14.4", 2 "_from": "follow-redirects@^1.0.0", 3 "_id": "follow-redirects@1.14.5", 11 4 "_inBundle": false, 12 "_integrity": "sha512- zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==",5 "_integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", 13 6 "_location": "/follow-redirects", 14 7 "_phantomChildren": {}, 15 8 "_requested": { 16 "type": " version",9 "type": "range", 17 10 "registry": true, 18 "raw": "follow-redirects@ 1.14.4",11 "raw": "follow-redirects@^1.0.0", 19 12 "name": "follow-redirects", 20 13 "escapedName": "follow-redirects", 21 "rawSpec": " 1.14.4",14 "rawSpec": "^1.0.0", 22 15 "saveSpec": null, 23 "fetchSpec": " 1.14.4"16 "fetchSpec": "^1.0.0" 24 17 }, 25 18 "_requiredBy": [ 26 19 "/http-proxy" 27 20 ], 28 "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", 29 "_spec": "1.14.4", 30 "_where": "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front", 21 "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", 22 "_shasum": "f09a5848981d3c772b5392309778523f8d85c381", 23 "_spec": "follow-redirects@^1.0.0", 24 "_where": "C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front\\node_modules\\http-proxy", 31 25 "author": { 32 26 "name": "Ruben Verborgh", … … 37 31 "url": "https://github.com/follow-redirects/follow-redirects/issues" 38 32 }, 33 "bundleDependencies": false, 39 34 "contributors": [ 40 35 { … … 48 43 } 49 44 ], 45 "deprecated": false, 50 46 "description": "HTTP and HTTPS modules that follow redirects.", 51 47 "devDependencies": { … … 96 92 "test": "npm run lint && npm run mocha" 97 93 }, 98 "version": "1.14. 4"94 "version": "1.14.5" 99 95 }
Note:
See TracChangeset
for help on using the changeset viewer.