Skip to content

Commit 385f5bd

Browse files
authored
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
1 parent 5108dbd commit 385f5bd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Sources/NIOSSL/SSLCertificate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public final class NIOSSLCertificate {
106106
/// - parameters:
107107
/// - file: The path to the file to load the certificate from.
108108
/// - format: The format to use to parse the file.
109-
private convenience init(_file file: String, format: NIOSSLSerializationFormats) throws {
109+
internal convenience init(_file file: String, format: NIOSSLSerializationFormats) throws {
110110
let fileObject = try Posix.fopen(file: file, mode: "rb")
111111
defer {
112112
fclose(fileObject)

Sources/NIOSSL/SSLContext.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,8 @@ extension NIOSSLContext {
688688
// Load only the certificates that resolve to an existing certificate in the directory.
689689
for symPath in certificateFilePaths {
690690
// c_rehash only support pem files.
691-
if let cert = try NIOSSLCertificate.fromPEMFile(symPath).first {
692-
try addCACertificateNameToList(context: context, certificate: cert)
693-
}
691+
let cert = try NIOSSLCertificate(_file: symPath, format: .pem)
692+
try addCACertificateNameToList(context: context, certificate: cert)
694693
}
695694
}
696695
}

0 commit comments

Comments
 (0)