diff options
Diffstat (limited to 'pym/portage/util/_urlopen.py')
-rw-r--r-- | pym/portage/util/_urlopen.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py index 4cfe183b1..fc9db74a0 100644 --- a/pym/portage/util/_urlopen.py +++ b/pym/portage/util/_urlopen.py @@ -26,6 +26,18 @@ if sys.hexversion >= 0x3000000: # and the file-'mtime' TIMESTAMP_TOLERANCE = 5 + +def have_pep_476(): + """ + Test whether ssl certificate verification is enabled by default for + stdlib http clients (PEP 476). + + @returns: bool, True if ssl certificate verification is enabled by + default + """ + return hasattr(__import__('ssl'), '_create_unverified_context') + + def urlopen(url, if_modified_since=None): parse_result = urllib_parse.urlparse(url) if parse_result.scheme not in ("http", "https"): |