Skip to content

Commit

Permalink
Silence intentional deprecation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko committed Jun 28, 2023
1 parent 8a4c5d5 commit c54ffab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions SocketRocket/SRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ - (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NS
- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NSString *> *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates
{
SRSecurityPolicy *securityPolicy;
BOOL certificateChainValidationEnabled = !allowsUntrustedSSLCertificates;

NSArray *pinnedCertificates = request.SR_SSLPinnedCertificates;
if (pinnedCertificates) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"

securityPolicy = [[SRSecurityPolicy alloc] initWithCertificateChainValidationEnabled:certificateChainValidationEnabled];

securityPolicy = [SRSecurityPolicy pinnningPolicyWithCertificates:pinnedCertificates];
#pragma clang diagnostic pop
} else {
BOOL certificateChainValidationEnabled = !allowsUntrustedSSLCertificates;
securityPolicy = [[SRSecurityPolicy alloc] initWithCertificateChainValidationEnabled:certificateChainValidationEnabled];
}

return [self initWithURLRequest:request protocols:protocols securityPolicy:securityPolicy];
}
Expand Down

0 comments on commit c54ffab

Please sign in to comment.