Fix no_proxy to support IPV6 CIDR format#3741
Conversation
no_proxy=fe11::/16 python -c 'import httpx; c = httpx.Client()'
Closes: #3221
|
Hi, thanks for this PR. I found this httpx issue 6 months ago and wanted to address it since then. Your change only makes httpx not crash when an IPv6 range is in no_proxy but it is not properly handled. I build upon your work and addressed the issue with extending
EDIT: PR is here: p3ck#1 It is also not yet properly tested as I didn't manage to run all tests. I only managed to run tests I modified. |
da3dda0 to
71c6448
Compare
|
@ofilip Thank you for the great work. Can you check the changes I made to get it to pass linting and testing? Thanks |
I reviewed your commits and everything seems in place. Thx a lot for review, tests and improvements. |
httpx <= 0.28.1 wraps NO_PROXY IPv6 entries including the CIDR mask inside brackets (e.g. `[::1/128]`), which its URL parser rejects as `Invalid port: ':1'`. This is triggered by OrbStack/Docker Desktop injecting `NO_PROXY=localhost,127.0.0.0/8,::1/128` into containers. Strip the `/prefix` from IPv6 CIDR entries before initializing AsyncOpenAI. This is safe because httpx doesn't support CIDR range matching anyway — it only does exact-host comparison. Upstream fix: encode/httpx#3741 (pending merge)
Summary
Fixes no_proxy to support IPV6 CIDR format.
no_proxy=fe11::/16 python -c 'import httpx; c = httpx.Client()'
Closes: #3221
Checklist