|
9 | 9 |
|
10 | 10 | """A blueprint module providing utility functions for the application.""" |
11 | 11 |
|
| 12 | +import certifi |
12 | 13 | from pgadmin.utils import driver |
13 | 14 | from flask import request, current_app |
14 | 15 | from flask_babel import gettext |
@@ -371,18 +372,22 @@ def upgrade_check(): |
371 | 372 | # Do not wait for more than 5 seconds. |
372 | 373 | # It stuck on rendering the browser.html, while working in the |
373 | 374 | # broken network. |
374 | | - if os.path.exists(config.CA_FILE) and sys.version_info >= ( |
| 375 | + if sys.version_info >= ( |
375 | 376 | 3, 13): |
376 | 377 | # Use SSL context for Python 3.13+ |
377 | | - context = ssl.create_default_context(cafile=config.CA_FILE) |
| 378 | + if os.path.exists(config.CA_FILE): |
| 379 | + context = ssl.create_default_context(cafile=config.CA_FILE) |
| 380 | + else: |
| 381 | + context = ssl.create_default_context(certifi.where()) |
| 382 | + |
378 | 383 | response = urlopen(url, data=data, timeout=5, |
379 | 384 | context=context) |
380 | 385 | elif os.path.exists(config.CA_FILE): |
381 | 386 | # Use cafile parameter for older versions |
382 | 387 | response = urlopen(url, data=data, timeout=5, |
383 | 388 | cafile=config.CA_FILE) |
384 | 389 | else: |
385 | | - response = urlopen(url, data, 5) |
| 390 | + response = urlopen(url, data, 5, cafile=certifi.where()) |
386 | 391 | current_app.logger.debug( |
387 | 392 | 'Version check HTTP response code: %d' % response.getcode() |
388 | 393 | ) |
|
0 commit comments