Skip to content

Commit f2098eb

Browse files
authored
Merge pull request RustPython#1867 from RustPython/coolreader18/fix-openssl-vendor-certs
Fix openssl certificates not being found when openssl is vendored
2 parents bcc2946 + 984fcdc commit f2098eb

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ socket2 = { version = "0.3", features = ["unix"] }
9595
rustyline = "6.0"
9696
openssl = { version = "0.10", features = ["vendored"] }
9797
openssl-sys = "0.9"
98+
openssl-probe = "0.1"
9899

99100
[target.'cfg(not(any(target_arch = "wasm32", target_os = "redox")))'.dependencies]
100101
dns-lookup = "1.0"

vm/src/stdlib/ssl.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ fn parse_version_info(mut n: i64) -> (u8, u8, u8, u8, u8) {
740740
}
741741

742742
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
743+
// if openssl is vendored, it doesn't know the locations of system certificates
744+
match option_env!("OPENSSL_NO_VENDOR") {
745+
None | Some("0") => {}
746+
_ => openssl_probe::init_ssl_cert_env_vars(),
747+
}
743748
openssl::init();
744749
let ctx = &vm.ctx;
745750
let ssl_error = create_type(

0 commit comments

Comments
 (0)