215 CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL);
217 qWarning(
"QNetworkProxyFactory::systemProxyForQuery: SCDynamicStoreCopyProxies returned NULL");
227 CFNumberRef pacEnabled;
228 if ((pacEnabled = (CFNumberRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigEnable))) {
230 if (CFNumberGetValue(pacEnabled, kCFNumberIntType, &enabled) && enabled) {
232 CFStringRef cfPacLocation = (
CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
234 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 237 QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
239 if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
245 QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
258 QCFType<CFURLRef> targetURL = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*)encodedURL.
data(), encodedURL.
size(), kCFStringEncodingUTF8, NULL);
264 QCFType<CFArrayRef> proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacScript, targetURL, &pacError);
272 CFIndex size = CFArrayGetCount(proxies);
273 for (CFIndex i = 0; i < size; ++i) {
274 CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxies, i);
282 qWarning(
"Mac system proxy: PAC script at \"%s\" not handled",
qPrintable(pacLocation));
288 bool isHttps =
false;
294 protocolSpecificProxy =
296 kSCPropNetProxiesFTPEnable,
297 kSCPropNetProxiesFTPProxy,
298 kSCPropNetProxiesFTPPort);
300 protocolSpecificProxy =
302 kSCPropNetProxiesHTTPEnable,
303 kSCPropNetProxiesHTTPProxy,
304 kSCPropNetProxiesHTTPPort);
307 protocolSpecificProxy =
309 kSCPropNetProxiesHTTPSEnable,
310 kSCPropNetProxiesHTTPSProxy,
311 kSCPropNetProxiesHTTPSPort);
314 result << protocolSpecificProxy;
318 kSCPropNetProxiesSOCKSEnable,
319 kSCPropNetProxiesSOCKSProxy,
320 kSCPropNetProxiesSOCKSPort);
328 kSCPropNetProxiesHTTPSEnable,
329 kSCPropNetProxiesHTTPSProxy,
330 kSCPropNetProxiesHTTPSPort);
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
const char * cfurlErrorDescription(SInt32 errorCode)
const struct __CFString * CFStringRef
char * data()
Returns a pointer to the data stored in the byte array.
QString peerHostName() const
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known.
The QByteArray class provides an array of bytes.
static QString toQString(CFStringRef cfstr)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QNetworkProxy class provides a network layer proxy.
QString protocolTag() const
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol...
Q_CORE_EXPORT void qWarning(const char *,...)
static bool isHostExcluded(CFDictionaryRef dict, const QString &host)
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
int size() const
Returns the number of bytes in this byte array.
QUrl url() const
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQ...
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict, QNetworkProxy::ProxyType type, CFStringRef enableKey, CFStringRef hostKey, CFStringRef portKey)
#define qPrintable(string)