mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
fix: honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars (#35)
Node's built-in fetch (undici) ignores proxy environment variables, so bl always connected directly and failed with ECONNRESET behind a VPN or corporate proxy. Install an EnvHttpProxyAgent as the global dispatcher at startup, but only when a proxy variable is actually set — behavior is unchanged otherwise. Lowercase variables take precedence over uppercase (curl convention) and NO_PROXY is honored. Values are trimmed and passed explicitly to work around undici reading env vars with ??, where an empty lowercase variable (https_proxy="") masks a configured uppercase one. Invalid proxy URLs fail with a clear usage error instead of a stack trace, and the ECONNRESET hint now suggests exporting HTTPS_PROXY. Tests are fully offline and need no credentials: unit tests cover env parsing, and the e2e test runs a minimal probe (setupProxyFromEnv + a bare fetch) against a .invalid host through a local CONNECT proxy to verify traffic routes through the proxy, NO_PROXY is honored, no dispatcher is installed when unset, and invalid values error clearly.
This commit is contained in:
Generated
+12
@@ -18,6 +18,9 @@ catalogs:
|
||||
chalk:
|
||||
specifier: ^5.6.2
|
||||
version: 5.6.2
|
||||
undici:
|
||||
specifier: ^8.4.1
|
||||
version: 8.4.1
|
||||
vite-plus:
|
||||
specifier: latest
|
||||
version: 0.1.22
|
||||
@@ -48,6 +51,9 @@ importers:
|
||||
chalk:
|
||||
specifier: 'catalog:'
|
||||
version: 5.6.2
|
||||
undici:
|
||||
specifier: 'catalog:'
|
||||
version: 8.4.1
|
||||
devDependencies:
|
||||
'@clack/prompts':
|
||||
specifier: ^0.7.0
|
||||
@@ -993,6 +999,10 @@ packages:
|
||||
undici-types@7.19.2:
|
||||
resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==}
|
||||
|
||||
undici@8.4.1:
|
||||
resolution: {integrity: sha512-RNHlB4fxZK0IrkhBsxhlbx7s8kFWwr7rzzOqj5nvZugw3ig3RsB7KW3zVlV0eu8POl+rx5d1hmL7rRg0z1owow==}
|
||||
engines: {node: '>=22.19.0'}
|
||||
|
||||
vite-plus@0.1.22:
|
||||
resolution: {integrity: sha512-fCCmEKjI+Hv74PdL/MKcrBkdYPHFNcqD5568KxwN0sa4SGxtcbs55i/577LxKs0w5zIjuLRZZ0zQPu9MO+9itg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
@@ -1750,6 +1760,8 @@ snapshots:
|
||||
undici-types@7.19.2:
|
||||
optional: true
|
||||
|
||||
undici@8.4.1: {}
|
||||
|
||||
vite-plus@0.1.22(@types/node@24.12.2)(jiti@2.6.1)(typescript@6.0.3)(vite@8.0.10(@types/node@24.12.2)(jiti@2.6.1)(yaml@2.8.3))(yaml@2.8.3):
|
||||
dependencies:
|
||||
'@oxc-project/types': 0.129.0
|
||||
|
||||
Reference in New Issue
Block a user