community icon indicating copy to clipboard operation
community copied to clipboard

Use urlopen instead of build_opener when fetching files from 'internet'. Removes some PY2 compat.

Open misl6 opened this issue 2 years ago • 1 comments

Fixes issues:

  • https://github.com/kivy/python-for-android/issues/1827 (Again, SSL_CERT_FILE workaround is not working anymore)
  • https://github.com/kivy/kivy/issues/6907 (Permanently)
  • https://github.com/kivy/buildozer/issues/1502

Something changed on OpenSSL or on the Python ssl module , and the SSL_CERT_FILE workaround is not working anymore.

  • Now, instead of relying on SSL_CERT_FILE, an SSL context is created (we do something really similar on UrlRequest).
  • Took the chance to remove some PY2 compat code

FYI (in a TL;DR version):

Really tried ( ~4h ) to find the root cause of the SSL_CERT_FILE workaround failure (mostly for fun, as this patch looks cleaner), but without success.

ssl.get_default_verify_paths() returns the correct cafile when called, but ssl.create_default_context().get_ca_certs() returns an empty list.

The best guess is that X509_STORE_set_default_paths (of openssl) is silently failing on Android. Will try to continue the investigation ...

Maintainer merge checklist

  • [ ] Title is descriptive/clear for inclusion in release notes.
  • [ ] Applied a Component: xxx label.
  • [ ] Applied the api-deprecation or api-break label.
  • [ ] Applied the release-highlight label to be highlighted in release notes.
  • [ ] Added to the milestone version it was merged into.
  • [ ] Unittests are included in PR.
  • [ ] Properly documented, including versionadded, versionchanged as needed.

misl6 avatar Sep 03 '22 17:09 misl6

so what is the solution for this issue ?

cryptoone avatar Sep 09 '22 17:09 cryptoone