Skip to content

Commit

Permalink
CBL-6191 : Fix null URL for proxy CONNECT request (#3324)
Browse files Browse the repository at this point in the history
NSURL cannot be created with only host and port anymore starting from iOS 17. Changed to use CFURLCreateWithString directly.
  • Loading branch information
pasin authored Aug 28, 2024
1 parent 49b5114 commit f0872ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Objective-C/Internal/Replicator/CBLHTTPLogic.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@ - (CFHTTPMessageRef) newHTTPRequest {
// Create the CFHTTPMessage:
CFHTTPMessageRef httpMsg;
if (_proxyType == kCBLHTTPProxy && _useProxyCONNECT) {
NSURL *requestURL = [NSURL URLWithString: $sprintf(@"%@:%d", url.host, url.my_effectivePort)];
NSString *destination = $sprintf(@"%@:%d", url.host, url.my_effectivePort);
CFURLRef requestURL = CFURLCreateWithString(kCFAllocatorDefault, (__bridge CFStringRef)destination, false);
httpMsg = CFHTTPMessageCreateRequest(NULL,
CFSTR("CONNECT"),
(__bridge CFURLRef)requestURL,
requestURL,
kCFHTTPVersion1_1);
CFRelease(requestURL);
} else {
httpMsg = CFHTTPMessageCreateRequest(NULL,
(__bridge CFStringRef)_urlRequest.HTTPMethod,
Expand Down

0 comments on commit f0872ec

Please sign in to comment.