@@ -222,7 +222,7 @@ def _parse_hostlist(hostlist, port, *, unquote=False):
222
222
223
223
def _parse_connect_dsn_and_args (* , dsn , host , port , user ,
224
224
password , passfile , database , ssl ,
225
- sslcert , sslkey , sslrootcert ,
225
+ sslcert , sslkey , sslrootcert , sslcrl ,
226
226
connect_timeout , server_settings ):
227
227
# `auth_hosts` is the version of host information for the purposes
228
228
# of reading the pgpass file.
@@ -326,6 +326,11 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
326
326
if sslrootcert is None :
327
327
sslrootcert = val
328
328
329
+ if 'sslcrl' in query :
330
+ val = query .pop ('sslcrl' )
331
+ if sslcrl is None :
332
+ sslcrl = val
333
+
329
334
if query :
330
335
if server_settings is None :
331
336
server_settings = query
@@ -443,7 +448,6 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
443
448
'`sslmode` parameter must be one of: {}' .format (modes ))
444
449
445
450
# docs at https://www.postgresql.org/docs/10/static/libpq-connect.html
446
- # Not implemented: sslcrl param.
447
451
if sslmode < SSLMode .allow :
448
452
ssl = False
449
453
else :
@@ -462,12 +466,18 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
462
466
if sslrootcert is None :
463
467
sslrootcert = os .getenv ('PGSSLROOTCERT' )
464
468
469
+ if sslcrl is None :
470
+ sslcrl = os .getenv ('PGSSLCRL' )
471
+
465
472
if sslcert :
466
473
ssl .load_cert_chain (sslcert , keyfile = sslkey )
467
474
468
475
if sslrootcert :
469
476
ssl .load_verify_locations (cafile = sslrootcert )
470
477
478
+ if sslcrl :
479
+ ssl .load_verify_locations (cafile = sslcrl )
480
+
471
481
elif ssl is True :
472
482
ssl = ssl_module .create_default_context ()
473
483
sslmode = SSLMode .verify_full
@@ -495,7 +505,7 @@ def _parse_connect_arguments(*, dsn, host, port, user, password, passfile,
495
505
statement_cache_size ,
496
506
max_cached_statement_lifetime ,
497
507
max_cacheable_statement_size ,
498
- ssl , sslcert , sslkey , sslrootcert ,
508
+ ssl , sslcert , sslkey , sslrootcert , sslcrl ,
499
509
server_settings ):
500
510
501
511
local_vars = locals ()
@@ -525,7 +535,7 @@ def _parse_connect_arguments(*, dsn, host, port, user, password, passfile,
525
535
dsn = dsn , host = host , port = port , user = user ,
526
536
password = password , passfile = passfile , ssl = ssl ,
527
537
sslcert = sslcert , sslkey = sslkey , sslrootcert = sslrootcert ,
528
- database = database , connect_timeout = timeout ,
538
+ sslcrl = sslcrl , database = database , connect_timeout = timeout ,
529
539
server_settings = server_settings )
530
540
531
541
config = _ClientConfiguration (
0 commit comments