Skip to content

fix: sanitize NO_PROXY values before client setup#3468

Open
nightcityblade wants to merge 2 commits into
openai:mainfrom
nightcityblade:fix/issue-3303-no-proxy
Open

fix: sanitize NO_PROXY values before client setup#3468
nightcityblade wants to merge 2 commits into
openai:mainfrom
nightcityblade:fix/issue-3303-no-proxy

Conversation

@nightcityblade

Copy link
Copy Markdown
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Fixes #3303.

Sanitize newline-delimited NO_PROXY / no_proxy environment values while constructing the default sync and async HTTP clients, then restore the original environment values after initialization. Added regression coverage for both client types.

Additional context & links

Validation:

  • .venv/bin/python -m pytest -o addopts= tests/test_client.py -k no_proxy_with_newlines_is_sanitized_for_default_http_client

@nightcityblade nightcityblade requested a review from a team as a code owner July 3, 2026 03:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc70bb4583

ℹ️ 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".

Comment on lines +1418 to +1419
with _sanitized_proxy_env():
super().__init__(**kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the proxy sanitizer to DefaultAioHttpClient too

When users opt into the aiohttp transport via the exported DefaultAioHttpClient, its initializer just below still calls httpx_aiohttp.HttpxAiohttpClient/httpx.AsyncClient.__init__ without this context. With NO_PROXY or no_proxy containing newlines, DefaultAioHttpClient() will therefore hit the same httpx environment-proxy parsing error that this patch fixes for DefaultAsyncHttpxClient; wrap that initializer as well so the optional async client behaves consistently.

Useful? React with 👍 / 👎.

@nightcityblade

Copy link
Copy Markdown
Author

Addressed in 935f6e2. I wrapped the default aiohttp client initializer in the same sanitized proxy env context so the async aiohttp transport now matches the default httpx transport behavior.

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.

InvalidURL error when NO_PROXY environment variable contains newline characters

1 participant