@@ -2,7 +2,6 @@ import { version } from "../version.ts";
22import https from "node:https" ;
33import http from "node:http" ;
44import qs from "node:querystring" ;
5- import { HttpsProxyAgent } from "npm:https-proxy-agent" ;
65import { RequestTimeoutError } from "./errors.ts" ;
76import { config } from "./config.ts" ;
87import { Buffer } from "node:buffer" ;
@@ -64,16 +63,6 @@ export function execute(
6463 source : getSource ( ) ,
6564 } ) ;
6665
67- // Check if we should use a proxy
68- const urlObj = new URL ( url ) ;
69- const shouldUseProxy = ! config . no_proxy ?. split ( "," ) . some ( ( domain ) =>
70- urlObj . hostname . endsWith ( domain . trim ( ) )
71- ) ;
72-
73- const proxyUrl = shouldUseProxy
74- ? ( urlObj . protocol === "https:" ? config . https_proxy : config . http_proxy )
75- : undefined ;
76-
7766 return new Promise ( ( resolve , reject ) => {
7867 let timer : number ;
7968
@@ -107,18 +96,13 @@ export function execute(
10796 if ( timer ) clearTimeout ( timer ) ;
10897 } ;
10998
110- const options : https . RequestOptions = {
111- timeout : timeout > 0 ? timeout : undefined ,
112- } ;
113-
114- if ( proxyUrl ) {
115- options . agent = new HttpsProxyAgent ( proxyUrl ) ;
116- }
99+ const options = ( parameters . requestOptions as http . RequestOptions ) ||
100+ config . requestOptions ||
101+ { } ;
117102
118- const req = https . get ( url , options , handleResponse ) . on (
119- "error" ,
120- handleError ,
121- ) ;
103+ const req = https
104+ . get ( url , options , handleResponse )
105+ . on ( "error" , handleError ) ;
122106
123107 if ( timeout > 0 ) {
124108 timer = setTimeout ( ( ) => {
0 commit comments