summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 3fcd9299f3..e4d2663f7a 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -203,6 +203,15 @@ void proxyAutoConfigCallback(void *client, CFArrayRef proxylist, CFErrorRef erro
info->proxies = proxylist;
}
}
+
+QCFType<CFStringRef> stringByAddingPercentEscapes(CFStringRef originalPath)
+{
+ Q_ASSERT(originalPath);
+ const auto qtPath = QString::fromCFString(originalPath);
+ const auto escaped = QString::fromUtf8(QUrl::toPercentEncoding(qtPath));
+ return escaped.toCFString();
+}
+
} // anon namespace
QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
@@ -228,9 +237,7 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
// kSCPropNetProxiesProxyAutoConfigURLString returns the URL string
// as entered in the system proxy configuration dialog
CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
- QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
- kCFStringEncodingUTF8);
-
+ auto cfPacLocation = stringByAddingPercentEscapes(pacLocationSetting);
QCFType<CFDataRef> pacData;
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
if (!pacUrl) {