From 3b65bb32fda7e34373b64f416ea92a3fa6eb266c Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 31 Aug 2009 19:11:07 +0200 Subject: Performance: don't call WinHttpGetProxyForUrl for a file URL (e.g. from webkit) That method can be slow, since it does a DHCP query followed by a DNS query (sometimes followed by a Netbios query, too)... no point in doing it for every file URL loaded in webkit. Merge-request: 1128 Reviewed-by: Thiago Macieira --- src/network/kernel/qnetworkproxy_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 34a702b..8080261 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -363,8 +363,13 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro if (sp->isAutoConfig) { WINHTTP_PROXY_INFO proxyInfo; - // try to get the proxy config for the URL, if we have a URL + // try to get the proxy config for the URL QUrl url = query.url(); + // url could be empty, e.g. from QNetworkProxy::applicationProxy(), that's fine, + // we'll still ask for the proxy. + // But for a file url, we know we don't need one. + if (url.scheme() == QLatin1String("file") || url.scheme() == QLatin1String("qrc")) + return sp->defaultResult; if (query.queryType() != QNetworkProxyQuery::UrlRequest) { // change the scheme to https, maybe it'll work url.setScheme(QLatin1String("https")); -- cgit v0.12