Describe the feature you want to add
All previous approaches (Lock, Thread-Local, ContextVar) modify the global socket.getaddrinfo function, either temporarily or permanently. This is inherently fragile: third-party libraries, monkey-patching tools, or unexpected code paths can observe the modified function.
We need an approach that enforces address family restrictions without touching any global state, by controlling DNS resolution at the urllib3 connection layer itself.
Describe your proposed solution
Introduce IPv4ConnectionAdapter and IPv6ConnectionAdapter that override urllib3's connection pool machinery.
Key properties:
- Zero global state mutation: socket.getaddrinfo is never modified
- Fully concurrent: no locks, no dispatchers, no shared mutable state
- Architecturally cleanest: relies on documented urllib3 extension points
Describe alternatives you've considered, if relevant
No response
Additional context
No response
Describe the feature you want to add
All previous approaches (Lock, Thread-Local, ContextVar) modify the global
socket.getaddrinfofunction, either temporarily or permanently. This is inherently fragile: third-party libraries, monkey-patching tools, or unexpected code paths can observe the modified function.We need an approach that enforces address family restrictions without touching any global state, by controlling DNS resolution at the urllib3 connection layer itself.
Describe your proposed solution
Introduce
IPv4ConnectionAdapterandIPv6ConnectionAdapterthat override urllib3's connection pool machinery.Key properties:
Describe alternatives you've considered, if relevant
No response
Additional context
No response