From fec1caf25d8b280bb86e59bb3438a3ffdd4529f1 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 21 Dec 2021 15:20:14 +0000 Subject: [PATCH] [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 --- addons/l10n_es_edi_sii/models/account_edi_format.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/l10n_es_edi_sii/models/account_edi_format.py b/addons/l10n_es_edi_sii/models/account_edi_format.py index 70ab7b0eca5..4fc12283fda 100644 --- a/addons/l10n_es_edi_sii/models/account_edi_format.py +++ b/addons/l10n_es_edi_sii/models/account_edi_format.py @@ -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):