@@ -2,7 +2,6 @@ import { version } from "../version.ts";
2
2
import https from "node:https" ;
3
3
import http from "node:http" ;
4
4
import qs from "node:querystring" ;
5
- import { HttpsProxyAgent } from "npm:https-proxy-agent" ;
6
5
import { RequestTimeoutError } from "./errors.ts" ;
7
6
import { config } from "./config.ts" ;
8
7
import { Buffer } from "node:buffer" ;
@@ -64,16 +63,6 @@ export function execute(
64
63
source : getSource ( ) ,
65
64
} ) ;
66
65
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
-
77
66
return new Promise ( ( resolve , reject ) => {
78
67
let timer : number ;
79
68
@@ -107,18 +96,13 @@ export function execute(
107
96
if ( timer ) clearTimeout ( timer ) ;
108
97
} ;
109
98
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
+ { } ;
117
102
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 ) ;
122
106
123
107
if ( timeout > 0 ) {
124
108
timer = setTimeout ( ( ) => {
0 commit comments