Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › crypto › tls › Client › tryDownloadRootCert Private Function tryDownloadRootCert Doc Source Private Function std.crypto.tls.Client.tryDownloadRootCert
fn tryDownloadRootCert (chain : *Certificate .Chain , options : *const Options ) !void Params File crypto/tls/Client.zig: 1606
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628 fn tryDownloadRootCert (chain : *Certificate .Chain , options : *const Options ) !void {
if (Certificate .Chain != void ) switch (options .ca ) {
else => {},
.bundle => |ca | {
chain .verify (options .realtime_now ) catch |err | switch (err ) {
error .Unexpected => return error .TlsCertificateNotVerified ,
else => |e | return e ,
};
var bundle : Certificate .Bundle = .empty ;
defer bundle .deinit (ca .gpa );
if (bundle .rescan (ca .gpa , ca .io , options .realtime_now )) {
try ca .lock .lock (ca .io );
defer ca .lock .unlock (ca .io );
std .mem .swap (Certificate .Bundle , ca .bundle , &bundle );
} else |err | switch (err ) {
error .Canceled => |e | return e ,
else => {},
}
return ; // the os has verified the certificate for us
},
};
return error .TlsCertificateNotVerified ;
}