Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests ignores no_proxy which contains a IPv6 CIDR #6313

Open
derekhiggins opened this issue Dec 21, 2022 · 1 comment
Open

requests ignores no_proxy which contains a IPv6 CIDR #6313

derekhiggins opened this issue Dec 21, 2022 · 1 comment

Comments

@derekhiggins
Copy link

derekhiggins commented Dec 21, 2022

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: urllib3/urllib3#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
}

@derekhiggins
Copy link
Author

Proposed a fix here #5953

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

No branches or pull requests

1 participant