fix: pass on the auth from the download URL (#10271)

This commit is contained in:
Alex Rudenko 2023-05-30 11:37:22 +02:00 committed by GitHub
parent 50e72a4d11
commit 3a1f4f0f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

13
package-lock.json generated
View File

@ -25,7 +25,7 @@
"@types/diff": "5.0.2", "@types/diff": "5.0.2",
"@types/mime": "3.0.1", "@types/mime": "3.0.1",
"@types/mocha": "10.0.1", "@types/mocha": "10.0.1",
"@types/node": "18.14.6", "@types/node": "20.2.5",
"@types/pixelmatch": "5.2.4", "@types/pixelmatch": "5.2.4",
"@types/pngjs": "6.0.1", "@types/pngjs": "6.0.1",
"@types/progress": "2.0.5", "@types/progress": "2.0.5",
@ -1815,9 +1815,10 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.14.6", "version": "20.2.5",
"devOptional": true, "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
"license": "MIT" "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==",
"devOptional": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {
"version": "2.4.1", "version": "2.4.1",
@ -11256,7 +11257,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "18.14.6", "version": "20.2.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
"integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==",
"devOptional": true "devOptional": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {

View File

@ -129,7 +129,7 @@
"@types/diff": "5.0.2", "@types/diff": "5.0.2",
"@types/mime": "3.0.1", "@types/mime": "3.0.1",
"@types/mocha": "10.0.1", "@types/mocha": "10.0.1",
"@types/node": "18.14.6", "@types/node": "20.2.5",
"@types/pixelmatch": "5.2.4", "@types/pixelmatch": "5.2.4",
"@types/pngjs": "6.0.1", "@types/pngjs": "6.0.1",
"@types/progress": "2.0.5", "@types/progress": "2.0.5",

View File

@ -17,7 +17,7 @@
import {createWriteStream} from 'fs'; import {createWriteStream} from 'fs';
import * as http from 'http'; import * as http from 'http';
import * as https from 'https'; import * as https from 'https';
import {URL} from 'url'; import {URL, urlToHttpOptions} from 'url';
import {ProxyAgent} from 'proxy-agent'; import {ProxyAgent} from 'proxy-agent';
@ -50,6 +50,7 @@ export function httpRequest(
path: url.pathname + url.search, path: url.pathname + url.search,
method, method,
headers: keepAlive ? {Connection: 'keep-alive'} : undefined, headers: keepAlive ? {Connection: 'keep-alive'} : undefined,
auth: urlToHttpOptions(url).auth,
agent: new ProxyAgent(), agent: new ProxyAgent(),
}; };