Title: fix: honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars by XXPermanentXX · Pull Request #50 · modelstudioai/cli · GitHub
Open Graph Title: fix: honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars by XXPermanentXX · Pull Request #50 · modelstudioai/cli
X Title: fix: honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars by XXPermanentXX · Pull Request #50 · modelstudioai/cli
Description: Summary Fixes #35 — running bl behind a VPN / corporate proxy failed with ECONNRESET: Client network socket disconnected before secure TLS connection was established. Root cause: Node's built-in fetch (undici) does not read proxy environment variables, so the CLI always connected directly, bypassing the local proxy and getting blocked. Fix: at startup, install an EnvHttpProxyAgent as the global undici dispatcher — but only when HTTP_PROXY / HTTPS_PROXY is actually set. When no proxy variable is configured, the global dispatcher is untouched and behavior is exactly as before. export HTTPS_PROXY=http://127.0.0.1:7890 bl app list # now routes through the proxy Changes packages/cli/src/proxy.ts (new): readProxyEnv() + setupProxyFromEnv(). Lowercase variables take precedence over uppercase (curl convention); NO_PROXY is supported. 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. An invalid proxy URL fails with a clear usage error (Invalid proxy configuration: … + hint) instead of a raw stack trace. packages/cli/src/main.ts: call setupProxyFromEnv() at module top level, before any fetch is issued (including update-checker). packages/cli/src/error-handler.ts: the ECONNRESET hint now suggests export HTTPS_PROXY=… for VPN / corporate-proxy users. undici added as an explicit dependency (catalog ^8.4.1). Tests (fully offline) tests/proxy.test.ts: env parsing — unset/blank handling, lowercase precedence, empty-string-masking regression, NO_PROXY. tests/e2e/proxy.e2e.test.ts: spins up a local CONNECT proxy and targets a .invalid host (guaranteed unresolvable, no real network traffic). Verifies: with HTTPS_PROXY set, CLI traffic tunnels through the proxy (CONNECT to the target host); empty lowercase https_proxy does not mask HTTPS_PROXY; NO_PROXY match keeps the request direct; with no proxy vars set, the proxy receives zero traffic (no behavior change); an invalid proxy URL produces a clear error message. All 10 tests pass. 🤖 Generated with Claude Code
Open Graph Description: Summary Fixes #35 — running bl behind a VPN / corporate proxy failed with ECONNRESET: Client network socket disconnected before secure TLS connection was established. Root cause: Node's built-i...
X Description: Summary Fixes #35 — running bl behind a VPN / corporate proxy failed with ECONNRESET: Client network socket disconnected before secure TLS connection was established. Root cause: Node's bui...
Opengraph URL: https://github.com/modelstudioai/cli/pull/50
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:843bf76a-2105-b266-44fd-f778df060725 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A48C:2D3512:9C7C26:D0C624:6A527C82 |
| html-safe-nonce | 5ae258d10b32716b72a74fb7be2e684a03cf58ae0295c9b08f6483a43799e628 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDhDOjJEMzUxMjo5QzdDMjY6RDBDNjI0OjZBNTI3QzgyIiwidmlzaXRvcl9pZCI6IjgyMTk4NTc4MDA0MjEwODAxOTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a8cd3fc1c4cd295da98fb2a28b3645ddb7e6e5016c52ff92302d0f82ec1007f2 |
| hovercard-subject-tag | pull_request:3852658145 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelstudioai/cli/pull/50/files |
| twitter:image | https://avatars.githubusercontent.com/u/92624196?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/92624196?s=400&v=4 |
| og:image:alt | Summary Fixes #35 — running bl behind a VPN / corporate proxy failed with ECONNRESET: Client network socket disconnected before secure TLS connection was established. Root cause: Node's built-i... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelstudioai/cli git https://github.com/modelstudioai/cli.git |
| octolytics-dimension-user_id | 283556804 |
| octolytics-dimension-user_login | modelstudioai |
| octolytics-dimension-repository_id | 1251875798 |
| octolytics-dimension-repository_nwo | modelstudioai/cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1251875798 |
| octolytics-dimension-repository_network_root_nwo | modelstudioai/cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width