Project

General

Profile

Bug #20113

Erreur lorsqu'on tente de logguer une erreur de récupération de métadonnées

Added by Frédéric Péters almost 2 years ago. Updated 6 months ago.

Status:
Rejeté
Priority:
Normal
Target version:
Start date:
16 Nov 2017
Due date:
% Done:

0%

Patch proposed:
Yes
Planning:
No

Description

Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  125.                     response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/usr/lib/python2.7/dist-packages/mellon/middleware.py" in process_view
  26.         if not any(utils.get_idps()):
File "/usr/lib/python2.7/dist-packages/mellon/utils.py" in get_idps
  111.             for idp in adapter.get_idps():
File "/usr/lib/python2.7/dist-packages/mellon/adapters.py" in get_idps
  44.                         idp['METADATA_URL'], e, i)
File "/usr/lib/python2.7/logging/__init__.py" in error
  1186.             self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/__init__.py" in _log
  1279.         self.handle(record)
File "/usr/lib/python2.7/logging/__init__.py" in handle
  1289.             self.callHandlers(record)
File "/usr/lib/python2.7/logging/__init__.py" in callHandlers
  1329.                     hdlr.handle(record)
File "/usr/lib/python2.7/logging/__init__.py" in handle
  757.                 self.emit(record)
File "/usr/lib/python2.7/dist-packages/django/utils/log.py" in emit
  115.                 record.getMessage()
File "/usr/lib/python2.7/logging/__init__.py" in getMessage
  335.             msg = msg % self.args

Exception Type: TypeError at /
Exception Value: __str__ returned non-string (type Error)
...
e    SSLError(SSLError(SSLError('bad handshake', Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)),),)

0001-prevent-conversion-from-SSLError-to-str-to-fail-fixe.patch View (2.03 KB) Benjamin Dauvergne, 07 Mar 2018 05:01 PM

History

#1 Updated by Benjamin Dauvergne over 1 year ago

C'est quelle version de requests sur quoi comme Debian ? Je ne reproduis pas chez moi.

#2 Updated by Benjamin Dauvergne over 1 year ago

Et quoi comme python aussi.

#4 Updated by Benjamin Dauvergne over 1 year ago

  • Assignee set to Benjamin Dauvergne
  • Patch proposed changed from No to Yes

#5 Updated by Benjamin Dauvergne over 1 year ago

Ça ne sert à rien sur une jessie :

In [1]: try: requests.get('https://self-signed.badssl.com/')
   ...: except Exception as e:
   ...:         pass
   ...: 

In [2]: print str(e)
name 'requests' is not defined

In [3]: import requests

In [4]: try: requests.get('https://self-signed.badssl.com/')
except Exception as e:
        pass
   ...: 

In [5]: print str(e)
("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

In [6]: print '%s' % e
("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

In [7]: print u'%s' % e
("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

In [8]: print requests.__version__
2.11.1

et sur ma sid:

In [4]: try: requests.get('https://self-signed.badssl.com/')
   ...: except Exception as e:
   ...:     pass
   ...: 

In [5]: print e
HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

In [6]: print str(e)
HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

In [7]: print '%s' % e
HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

In [8]: print u'%s' % e
HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

In [9]: requests.__version__
Out[9]: '2.18.4'
</pr>

#6 Updated by Benjamin Dauvergne over 1 year ago

  • Target version set to 1.2.34

#7 Updated by Benjamin Dauvergne 6 months ago

  • Status changed from Nouveau to Rejeté

Bon vraiment c'est impossible à reproduire de nos jours, c'est vraiment lié à des versions pourris (sous-class d'exception dont __str__() renvoie autre chose qu'une string).

Also available in: Atom PDF