python-urllib3/urllib3-ssl-default-context.patch
Robert Schweikert bf31fee757 Accepting request 447957 from home:tbechtold:branches:devel:languages:python
update to version 1.19.1
  * Forgot to mention #955.
  * Starting o the user guide.
  * Add ipaddress marker to setup.cfg.
  * CHANGES for #897
  * Version added 1.17
  * Change debug level to 'debug' to match ConnectionPool
  * Moving some stuff to advanced usage.
  * Ignore only the unused import error
  * Uniform checks.
  * Add test for past date in Retry-After header
  * Adding all reference docs
  * Ok, I just gotta see what's going on here.
  * Adding app engine docs
  * Keep using the good OpenSSL
  * Adding timeout section
  * Removing absolute import in NTLMPool
  * Use the good OpenSSL.
  * Small pass at contributing
  * parse_url: Disallow non-integer digits explicitly in port numbers
  * Fixup some whitespace.
  * Updating copy on landing page.
  * Fix flake8 E305 errors
  * Use OS default certs when possible
  * Fleshing out user guide.
  * Fallback to the vendored ipaddress module.
  * Updating intersphinx to python 3.4
  * Seems like version mismatch is the issue.
  * Improve the cipher suite comment
  * Retry backoff time is calculated only from the last consecutive errors sequence

OBS-URL: https://build.opensuse.org/request/show/447957
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3?expand=0&rev=23
2016-12-28 13:50:39 +00:00

22 lines
964 B
Diff

Index: urllib3-1.19.1/urllib3/util/ssl_.py
===================================================================
--- urllib3-1.19.1.orig/urllib3/util/ssl_.py
+++ urllib3-1.19.1/urllib3/util/ssl_.py
@@ -314,9 +314,13 @@ def ssl_wrap_socket(sock, keyfile=None,
if e.errno == errno.ENOENT:
raise SSLError(e)
raise
- elif getattr(context, 'load_default_certs', None) is not None:
- # try to load OS default certs; works well on Windows (require Python3.4+)
- context.load_default_certs()
+ else:
+ if cert_reqs != ssl.CERT_NONE and hasattr(context, 'set_default_verify_paths'):
+ context.set_default_verify_paths()
+
+ if getattr(context, 'load_default_certs', None) is not None:
+ # try to load OS default certs; works well on Windows (require Python3.4+)
+ context.load_default_certs()
if certfile:
context.load_cert_chain(certfile, keyfile)