Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search SSL_CERT_FILE before SSL_CERT_DIR #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ca_roots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ end

const CA_ROOTS_VARS = [
"JULIA_SSL_CA_ROOTS_PATH"
"SSL_CERT_DIR"
"SSL_CERT_FILE"
"SSL_CERT_DIR"
]

function _ca_roots(allow_nothing::Bool)
Expand Down
15 changes: 9 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include("setup.jl")
@testset "env vars" begin
unset = ca_roots(), ca_roots_path()
value = "Why hello!"
# set only one CA_ROOT_VAR
for var in CA_ROOTS_VARS
ENV[var] = value
@test ca_roots() == value
Expand All @@ -26,12 +27,14 @@ include("setup.jl")
@test ca_roots_path() == unset[2]
clear_env()
end
for (i, var) in enumerate(CA_ROOTS_VARS)
ENV[var] = string(i)
end
@test ca_roots() == "1"
@test ca_roots_path() == "1"
ENV[CA_ROOTS_VARS[1]] = ""
# set multiple CA_ROOT_VARS with increasing precedence
ENV["SSL_CERT_DIR"] = "3"
@test ca_roots() == ca_roots_path() == "3"
ENV["SSL_CERT_FILE"] = "2"
@test ca_roots() == ca_roots_path() == "2"
ENV["JULIA_SSL_CA_ROOTS_PATH"] = "1"
@test ca_roots() == ca_roots_path() == "1"
ENV["JULIA_SSL_CA_ROOTS_PATH"] = ""
@test ca_roots() == unset[1]
@test ca_roots_path() == unset[2]
clear_env()
Expand Down
Loading