@@ -33,23 +33,29 @@ def set_ca_bundle_path(ca_bundle_path: Union[Path, str, bool, None] = None) -> N
33
33
Default is None, which only uses the `certifi` package path as a fallback if
34
34
the environment variables are not set. If a path is passed in, then
35
35
that will be the path used. If it is set to True, then it will default
36
- to using the path provied by the `certifi` package. If it is set to False,
37
- then it will not set the path.
36
+ to using the path provied by the `certifi` package. If it is set to False
37
+ or an empty string then it will default to the system settings or environment
38
+ variables.
38
39
"""
39
- if ca_bundle_path is False :
40
- return
41
-
42
40
env_var_names = (
43
41
"PROJ_CURL_CA_BUNDLE" ,
44
42
"CURL_CA_BUNDLE" ,
45
43
"SSL_CERT_FILE" ,
46
44
)
47
- if isinstance (ca_bundle_path , (str , Path )):
45
+ if ca_bundle_path is False :
46
+ # need to reset CA Bundle path to use system settings
47
+ # or environment variables because it
48
+ # could have been changed by the user previously
49
+ ca_bundle_path = ""
50
+ elif isinstance (ca_bundle_path , (str , Path )):
48
51
ca_bundle_path = str (ca_bundle_path )
49
52
elif (ca_bundle_path is True ) or not any (
50
53
env_var_name in os .environ for env_var_name in env_var_names
51
54
):
52
55
ca_bundle_path = certifi .where ()
56
+ else :
57
+ # reset CA Bundle path to use system settings
58
+ # or environment variables
59
+ ca_bundle_path = ""
53
60
54
- if isinstance (ca_bundle_path , str ):
55
- _set_ca_bundle_path (ca_bundle_path )
61
+ _set_ca_bundle_path (ca_bundle_path )
0 commit comments