requests ignores no_proxy which contains a IPv6 CIDR
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 54.3k
- Forks
- 10.4k
- Avg merge
- 16h 43m
- Merged PRs (30d)
- 3
Description
python requests supports a no_proxy environment variable with a IPv4 CIDR e.g.
e.g
+ export http_proxy no_proxy
+ http_proxy=http://localhost
+ python -c 'import requests.utils ; print(requests.utils.should_bypass_proxies("http://1.2.3.4", None))'
False
+ no_proxy=1.2.3.0/24
+ python -c 'import requests.utils ; print(requests.utils.should_bypass_proxies("http://1.2.3.4", None))'
True
but doesn't support a IPv6 CIDR e.g.
+ http_proxy=http://localhost
+ python -c 'import requests.utils ; print(requests.utils.should_bypass_proxies("http://[1:2:3::4]", None))'
False
+ no_proxy=1:2:3::/64
+ python -c 'import requests.utils ; print(requests.utils.should_bypass_proxies("http://[1:2:3::4]", None))'
False
Expected Result
For proxy to be bypassed if a the url matches the IPv6 CIDR in no_proxy
Actual Result
IPv6 CIDR ignored
Reproduction Steps
as above
System Information
[derekh@laptop ~]$ python -m requests.help
/usr/lib/python3.11/site-packages/requests/help.py:24: DeprecationWarning: 'urllib3.contrib.pyopenssl' module is deprecated and will be removed in a future release of urllib3 2.x. Read more in this issue: https://github.com/urllib3/urllib3/issues/2680
from urllib3.contrib import pyopenssl
{
"chardet": {
"version": "5.1.0"
},
"charset_normalizer": {
"version": "2.1.0"
},
"cryptography": {
"version": "37.0.2"
},
"idna": {
"version": "3.3"
},
"implementation": {
"name": "CPython",
"version": "3.11.1"
},
"platform": {
"release": "6.0.13-300.fc37.x86_64",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "30000050",
"version": "21.0.0"
},
"requests": {
"version": "2.28.1"
},
"system_ssl": {
"version": "30000050"
},
"urllib3": {
"version": "1.26.12"
},
"using_charset_normalizer": false,
"using_pyopenssl": true
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at requests.utils.should_bypass_proxies and reproduce the reported IPv6 CIDR case using the commands in the issue. Trace how no_proxy entries are matched against IPv6 URLs, then verify that an address within 1:2:3::/64 bypasses the proxy while preserving the existing IPv4 CIDR behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100