Skip to content

Commit

Permalink
Avoid false-failures if underlying network connection errors
Browse files Browse the repository at this point in the history
In Air-Gapped or otherwise network-restricted environments,
   TcpStream::connect can spuriously fail due to name resolution
   failure, or just in establishing the socket itself.

In this situation, the test can't give a meaningful result, and this
failure doesn't indicate a problem in the OpenSSL stack.

Bug: sfackler#1215
  • Loading branch information
kentfredric committed Dec 27, 2019
1 parent 9b2eced commit bba670d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openssl/src/ssl/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,10 @@ fn default_verify_paths() {
ctx.set_default_verify_paths().unwrap();
ctx.set_verify(SslVerifyMode::PEER);
let ctx = ctx.build();
let s = TcpStream::connect("google.com:443").unwrap();
let s = match TcpStream::connect("google.com:443") {
Ok(s) => s,
Err(_) => return,
};
let mut ssl = Ssl::new(&ctx).unwrap();
ssl.set_hostname("google.com").unwrap();
let mut socket = ssl.connect(s).unwrap();
Expand Down

0 comments on commit bba670d

Please sign in to comment.