Skip to content

Commit

Permalink
* websocket crash with the core foundation SSL settings (#2574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayahariv authored Nov 8, 2019
1 parent 9f7a4c2 commit 2106538
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Objective-C/Internal/Replicator/CBLWebSocket.mm
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,19 @@ - (void) configureTLS {
_checkSSLCert = false;
if (_logic.useTLS) {
CBLLogVerbose(WebSocket, @"%@ enabling TLS", self);
auto settings = CFDictionaryCreateMutable(nullptr, 0, nullptr, nullptr);
if (_connectedThruProxy) {
CFDictionarySetValue(settings, kCFStreamSSLPeerName,
(__bridge CFStringRef)_logic.directHost);
}
NSMutableDictionary* settings = [NSMutableDictionary dictionary];
if (_connectedThruProxy)
[settings setObject: _logic.directHost
forKey: (__bridge id)kCFStreamSSLPeerName];

if (_options[kC4ReplicatorOptionPinnedServerCert])
CFDictionarySetValue(settings, kCFStreamSSLValidatesCertificateChain,
kCFBooleanFalse);
CFReadStreamSetProperty((__bridge CFReadStreamRef)_in,
kCFStreamPropertySSLSettings, settings);
CFRelease(settings);
[settings setObject: @NO
forKey: (__bridge id)kCFStreamSSLValidatesCertificateChain];

if (![_in setProperty: settings
forKey: (__bridge NSString *)kCFStreamPropertySSLSettings]) {
CBLWarnError(WebSocket, @"%@ failed to set SSL settings", self);
}
_checkSSLCert = true;
}
}
Expand Down

0 comments on commit 2106538

Please sign in to comment.