(env, protocol)
| 193 | } |
| 194 | |
| 195 | function 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 | |
| 212 | function parseProxyConfigFromEnv(env, protocol, keepAlive) { |
| 213 | // We only support proxying for HTTP and HTTPS requests. |
no test coverage detected
searching dependent graphs…