Fix proxies by reverting the change that introduced schemes. (#4481)

This partially reverts commit 863f28d476.
This commit is contained in:
Doug
2025-09-08 12:03:41 +01:00
committed by GitHub
parent ed61e6af32
commit f59928f4d5
+6 -33
View File
@@ -114,18 +114,7 @@ extension URL {
} }
MXLog.info("Found \(String(describing: proxies?.count)) proxies, using the first one.") MXLog.info("Found \(String(describing: proxies?.count)) proxies, using the first one.")
MXLog.info("Proxy type is \(proxyType)")
if proxyType == kCFProxyTypeAutoConfigurationURL as String {
MXLog.info("Found proxy auto configuration")
if let pacURL = firstProxy[kCFProxyAutoConfigurationURLKey] as? String {
MXLog.info("Retrieved global PAC URL: \(pacURL)")
return pacURL
} else {
MXLog.info("Failed retrieving PAC URL")
}
} else {
MXLog.info("Proxy type found as \(proxyType)")
guard let host = firstProxy[kCFProxyHostNameKey] as? String else { guard let host = firstProxy[kCFProxyHostNameKey] as? String else {
MXLog.error("Found proxy with invalid host name") MXLog.error("Found proxy with invalid host name")
@@ -134,29 +123,13 @@ extension URL {
let port = firstProxy[kCFProxyPortNumberKey] as? Int let port = firstProxy[kCFProxyPortNumberKey] as? Int
let scheme: String? = if proxyType == kCFProxyTypeHTTP as String { MXLog.info("Found proxy host: \(host), port: \(String(describing: port))")
"http"
} else if proxyType == kCFProxyTypeHTTPS as String { if let port {
"https" return "\(host):\(port)"
} else if proxyType == kCFProxyTypeSOCKS as String {
"socks"
} else { } else {
nil return host
} }
var components = URLComponents()
components.scheme = scheme
components.host = host
components.port = port
MXLog.info("Found proxy components: \(String(describing: scheme)), \(host), \(String(describing: port))")
MXLog.info("Retrieved global proxy: \(String(describing: components.url))")
return components.url?.absoluteString
}
return nil
} }
// MARK: Mocks // MARK: Mocks