Skip to content

Commit 1980bcc

Browse files
authored
feat: Specify TLS v1.2 as required minimum (#57)
TLS 1.1 has been deprecated for a long time and has been dropped by most major providers. The LaunchDarkly APIs haven't accepted anything lower than TLS 1.2 for a long time. We are therefore forcing TLS 1.2 as the minimum going forward in this library.
1 parent b016174 commit 1980bcc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Source/LDSwiftEventSource.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ public class EventSource {
8585
let sessionConfig = _urlSessionConfiguration.copy() as! URLSessionConfiguration
8686
sessionConfig.httpAdditionalHeaders = ["Accept": "text/event-stream", "Cache-Control": "no-cache"]
8787
sessionConfig.timeoutIntervalForRequest = idleTimeout
88+
89+
#if !os(Linux)
90+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
91+
sessionConfig.tlsMinimumSupportedProtocolVersion = .TLSv12
92+
} else {
93+
sessionConfig.tlsMinimumSupportedProtocol = .tlsProtocol12
94+
}
95+
#endif
8896
return sessionConfig
8997
}
9098
set {

0 commit comments

Comments
 (0)