fix: enable proxy support via environment variables in aiohttp#1465
fix: enable proxy support via environment variables in aiohttp#1465Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Conversation
aiohttp.ClientSession does not read HTTP_PROXY/HTTPS_PROXY environment variables by default. Set trust_env=True so that users behind corporate proxies can use kimi-cli without issues. Fixes MoonshotAI#1234
a1b2bc1 to
11a1f98
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11a1f984b6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=_ssl_context)) | ||
| return aiohttp.ClientSession( | ||
| connector=aiohttp.TCPConnector(ssl=_ssl_context), | ||
| trust_env=True, |
There was a problem hiding this comment.
Avoid proxying loopback requests by default
Setting trust_env=True on the shared new_client_session() makes every HTTP call honor HTTP_PROXY/HTTPS_PROXY, which also affects loopback URLs unless the user has correctly set NO_PROXY. In environments with a proxy configured but no loopback bypass, requests to http://localhost/127.0.0.1 (for example via the web fetch tooling) are now routed to the proxy and fail, whereas they worked before this change. This introduces a regression for local-service workflows; proxy use should be limited to non-loopback targets or explicitly bypass loopback hosts.
Useful? React with 👍 / 👎.
|
Closing in favor of #1236 which was submitted earlier and includes changelog + documentation updates. |
Problem
aiohttp.ClientSessiondoes not readHTTP_PROXY/HTTPS_PROXY/ALL_PROXYenvironment variables by default (trust_envdefaults toFalse). Users behind corporate proxies cannot use kimi-cli.Fix
Set
trust_env=Trueinnew_client_session()(utils/aiohttp.py).Fixes #1234