Skip to content

Commit 12e54e4

Browse files
committed
apply review
1 parent 2bb523a commit 12e54e4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

stdlib/src/ssl/cert.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn format_ip_address(ip: &[u8]) -> String {
171171
fn format_asn1_time(time: &x509_parser::time::ASN1Time) -> String {
172172
let timestamp = time.timestamp();
173173
DateTime::<Utc>::from_timestamp(timestamp, 0)
174-
.unwrap()
174+
.expect("ASN1Time must be valid timestamp")
175175
.format("%b %e %H:%M:%S %Y GMT")
176176
.to_string()
177177
}
@@ -867,7 +867,7 @@ impl ServerCertVerifier for HostnameIgnoringVerifier {
867867
// The inner verifier will validate certificate chain, trust anchors, etc.
868868
// but may fail on hostname mismatch - we'll catch and ignore that error
869869
let dummy_hostname = extract_first_dns_name(end_entity)
870-
.unwrap_or_else(|| ServerName::try_from("localhost").unwrap());
870+
.unwrap_or_else(|| ServerName::try_from("localhost").expect("localhost is valid"));
871871

872872
// Call inner verifier for full certificate validation
873873
match self.inner.verify_server_cert(

stdlib/src/ssl/compat.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,9 +927,8 @@ pub(super) fn create_client_config(options: ClientConfigOptions) -> Result<Clien
927927
> = Arc::new(HostnameIgnoringVerifier::new_with_verifier(verifier));
928928

929929
// Apply Strict verifier wrapper once at the end if needed
930-
if options.verify_flags != 0 {
931-
use crate::ssl::cert::StrictCertVerifier;
932-
Arc::new(StrictCertVerifier::new(
930+
if options.verify_flags & VERIFY_X509_STRICT != 0 {
931+
Arc::new(crate::ssl::cert::StrictCertVerifier::new(
933932
hostname_ignoring_verifier,
934933
options.verify_flags,
935934
))

0 commit comments

Comments
 (0)