@@ -3,7 +3,7 @@ import * as path from "path";
3
3
import { performance } from "perf_hooks" ;
4
4
5
5
import * as core from "@actions/core" ;
6
- import { getProxyUrl } from "@actions/http-client/lib/proxy " ;
6
+ import { HttpClient } from "@actions/http-client" ;
7
7
import * as toolcache from "@actions/tool-cache" ;
8
8
import { https } from "follow-redirects" ;
9
9
import { v4 as uuidV4 } from "uuid" ;
@@ -186,8 +186,8 @@ async function downloadAndExtractZstdWithStreaming(
186
186
tarVersion : tar . TarVersion ,
187
187
logger : Logger ,
188
188
) : 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 ) ;
191
191
192
192
headers = Object . assign (
193
193
{ "User-Agent" : "CodeQL Action" } ,
@@ -196,10 +196,11 @@ async function downloadAndExtractZstdWithStreaming(
196
196
) ;
197
197
const response = await new Promise < IncomingMessage > ( ( resolve ) =>
198
198
https . get (
199
- downloadUrl ,
199
+ codeqlURL ,
200
200
{
201
201
headers,
202
202
highWaterMark : STREAMING_HIGH_WATERMARK_BYTES ,
203
+ agent,
203
204
} as unknown as RequestOptions ,
204
205
( r ) => resolve ( r ) ,
205
206
) ,
@@ -221,9 +222,3 @@ function sanitizeUrlForStatusReport(url: string): string {
221
222
? url
222
223
: "sanitized-value" ;
223
224
}
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