Avoid small behaviour change in #550 (#551)

Motivation:

In #550 a use of `NIOSSLCertificafe(file:format:)` was replaced with
`NIOSSLCertificafe.loadPEMFile(_:).first`, which isn't necessarily the
same (the error flow is different for one). To avoid any subtle
behaioral changes revert back to the old API in that one instance.

Modifications:

- Use old API

Result:

Fewer behavioural changes
This commit is contained in:
George Barnett authored and GitHub committed 2025-07-15 13:16:38 +00:00
1 parent 5108dbdec9
commit 385f5bd783
2 files changed
+3 -4

No files matched your search

+1 -1
View File
@@ -106,7 +106,7 @@ public final class NIOSSLCertificate {
/// - parameters:
/// - file: The path to the file to load the certificate from.
/// - format: The format to use to parse the file.
private convenience init(_file file: String, format: NIOSSLSerializationFormats) throws {
internal convenience init(_file file: String, format: NIOSSLSerializationFormats) throws {
let fileObject = try Posix.fopen(file: file, mode: "rb")
defer {
fclose(fileObject)
+2 -3
View File
@@ -688,9 +688,8 @@ extension NIOSSLContext {
// Load only the certificates that resolve to an existing certificate in the directory.
for symPath in certificateFilePaths {
// c_rehash only support pem files.
if let cert = try NIOSSLCertificate.fromPEMFile(symPath).first {
try addCACertificateNameToList(context: context, certificate: cert)
}
let cert = try NIOSSLCertificate(_file: symPath, format: .pem)
try addCACertificateNameToList(context: context, certificate: cert)
}
}
}