MCPcopy Index your code
hub / github.com/nodejs/node / parseProxyUrl

Function parseProxyUrl

lib/internal/http.js:195–210  ·  view source on GitHub ↗
(env, protocol)

Source from the content-addressed store, hash-verified

193}
194
195function parseProxyUrl(env, protocol) {
196 // Get the proxy url - following the most popular convention, lower case takes precedence.
197 // See https://about.gitlab.com/blog/we-need-to-talk-no-proxy/#http_proxy-and-https_proxy
198 const proxyUrl = (protocol === 'https:') ?
199 (env.https_proxy || env.HTTPS_PROXY) : (env.http_proxy || env.HTTP_PROXY);
200 // No proxy settings from the environment, ignore.
201 if (!proxyUrl) {
202 return null;
203 }
204
205 if (proxyUrl.includes('\r') || proxyUrl.includes('\n')) {
206 throw new ERR_PROXY_INVALID_CONFIG(`Invalid proxy URL: ${proxyUrl}`);
207 }
208
209 return proxyUrl;
210}
211
212function parseProxyConfigFromEnv(env, protocol, keepAlive) {
213 // We only support proxying for HTTP and HTTPS requests.

Callers 2

setGlobalProxyFromEnvFunction · 0.85
parseProxyConfigFromEnvFunction · 0.85

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…