Skip to content

Commit

Permalink
Merge pull request #749 from YellEngineering/feature/fix-foundation-t…
Browse files Browse the repository at this point in the history
…ransport-tls

Enable SSL in FoundationTransport for secure hosts
  • Loading branch information
daltoniam authored Apr 4, 2020
2 parents 4e8dca6 + 97538bc commit 9e8fcba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Transport/FoundationTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ public class FoundationTransport: NSObject, Transport, StreamDelegate {
inStream.delegate = self
outStream.delegate = self

if isTLS {
let key = CFStreamPropertyKey(rawValue: kCFStreamPropertySocketSecurityLevel)
CFReadStreamSetProperty(inStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL)
CFWriteStreamSetProperty(outStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL)
}

onConnect?(inStream, outStream)

isOpen = false
Expand Down

0 comments on commit 9e8fcba

Please sign in to comment.