(env, protocol, keepAlive)
| 210 | } |
| 211 | |
| 212 | function parseProxyConfigFromEnv(env, protocol, keepAlive) { |
| 213 | // We only support proxying for HTTP and HTTPS requests. |
| 214 | if (protocol !== 'http:' && protocol !== 'https:') { |
| 215 | return null; |
| 216 | } |
| 217 | |
| 218 | const proxyUrl = parseProxyUrl(env, protocol); |
| 219 | if (proxyUrl === null) { |
| 220 | return null; |
| 221 | } |
| 222 | |
| 223 | // Only http:// and https:// proxies are supported. |
| 224 | // Ignore instead of throw, in case other protocols are supposed to be |
| 225 | // handled by the user land. |
| 226 | if (!proxyUrl.startsWith('http://') && !proxyUrl.startsWith('https://')) { |
| 227 | return null; |
| 228 | } |
| 229 | |
| 230 | const noProxyList = env.no_proxy || env.NO_PROXY; |
| 231 | return new ProxyConfig(proxyUrl, keepAlive, noProxyList); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * @param {ProxyConfig} proxyConfig |
no test coverage detected
searching dependent graphs…