[FIX] l10n_es_edi_sii: certificate problems with newer libraries

In urllib3 1.25, an _is_key_file_encrypted method was added
where urllib3 checks if the keyfile is encrypted or not, but
urllib3 uses filenames, while we want to use the contents of cert.
So, in our case, this gave a traceback because it could not open
the file.

The final simple solution for now is to keep keyfile empty as
we store our info in certfile anyways already.

X-original-commit: f908171f91107a4972b29e575bb722c0dabf4ee3
Part-of: odoo/odoo#81911
This commit is contained in:
Josse Colpaert
2021-12-26 19:30:13 +00:00
parent 8d7a9162f9
commit fec1caf25d
@@ -34,13 +34,12 @@ class PatchedHTTPAdapter(requests.adapters.HTTPAdapter):
# still made without checking temporary files exist.
super().cert_verify(conn, url, verify, None)
conn.cert_file = cert
conn.key_file = cert
conn.key_file = None
def get_connection(self, url, proxies=None):
# OVERRIDE
# Patch the OpenSSLContext to decode the certificate in-memory.
conn = super().get_connection(url, proxies=proxies)
context = conn.conn_kw['ssl_context']
def patched_load_cert_chain(l10n_es_odoo_certificate, keyfile=None, password=None):