From 9317c7525ebd5f581ee19fb9123823820b54ce13 Mon Sep 17 00:00:00 2001 From: Pierre Rossi <pierre.rossi@theqtcompany.com> Date: Fri, 14 Aug 2015 18:02:12 +0200 Subject: [PATCH] Revert "Introduce ProxyResolverQt" This reverts commit 0e006b8ea755ebad01faf3e747e61abdf158289a. The workaround is not needed anymore since the v8 proxy resolver is now used by default. Change-Id: Ifea4ca6c6a0b0442cc1d8d22b1eb1553f3319524 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/core/core_gyp_generator.pro | 2 - src/core/proxy_config_service_qt.cpp | 14 +--- src/core/proxy_resolver_qt.cpp | 93 ---------------------- src/core/proxy_resolver_qt.h | 74 ----------------- src/core/url_request_context_getter_qt.cpp | 27 +++---- 5 files changed, 12 insertions(+), 198 deletions(-) delete mode 100644 src/core/proxy_resolver_qt.cpp delete mode 100644 src/core/proxy_resolver_qt.h diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 1a2679a60..f2834946f 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -61,7 +61,6 @@ SOURCES = \ permission_manager_qt.cpp \ process_main.cpp \ proxy_config_service_qt.cpp \ - proxy_resolver_qt.cpp \ qrc_protocol_handler_qt.cpp \ qt_render_view_observer_host.cpp \ render_widget_host_view_qt.cpp \ @@ -133,7 +132,6 @@ HEADERS = \ permission_manager_qt.h \ process_main.h \ proxy_config_service_qt.h \ - proxy_resolver_qt.h \ qrc_protocol_handler_qt.h \ qt_render_view_observer_host.h \ render_widget_host_view_qt.h \ diff --git a/src/core/proxy_config_service_qt.cpp b/src/core/proxy_config_service_qt.cpp index 933b1a10e..fc0959eef 100644 --- a/src/core/proxy_config_service_qt.cpp +++ b/src/core/proxy_config_service_qt.cpp @@ -39,8 +39,6 @@ #include "proxy_config_service_qt.h" -#include "proxy_resolver_qt.h" - #include "base/bind.h" #include "content/public/browser/browser_thread.h" @@ -107,15 +105,9 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy return CONFIG_VALID; } m_qtApplicationProxy = qtProxy; - m_qtProxyConfig = (systemAvailability == CONFIG_VALID) ? systemConfig : net::ProxyConfig(); - const bool useProxyResolver = ProxyResolverQt::useProxyResolverQt(); - + m_qtProxyConfig = net::ProxyConfig(); if (qtProxy.type() == QNetworkProxy::NoProxy) { *config = systemConfig; - if (useProxyResolver) { - config->set_auto_detect(true); - config->set_pac_mandatory(true); - } return systemAvailability; } @@ -140,10 +132,6 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy } m_qtProxyConfig.proxy_rules() = qtRules; - if (useProxyResolver) { - m_qtProxyConfig.set_pac_mandatory(true); - m_qtProxyConfig.set_auto_detect(true); - } *config = m_qtProxyConfig; return CONFIG_VALID; } diff --git a/src/core/proxy_resolver_qt.cpp b/src/core/proxy_resolver_qt.cpp deleted file mode 100644 index 9db76e910..000000000 --- a/src/core/proxy_resolver_qt.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "proxy_resolver_qt.h" - -#include "proxy_config_service_qt.h" -#include "type_conversion.h" - -#include "net/base/load_states.h" -#include "net/base/net_errors.h" -#include "net/proxy/proxy_info.h" - -#include <QNetworkProxyFactory> -#include <QNetworkProxyQuery> - -ProxyResolverQt::ProxyResolverQt() - : net::ProxyResolver(/*expects_pac_bytes = */ false) -{ -} - -int ProxyResolverQt::GetProxyForURL(const GURL &url, net::ProxyInfo *results, const net::CompletionCallback &, net::ProxyResolver::RequestHandle *, const net::BoundNetLog &) -{ - QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(QtWebEngineCore::toQt(url))); - if (proxies.empty()) - return net::ERR_FAILED; - if (proxies.size() == 1) { - const QNetworkProxy &qtProxy = proxies.first(); - if (qtProxy.type() == QNetworkProxy::NoProxy) - results->UseDirect(); - else - results->UseProxyServer(ProxyConfigServiceQt::fromQNetworkProxy(qtProxy)); - return net::OK; - } - net::ProxyList proxyList; - Q_FOREACH (const QNetworkProxy &qtProxy, proxies) - proxyList.AddProxyServer(ProxyConfigServiceQt::fromQNetworkProxy(qtProxy)); - results->UseProxyList(proxyList); - return net::OK; -} - -void ProxyResolverQt::CancelRequest(net::ProxyResolver::RequestHandle) -{ - // This is a synchronous ProxyResolver; no possibility for async requests. - NOTREACHED(); -} - -net::LoadState ProxyResolverQt::GetLoadState(net::ProxyResolver::RequestHandle) const -{ - NOTREACHED(); - return net::LOAD_STATE_IDLE; -} - -void ProxyResolverQt::CancelSetPacScript() -{ - NOTREACHED(); -} - -int ProxyResolverQt::SetPacScript(const scoped_refptr<net::ProxyResolverScriptData> &, const net::CompletionCallback &) { - return net::OK; -} diff --git a/src/core/proxy_resolver_qt.h b/src/core/proxy_resolver_qt.h deleted file mode 100644 index 4d419fb6e..000000000 --- a/src/core/proxy_resolver_qt.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PROXY_RESOLVER_QT_H -#define PROXY_RESOLVER_QT_H - -#include "net/proxy/proxy_resolver.h" -#include "net/proxy/proxy_resolver_factory.h" -#include <qglobal.h> - - -class ProxyResolverQt : public net::ProxyResolver { -public: - static bool useProxyResolverQt() { return qEnvironmentVariableIsSet("QTWEBENGINE_USE_QT_PROXYRESOLVER"); } - - ProxyResolverQt(); - - int GetProxyForURL(const GURL &url, net::ProxyInfo *results, const net::CompletionCallback & - , RequestHandle*, const net::BoundNetLog&) override; - - void CancelRequest(RequestHandle) override; - - net::LoadState GetLoadState(RequestHandle) const override; - - void CancelSetPacScript() override; - - int SetPacScript(const scoped_refptr<net::ProxyResolverScriptData>& /*script_data*/, const net::CompletionCallback& /*callback*/) override; -}; - -class ProxyResolverFactoryQt : public net::LegacyProxyResolverFactory { -public: - ProxyResolverFactoryQt(bool expects_pac_bytes) : net::LegacyProxyResolverFactory(expects_pac_bytes) - { - } - scoped_ptr<net::ProxyResolver> CreateProxyResolver() override - { - return scoped_ptr<net::ProxyResolver>(new ProxyResolverQt()); - } -}; - -#endif // PROXY_RESOLVER_QT_H diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index a50fcbe0e..c9ebf7f3b 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -73,7 +73,6 @@ #include "content_client_qt.h" #include "network_delegate_qt.h" #include "proxy_config_service_qt.h" -#include "proxy_resolver_qt.h" #include "qrc_protocol_handler_qt.h" #include "qwebenginecookiestoreclient.h" #include "qwebenginecookiestoreclient_p.h" @@ -165,21 +164,17 @@ void URLRequestContextGetterQt::generateStorage() // The System Proxy Resolver has issues on Windows with unconfigured network cards, // which is why we want to use the v8 one - if (ProxyResolverQt::useProxyResolverQt()) { - scoped_ptr<ProxyResolverFactoryQt> factory(new ProxyResolverFactoryQt(false)); - m_storage->set_proxy_service(new net::ProxyService(proxyConfigService, factory.Pass(), nullptr)); - } else { - if (!m_dhcpProxyScriptFetcherFactory) - m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); - - m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver( - proxyConfigService, - new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()), - m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()), - host_resolver.get(), - NULL /* NetLog */, - m_networkDelegate.get())); - } + if (!m_dhcpProxyScriptFetcherFactory) + m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); + + m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver( + proxyConfigService, + new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()), + m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()), + host_resolver.get(), + NULL /* NetLog */, + m_networkDelegate.get())); + m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); m_storage->set_transport_security_state(new net::TransportSecurityState()); -- GitLab