@@ -73,30 +73,22 @@ const BSD_CA_ROOTS = [
7373    " /usr/local/etc/ssl/cert.pem"                         #  FreeBSD
7474]
7575
76- const  SYSTEM_CA_ROOTS_LOCK =  ReentrantLock ()
77- const  SYSTEM_CA_ROOTS =  Ref {Union{Nothing, String}} (nothing )
78- 
7976const  BEGIN_CERT_REGULAR =  " -----BEGIN CERTIFICATE-----" 
8077const  BEGIN_CERT_OPENSSL =  " -----BEGIN TRUSTED CERTIFICATE-----" 
8178
82- function  system_ca_roots ()
83-     lock (SYSTEM_CA_ROOTS_LOCK) do 
84-         SYSTEM_CA_ROOTS[] != =  nothing  &&  return  #  from lock()
85-         search_path =  Sys. islinux () ?  LINUX_CA_ROOTS : 
86-             Sys. isbsd () &&  ! Sys. isapple () ?  BSD_CA_ROOTS :  String[]
87-         for  path in  search_path
88-             ispath (path) ||  continue 
89-             for  line in  eachline (path)
90-                 if  line in  [BEGIN_CERT_REGULAR, BEGIN_CERT_OPENSSL]
91-                     SYSTEM_CA_ROOTS[] =  path
92-                     return  #  from lock()
93-                 end 
79+ const  system_ca_roots =  OncePerProcess {String} () do 
80+     search_path =  Sys. islinux () ?  LINUX_CA_ROOTS : 
81+         Sys. isbsd () &&  ! Sys. isapple () ?  BSD_CA_ROOTS :  String[]
82+     for  path in  search_path
83+         ispath (path) ||  continue 
84+         for  line in  eachline (path)
85+             if  line in  [BEGIN_CERT_REGULAR, BEGIN_CERT_OPENSSL]
86+                 return  path
9487            end 
9588        end 
96-         #  TODO : extract system certs on Windows & macOS
97-         SYSTEM_CA_ROOTS[] =  bundled_ca_roots ()
9889    end 
99-     return  SYSTEM_CA_ROOTS[]
90+     #  TODO : extract system certs on Windows & macOS
91+     return  bundled_ca_roots ()
10092end 
10193
10294const  CA_ROOTS_VARS =  [
0 commit comments