-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
clear out cache variables when loading the package #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ const BSD_CA_ROOTS = [ | |
] | ||
|
||
const SYSTEM_CA_ROOTS_LOCK = ReentrantLock() | ||
const SYSTEM_CA_ROOTS = Ref{String}() | ||
const SYSTEM_CA_ROOTS = Ref{Union{String,Nothing}}(nothing) | ||
|
||
const BEGIN_CERT_REGULAR = "-----BEGIN CERTIFICATE-----" | ||
const BEGIN_CERT_OPENSSL = "-----BEGIN TRUSTED CERTIFICATE-----" | ||
|
@@ -84,29 +84,34 @@ NetworkOptions could only find OpenSSL-specific TLS certificates which cannot be | |
|
||
function system_ca_roots() | ||
lock(SYSTEM_CA_ROOTS_LOCK) do | ||
isassigned(SYSTEM_CA_ROOTS) && return # from lock() | ||
search_path = Sys.islinux() ? LINUX_CA_ROOTS : | ||
Sys.isbsd() && !Sys.isapple() ? BSD_CA_ROOTS : String[] | ||
openssl_only = false | ||
for path in search_path | ||
ispath(path) || continue | ||
for line in eachline(path) | ||
if line == BEGIN_CERT_REGULAR | ||
SYSTEM_CA_ROOTS[] = path | ||
return # from lock() | ||
elseif line == BEGIN_CERT_OPENSSL | ||
openssl_only = true | ||
roots = SYSTEM_CA_ROOTS[] | ||
if roots === nothing | ||
search_path = Sys.islinux() ? LINUX_CA_ROOTS : | ||
Sys.isbsd() && !Sys.isapple() ? BSD_CA_ROOTS : String[] | ||
openssl_only = false | ||
for path in search_path | ||
ispath(path) || continue | ||
for line in eachline(path) | ||
if line == BEGIN_CERT_REGULAR | ||
roots = path | ||
openssl_only = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this change more of the logic than just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll change it back, I just wanted it to be more similar to how it was changed in BUNDLED_KNOWN_HOSTS_FILE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine, I just wasn't sure about the openssl_only part, which looks like a logic change to me. |
||
break | ||
elseif line == BEGIN_CERT_OPENSSL | ||
openssl_only = true | ||
end | ||
end | ||
end | ||
# warn if we: | ||
# 1. did not find any regular certs | ||
# 2. did find OpenSSL-only certs | ||
openssl_only && @warn OPENSSL_WARNING | ||
# TODO: extract system certs on Windows & macOS | ||
if roots === nothing | ||
roots = bundled_ca_roots() | ||
end | ||
end | ||
# warn if we: | ||
# 1. did not find any regular certs | ||
# 2. did find OpenSSL-only certs | ||
openssl_only && @warn OPENSSL_WARNING | ||
# TODO: extract system certs on Windows & macOS | ||
SYSTEM_CA_ROOTS[] = bundled_ca_roots() | ||
return SYSTEM_CA_ROOTS[] = roots::String | ||
end | ||
return SYSTEM_CA_ROOTS[] | ||
end | ||
|
||
const CA_ROOTS_VARS = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pickiest of nits. Just because the other one has the space.