NSURLRequest+SRWebSocket.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // Copyright 2012 Square Inc.
  3. // Portions Copyright (c) 2016-present, Facebook, Inc.
  4. //
  5. // All rights reserved.
  6. //
  7. // This source code is licensed under the BSD-style license found in the
  8. // LICENSE file in the root directory of this source tree. An additional grant
  9. // of patent rights can be found in the PATENTS file in the same directory.
  10. //
  11. #import "NSURLRequest+SRWebSocket.h"
  12. #import "NSURLRequest+SRWebSocketPrivate.h"
  13. // Required for object file to always be linked.
  14. void import_NSURLRequest_SRWebSocket() { }
  15. NS_ASSUME_NONNULL_BEGIN
  16. static NSString *const SRSSLPinnnedCertificatesKey = @"SocketRocket_SSLPinnedCertificates";
  17. @implementation NSURLRequest (SRWebSocket)
  18. - (nullable NSArray *)SR_SSLPinnedCertificates
  19. {
  20. return nil;
  21. }
  22. @end
  23. @implementation NSMutableURLRequest (SRWebSocket)
  24. - (void)setSR_SSLPinnedCertificates:(nullable NSArray *)SR_SSLPinnedCertificates
  25. {
  26. [NSException raise:NSInvalidArgumentException
  27. format:@"Using pinned certificates is neither secure nor supported in SocketRocket, "
  28. "and leads to security issues. Please use a proper, trust chain validated certificate."];
  29. }
  30. @end
  31. NS_ASSUME_NONNULL_END