Return True if the host should bypass the proxy server. The proxy override list is obtained from the Windows Internet settings proxy override registry value. An example of a proxy override value is: "www.example.com;*.example.net; 192.168.0.1"
(host, override)
| 2008 | |
| 2009 | # Same as _proxy_bypass_macosx_sysconf, testable on all platforms |
| 2010 | def _proxy_bypass_winreg_override(host, override): |
| 2011 | """Return True if the host should bypass the proxy server. |
| 2012 | |
| 2013 | The proxy override list is obtained from the Windows |
| 2014 | Internet settings proxy override registry value. |
| 2015 | |
| 2016 | An example of a proxy override value is: |
| 2017 | "www.example.com;*.example.net; 192.168.0.1" |
| 2018 | """ |
| 2019 | from fnmatch import fnmatch |
| 2020 | |
| 2021 | host, _ = _splitport(host) |
| 2022 | proxy_override = override.split(';') |
| 2023 | for test in proxy_override: |
| 2024 | test = test.strip() |
| 2025 | # "<local>" should bypass the proxy server for all intranet addresses |
| 2026 | if test == '<local>': |
| 2027 | if '.' not in host: |
| 2028 | return True |
| 2029 | elif fnmatch(host, test): |
| 2030 | return True |
| 2031 | return False |
| 2032 | |
| 2033 | |
| 2034 | if sys.platform == 'darwin': |
no test coverage detected