Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions util/net/http_transport_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ static bool ExecuteProxyRequest(NSMutableURLRequest* request,
@"HTTPSEnable" : @YES,
@"HTTPSPort" : proxy_port,
@"HTTPSProxy" : hostNS,
#if !TARGET_OS_IOS
(__bridge id)kCFNetworkProxiesSOCKSEnable : @YES,
(__bridge id)kCFNetworkProxiesSOCKSPort : proxy_port,
(__bridge id)kCFNetworkProxiesSOCKSProxy : hostNS,
#endif
};
sessionConfig.connectionProxyDictionary = proxyDict;
NSURLSession* session =
Expand Down
7 changes: 6 additions & 1 deletion util/net/url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ bool CrackURL(const std::string& url,
size_t host_start;
static constexpr const char kHttp[] = "http://";
static constexpr const char kHttps[] = "https://";
static constexpr const char kSocks[] = "socks5://";
if (url.compare(0, strlen(kHttp), kHttp) == 0) {
result_scheme = "http";
result_port = "80";
Expand All @@ -61,8 +62,12 @@ bool CrackURL(const std::string& url,
result_scheme = "https";
result_port = "443";
host_start = strlen(kHttps);
} else if (url.compare(0, strlen(kSocks), kSocks) == 0) {
result_scheme = "socks5";
result_port = "1080";
host_start = strlen(kSocks);
} else {
LOG(ERROR) << "expecting http or https";
LOG(ERROR) << "expecting http, https or socks5";
return false;
}

Expand Down