mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-30 10:04:53 +00:00
Update dist
This commit is contained in:
65
dist/index.js
vendored
65
dist/index.js
vendored
@@ -5068,7 +5068,7 @@ events.forEach(function (event) {
|
|||||||
// Error types with codes
|
// Error types with codes
|
||||||
var RedirectionError = createErrorType(
|
var RedirectionError = createErrorType(
|
||||||
"ERR_FR_REDIRECTION_FAILURE",
|
"ERR_FR_REDIRECTION_FAILURE",
|
||||||
""
|
"Redirected request failed"
|
||||||
);
|
);
|
||||||
var TooManyRedirectsError = createErrorType(
|
var TooManyRedirectsError = createErrorType(
|
||||||
"ERR_FR_TOO_MANY_REDIRECTS",
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
||||||
@@ -5219,10 +5219,16 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|||||||
|
|
||||||
// Stops a timeout from triggering
|
// Stops a timeout from triggering
|
||||||
function clearTimer() {
|
function clearTimer() {
|
||||||
|
// Clear the timeout
|
||||||
if (self._timeout) {
|
if (self._timeout) {
|
||||||
clearTimeout(self._timeout);
|
clearTimeout(self._timeout);
|
||||||
self._timeout = null;
|
self._timeout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up all attached listeners
|
||||||
|
self.removeListener("abort", clearTimer);
|
||||||
|
self.removeListener("error", clearTimer);
|
||||||
|
self.removeListener("response", clearTimer);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
self.removeListener("timeout", callback);
|
self.removeListener("timeout", callback);
|
||||||
}
|
}
|
||||||
@@ -5246,8 +5252,9 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|||||||
|
|
||||||
// Clean up on events
|
// Clean up on events
|
||||||
this.on("socket", destroyOnTimeout);
|
this.on("socket", destroyOnTimeout);
|
||||||
this.once("response", clearTimer);
|
this.on("abort", clearTimer);
|
||||||
this.once("error", clearTimer);
|
this.on("error", clearTimer);
|
||||||
|
this.on("response", clearTimer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -5411,19 +5418,34 @@ RedirectableRequest.prototype._processResponse = function (response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drop the Host header, as the redirect might lead to a different host
|
// Drop the Host header, as the redirect might lead to a different host
|
||||||
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
|
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
||||||
url.parse(this._currentUrl).hostname;
|
|
||||||
|
// If the redirect is relative, carry over the host of the last request
|
||||||
|
var currentUrlParts = url.parse(this._currentUrl);
|
||||||
|
var currentHost = currentHostHeader || currentUrlParts.host;
|
||||||
|
var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
|
||||||
|
url.format(Object.assign(currentUrlParts, { host: currentHost }));
|
||||||
|
|
||||||
|
// Determine the URL of the redirection
|
||||||
|
var redirectUrl;
|
||||||
|
try {
|
||||||
|
redirectUrl = url.resolve(currentUrl, location);
|
||||||
|
}
|
||||||
|
catch (cause) {
|
||||||
|
this.emit("error", new RedirectionError(cause));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the redirected request
|
// Create the redirected request
|
||||||
var redirectUrl = url.resolve(this._currentUrl, location);
|
|
||||||
debug("redirecting to", redirectUrl);
|
debug("redirecting to", redirectUrl);
|
||||||
this._isRedirect = true;
|
this._isRedirect = true;
|
||||||
var redirectUrlParts = url.parse(redirectUrl);
|
var redirectUrlParts = url.parse(redirectUrl);
|
||||||
Object.assign(this._options, redirectUrlParts);
|
Object.assign(this._options, redirectUrlParts);
|
||||||
|
|
||||||
// Drop the Authorization header if redirecting to another host
|
// Drop confidential headers when redirecting to another scheme:domain
|
||||||
if (redirectUrlParts.hostname !== previousHostName) {
|
if (redirectUrlParts.protocol !== currentUrlParts.protocol ||
|
||||||
removeMatchingHeaders(/^authorization$/i, this._options.headers);
|
!isSameOrSubdomain(redirectUrlParts.host, currentHost)) {
|
||||||
|
removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate the beforeRedirect callback
|
// Evaluate the beforeRedirect callback
|
||||||
@@ -5444,9 +5466,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
|
|||||||
this._performRequest();
|
this._performRequest();
|
||||||
}
|
}
|
||||||
catch (cause) {
|
catch (cause) {
|
||||||
var error = new RedirectionError("Redirected request failed: " + cause.message);
|
this.emit("error", new RedirectionError(cause));
|
||||||
error.cause = cause;
|
|
||||||
this.emit("error", error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -5560,13 +5580,20 @@ function removeMatchingHeaders(regex, headers) {
|
|||||||
delete headers[header];
|
delete headers[header];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lastValue;
|
return (lastValue === null || typeof lastValue === "undefined") ?
|
||||||
|
undefined : String(lastValue).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createErrorType(code, defaultMessage) {
|
function createErrorType(code, defaultMessage) {
|
||||||
function CustomError(message) {
|
function CustomError(cause) {
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
this.message = message || defaultMessage;
|
if (!cause) {
|
||||||
|
this.message = defaultMessage;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.message = defaultMessage + ": " + cause.message;
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CustomError.prototype = new Error();
|
CustomError.prototype = new Error();
|
||||||
CustomError.prototype.constructor = CustomError;
|
CustomError.prototype.constructor = CustomError;
|
||||||
@@ -5583,6 +5610,14 @@ function abortRequest(request) {
|
|||||||
request.abort();
|
request.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSameOrSubdomain(subdomain, domain) {
|
||||||
|
if (subdomain === domain) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const dot = subdomain.length - domain.length - 1;
|
||||||
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
||||||
|
}
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
module.exports = wrap({ http: http, https: https });
|
module.exports = wrap({ http: http, https: https });
|
||||||
module.exports.wrap = wrap;
|
module.exports.wrap = wrap;
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
65
pre/index.js
65
pre/index.js
@@ -5068,7 +5068,7 @@ events.forEach(function (event) {
|
|||||||
// Error types with codes
|
// Error types with codes
|
||||||
var RedirectionError = createErrorType(
|
var RedirectionError = createErrorType(
|
||||||
"ERR_FR_REDIRECTION_FAILURE",
|
"ERR_FR_REDIRECTION_FAILURE",
|
||||||
""
|
"Redirected request failed"
|
||||||
);
|
);
|
||||||
var TooManyRedirectsError = createErrorType(
|
var TooManyRedirectsError = createErrorType(
|
||||||
"ERR_FR_TOO_MANY_REDIRECTS",
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
||||||
@@ -5219,10 +5219,16 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|||||||
|
|
||||||
// Stops a timeout from triggering
|
// Stops a timeout from triggering
|
||||||
function clearTimer() {
|
function clearTimer() {
|
||||||
|
// Clear the timeout
|
||||||
if (self._timeout) {
|
if (self._timeout) {
|
||||||
clearTimeout(self._timeout);
|
clearTimeout(self._timeout);
|
||||||
self._timeout = null;
|
self._timeout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up all attached listeners
|
||||||
|
self.removeListener("abort", clearTimer);
|
||||||
|
self.removeListener("error", clearTimer);
|
||||||
|
self.removeListener("response", clearTimer);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
self.removeListener("timeout", callback);
|
self.removeListener("timeout", callback);
|
||||||
}
|
}
|
||||||
@@ -5246,8 +5252,9 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|||||||
|
|
||||||
// Clean up on events
|
// Clean up on events
|
||||||
this.on("socket", destroyOnTimeout);
|
this.on("socket", destroyOnTimeout);
|
||||||
this.once("response", clearTimer);
|
this.on("abort", clearTimer);
|
||||||
this.once("error", clearTimer);
|
this.on("error", clearTimer);
|
||||||
|
this.on("response", clearTimer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -5411,19 +5418,34 @@ RedirectableRequest.prototype._processResponse = function (response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drop the Host header, as the redirect might lead to a different host
|
// Drop the Host header, as the redirect might lead to a different host
|
||||||
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
|
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
||||||
url.parse(this._currentUrl).hostname;
|
|
||||||
|
// If the redirect is relative, carry over the host of the last request
|
||||||
|
var currentUrlParts = url.parse(this._currentUrl);
|
||||||
|
var currentHost = currentHostHeader || currentUrlParts.host;
|
||||||
|
var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
|
||||||
|
url.format(Object.assign(currentUrlParts, { host: currentHost }));
|
||||||
|
|
||||||
|
// Determine the URL of the redirection
|
||||||
|
var redirectUrl;
|
||||||
|
try {
|
||||||
|
redirectUrl = url.resolve(currentUrl, location);
|
||||||
|
}
|
||||||
|
catch (cause) {
|
||||||
|
this.emit("error", new RedirectionError(cause));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the redirected request
|
// Create the redirected request
|
||||||
var redirectUrl = url.resolve(this._currentUrl, location);
|
|
||||||
debug("redirecting to", redirectUrl);
|
debug("redirecting to", redirectUrl);
|
||||||
this._isRedirect = true;
|
this._isRedirect = true;
|
||||||
var redirectUrlParts = url.parse(redirectUrl);
|
var redirectUrlParts = url.parse(redirectUrl);
|
||||||
Object.assign(this._options, redirectUrlParts);
|
Object.assign(this._options, redirectUrlParts);
|
||||||
|
|
||||||
// Drop the Authorization header if redirecting to another host
|
// Drop confidential headers when redirecting to another scheme:domain
|
||||||
if (redirectUrlParts.hostname !== previousHostName) {
|
if (redirectUrlParts.protocol !== currentUrlParts.protocol ||
|
||||||
removeMatchingHeaders(/^authorization$/i, this._options.headers);
|
!isSameOrSubdomain(redirectUrlParts.host, currentHost)) {
|
||||||
|
removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate the beforeRedirect callback
|
// Evaluate the beforeRedirect callback
|
||||||
@@ -5444,9 +5466,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
|
|||||||
this._performRequest();
|
this._performRequest();
|
||||||
}
|
}
|
||||||
catch (cause) {
|
catch (cause) {
|
||||||
var error = new RedirectionError("Redirected request failed: " + cause.message);
|
this.emit("error", new RedirectionError(cause));
|
||||||
error.cause = cause;
|
|
||||||
this.emit("error", error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -5560,13 +5580,20 @@ function removeMatchingHeaders(regex, headers) {
|
|||||||
delete headers[header];
|
delete headers[header];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lastValue;
|
return (lastValue === null || typeof lastValue === "undefined") ?
|
||||||
|
undefined : String(lastValue).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createErrorType(code, defaultMessage) {
|
function createErrorType(code, defaultMessage) {
|
||||||
function CustomError(message) {
|
function CustomError(cause) {
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
this.message = message || defaultMessage;
|
if (!cause) {
|
||||||
|
this.message = defaultMessage;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.message = defaultMessage + ": " + cause.message;
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CustomError.prototype = new Error();
|
CustomError.prototype = new Error();
|
||||||
CustomError.prototype.constructor = CustomError;
|
CustomError.prototype.constructor = CustomError;
|
||||||
@@ -5583,6 +5610,14 @@ function abortRequest(request) {
|
|||||||
request.abort();
|
request.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSameOrSubdomain(subdomain, domain) {
|
||||||
|
if (subdomain === domain) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const dot = subdomain.length - domain.length - 1;
|
||||||
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
||||||
|
}
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
module.exports = wrap({ http: http, https: https });
|
module.exports = wrap({ http: http, https: https });
|
||||||
module.exports.wrap = wrap;
|
module.exports.wrap = wrap;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user