Browse Source

[fix] #471 #463 fix old openssl(<1.0.2) requests verify error

misnyo 9 years ago
parent
commit
35a2bc5650
2 changed files with 9 additions and 1 deletions
  1. 8
    0
      searx/__init__.py
  2. 1
    1
      versions.cfg

+ 8
- 0
searx/__init__.py View File

15
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
15
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
16
 '''
16
 '''
17
 
17
 
18
+import certifi
18
 import logging
19
 import logging
19
 from os import environ
20
 from os import environ
20
 from os.path import realpath, dirname, join, abspath
21
 from os.path import realpath, dirname, join, abspath
22
+from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION
21
 try:
23
 try:
22
     from yaml import load
24
     from yaml import load
23
 except:
25
 except:
47
 
49
 
48
 logger = logging.getLogger('searx')
50
 logger = logging.getLogger('searx')
49
 
51
 
52
+# Workaround for openssl versions <1.0.2
53
+# https://github.com/certifi/python-certifi/issues/26
54
+if OPENSSL_VERSION_INFO[0:3] < (1, 0, 2):
55
+    environ['REQUESTS_CA_BUNDLE'] = certifi.old_where()
56
+    logger.warning('You are using an old openssl version({0}), please upgrade above 1.0.2!'.format(OPENSSL_VERSION))
57
+
50
 logger.info('Initialisation done')
58
 logger.info('Initialisation done')

+ 1
- 1
versions.cfg View File

35
 ndg-httpsclient = 0.4.0
35
 ndg-httpsclient = 0.4.0
36
 pyasn1 = 0.1.8
36
 pyasn1 = 0.1.8
37
 pyasn1-modules = 0.0.6
37
 pyasn1-modules = 0.0.6
38
-certifi = 2015.04.28
38
+certifi = 2015.11.20.1
39
 
39
 
40
 cffi = 1.1.2
40
 cffi = 1.1.2
41
 cryptography = 0.9.1
41
 cryptography = 0.9.1