01-arcadia.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132
  1. --- contrib/python/tornado/tornado-4/tornado/curl_httpclient.py (index)
  2. +++ contrib/python/tornado/tornado-4/tornado/curl_httpclient.py (working tree)
  3. @@ -364,7 +364,17 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
  4. curl.setopt(pycurl.SSL_VERIFYPEER, 0)
  5. curl.setopt(pycurl.SSL_VERIFYHOST, 0)
  6. if request.ca_certs is not None:
  7. - curl.setopt(pycurl.CAINFO, request.ca_certs)
  8. + cafile, capath, cadata = None, None, None
  9. + if callable(request.ca_certs):
  10. + cafile, capath, cadata = request.ca_certs()
  11. + else:
  12. + cafile = request.ca_certs
  13. + if cafile is not None:
  14. + curl.setopt(pycurl.CAINFO, cafile)
  15. + if capath is not None:
  16. + curl.setopt(pycurl.CAPATH, capath)
  17. + if cadata is not None:
  18. + curl.set_ca_certs(cadata)
  19. else:
  20. # There is no way to restore pycurl.CAINFO to its default value
  21. # (Using unsetopt makes it reject all certificates).
  22. --- contrib/python/tornado/tornado-4/tornado/netutil.py (index)
  23. +++ contrib/python/tornado/tornado-4/tornado/netutil.py (working tree)
  24. @@ -64,6 +64,8 @@ if hasattr(ssl, 'SSLContext'):
  25. # of a context is to authentiate the opposite side of the connection.
  26. _client_ssl_defaults = ssl.create_default_context(
  27. ssl.Purpose.SERVER_AUTH)
  28. + # load ca certs bundled with binary
  29. + _client_ssl_defaults.load_verify_locations(certifi.where())
  30. _server_ssl_defaults = ssl.create_default_context(
  31. ssl.Purpose.CLIENT_AUTH)
  32. else: