SRURLUtilities.h 923 B

1234567891011121314151617181920212223242526
  1. //
  2. // Copyright (c) 2016-present, Facebook, Inc.
  3. // All rights reserved.
  4. //
  5. // This source code is licensed under the BSD-style license found in the
  6. // LICENSE file in the root directory of this source tree. An additional grant
  7. // of patent rights can be found in the PATENTS file in the same directory.
  8. //
  9. #import <Foundation/Foundation.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. // The origin isn't really applicable for a native application.
  12. // So instead, just map ws -> http and wss -> https.
  13. extern NSString *SRURLOrigin(NSURL *url);
  14. extern BOOL SRURLRequiresSSL(NSURL *url);
  15. // Extracts `user` and `password` from url (if available) into `Basic base64(user:password)`.
  16. extern NSString *_Nullable SRBasicAuthorizationHeaderFromURL(NSURL *url);
  17. // Returns a valid value for `NSStreamNetworkServiceType` or `nil`.
  18. extern NSString *_Nullable SRStreamNetworkServiceTypeFromURLRequest(NSURLRequest *request);
  19. NS_ASSUME_NONNULL_END