@@ -3,7 +3,7 @@ import * as path from "path";
33import { performance } from "perf_hooks" ;
44
55import * as core from "@actions/core" ;
6- import { getProxyUrl } from "@actions/http-client/lib/proxy " ;
6+ import { HttpClient } from "@actions/http-client" ;
77import * as toolcache from "@actions/tool-cache" ;
88import { https } from "follow-redirects" ;
99import { v4 as uuidV4 } from "uuid" ;
@@ -186,8 +186,8 @@ async function downloadAndExtractZstdWithStreaming(
186186 tarVersion : tar . TarVersion ,
187187 logger : Logger ,
188188) : Promise < string > {
189- // Attempt to detect a proxy URL that should be used for the download .
190- const downloadUrl = adjustUrlByProxy ( codeqlURL ) || codeqlURL ;
189+ // Get Agent to use (respects proxy settings) .
190+ const agent = new HttpClient ( ) . getAgent ( codeqlURL ) ;
191191
192192 headers = Object . assign (
193193 { "User-Agent" : "CodeQL Action" } ,
@@ -196,10 +196,11 @@ async function downloadAndExtractZstdWithStreaming(
196196 ) ;
197197 const response = await new Promise < IncomingMessage > ( ( resolve ) =>
198198 https . get (
199- downloadUrl ,
199+ codeqlURL ,
200200 {
201201 headers,
202202 highWaterMark : STREAMING_HIGH_WATERMARK_BYTES ,
203+ agent,
203204 } as unknown as RequestOptions ,
204205 ( r ) => resolve ( r ) ,
205206 ) ,
@@ -221,9 +222,3 @@ function sanitizeUrlForStatusReport(url: string): string {
221222 ? url
222223 : "sanitized-value" ;
223224}
224-
225- // Auxiliary function to retrieve the proxy URL to use for a given URL, if proxy settings are configured.
226- function adjustUrlByProxy ( url : string ) : string | undefined {
227- const proxyUrl = getProxyUrl ( new URL ( url ) ) ;
228- return proxyUrl ? proxyUrl . toString ( ) : undefined ;
229- }
0 commit comments