Skip to content

Fix HTTPS_PROXY env var not honored when proxy is unset#470

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-https-proxy-env-support
Closed

Fix HTTPS_PROXY env var not honored when proxy is unset#470
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-https-proxy-env-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Explicitly passing proxy=None to aiohttp's ws_connect()/session.get() overrides trust_env=True on the session, preventing HTTPS_PROXY (and related env vars) from being picked up automatically.

Changes

  • communicate.py: Build ws_kwargs dict conditionally; only include proxy key when self.proxy is not None, then unpack into session.ws_connect()
  • voices.py: Same pattern for session.get() in __list_voices()
# Before — proxy=None explicitly suppresses trust_env behaviour
session.ws_connect(..., proxy=self.proxy, ...)

# After — omitting proxy when None lets aiohttp honour HTTPS_PROXY via trust_env
ws_kwargs: Dict[str, object] = {}
if self.proxy is not None:
    ws_kwargs["proxy"] = self.proxy
session.ws_connect(..., **ws_kwargs, ...)

No behaviour change when proxy is explicitly set by the caller.

Original prompt

This section details on the original issue you should resolve

<issue_title>HTTPS_PROXY env support</issue_title>
<issue_description>### Issue
HTTPS_PROXY environment variable not honored
Explicitly specifying the proxy in a Connection may not always be practical (upstream projects, dockerized environments).

Problem

Currently, when self.proxy is None (default), it's still explicitly passed to ws_connect() as proxy=None. This prevents aiohttp from using the environment variables (HTTPS_PROXY) even though trust_env=True is set on the session.

Suggested Workaround

In Communicate, fallback to env HTTPS_PROXY if proxy is None</issue_description>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Fix HTTPS_PROXY environment variable support in Connection Fix HTTPS_PROXY env var not honored when proxy is unset Mar 22, 2026
Copilot AI requested a review from rany2 March 22, 2026 18:03
@rany2 rany2 marked this pull request as ready for review March 22, 2026 18:04
@rany2
Copy link
Copy Markdown
Owner

rany2 commented Mar 22, 2026

This doesn't even seem correct. trust_env is honored even if proxy is explicitly set to None.

@rany2 rany2 closed this Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTPS_PROXY env support

2 participants