feat(gateway): one gateway.trust_env key controls aiohttp proxy-env honoring at every adapter site (#48820 bug 3)
Every gateway/plugin platform adapter hard-coded aiohttp.ClientSession(trust_env=True) (~20 sites), so a gateway launched by a Windows Scheduled Task that inherits a stale HTTP_PROXY (Clash/V2Ray on 127.0.0.1:7890) looped on 'Cannot connect to host' with no way to opt out short of NO_PROXY hacks per vendor host. - gateway/platforms/base.py: gateway_trust_env() reads gateway.trust_env (default true); resolve_proxy_url() skips generic HTTP(S)_PROXY/ALL_PROXY + macOS system-proxy auto-detect when false (explicit per-platform vars still win). - All aiohttp ClientSession sites in weixin, qqbot, matrix, line, wecom, slack, sms, teams, google_chat now pass trust_env=gateway_trust_env(); mattermost + homeassistant bare sessions gain the same kwarg (intent of #70119 / #56229). - DEFAULT_CONFIG + cli-config.yaml.example + messaging docs. - tests/gateway/test_gateway_trust_env.py: config flip + no-bare-literal sweep. Reported-by: @ranlingfeng (#48820), @frontnopipe-cloud (#76309) Co-authored-by: rcarrata <rcarratalasanchez@gmail.com> Co-authored-by: Backroads4Me <TEDLANHAM@GMAIL.COM>
This commit is contained in:
@@ -103,6 +103,7 @@ TextBlock = None # type: ignore[assignment,misc]
|
||||
from gateway.config import Platform, PlatformConfig
|
||||
from gateway.platforms.helpers import MessageDeduplicator
|
||||
from gateway.platforms.base import (
|
||||
gateway_trust_env,
|
||||
BasePlatformAdapter,
|
||||
MessageEvent,
|
||||
MessageType,
|
||||
@@ -641,7 +642,7 @@ async def _standalone_send(
|
||||
# Per-request timeouts so a slow STS endpoint cannot starve the
|
||||
# subsequent activity POST of its budget.
|
||||
per_request_timeout = _aiohttp.ClientTimeout(total=15.0)
|
||||
async with _aiohttp.ClientSession(trust_env=True) as session:
|
||||
async with _aiohttp.ClientSession(trust_env=gateway_trust_env()) as session:
|
||||
async with session.post(
|
||||
token_url,
|
||||
data={
|
||||
|
||||
Reference in New Issue
Block a user