From 6dd2b023b829657b03fbf2b10fcf2741cd0028f9 Mon Sep 17 00:00:00 2001 From: Paul Jaffre Date: Thu, 5 Jan 2023 16:35:49 -0500 Subject: [PATCH] dist build --- dist/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 0903e24dd..38ffa28fe 100644 --- a/dist/index.js +++ b/dist/index.js @@ -52872,11 +52872,12 @@ function asPromise(normalizedOptions) { request._beforeError(new types_1.RequestError(error.message, error, request)); return; } + globalResponse = response; if (!is_response_ok_1.isResponseOk(response)) { request._beforeError(new types_1.HTTPError(response)); return; } - globalResponse = response; + request.destroy(); resolve(request.options.resolveBodyOnly ? response.body : response); }); const onError = (error) => { @@ -54014,6 +54015,14 @@ class Request extends stream_1.Duplex { const redirectUrl = new url_1.URL(redirectBuffer, url); const redirectString = redirectUrl.toString(); decodeURI(redirectString); + // eslint-disable-next-line no-inner-declarations + function isUnixSocketURL(url) { + return url.protocol === 'unix:' || url.hostname === 'unix'; + } + if (!isUnixSocketURL(url) && isUnixSocketURL(redirectUrl)) { + this._beforeError(new RequestError('Cannot redirect to UNIX socket', {}, this)); + return; + } // Redirecting to a different site, clear sensitive data. if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) { if ('host' in options.headers) {