Commit 9317c752 authored by Pierre Rossi's avatar Pierre Rossi
Browse files

Revert "Introduce ProxyResolverQt"

This reverts commit 0e006b8e

.
The workaround is not needed anymore since the v8 proxy resolver
is now used by default.

Change-Id: Ifea4ca6c6a0b0442cc1d8d22b1eb1553f3319524
Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Showing with 12 additions and 198 deletions
...@@ -61,7 +61,6 @@ SOURCES = \ ...@@ -61,7 +61,6 @@ SOURCES = \
permission_manager_qt.cpp \ permission_manager_qt.cpp \
process_main.cpp \ process_main.cpp \
proxy_config_service_qt.cpp \ proxy_config_service_qt.cpp \
proxy_resolver_qt.cpp \
qrc_protocol_handler_qt.cpp \ qrc_protocol_handler_qt.cpp \
qt_render_view_observer_host.cpp \ qt_render_view_observer_host.cpp \
render_widget_host_view_qt.cpp \ render_widget_host_view_qt.cpp \
...@@ -133,7 +132,6 @@ HEADERS = \ ...@@ -133,7 +132,6 @@ HEADERS = \
permission_manager_qt.h \ permission_manager_qt.h \
process_main.h \ process_main.h \
proxy_config_service_qt.h \ proxy_config_service_qt.h \
proxy_resolver_qt.h \
qrc_protocol_handler_qt.h \ qrc_protocol_handler_qt.h \
qt_render_view_observer_host.h \ qt_render_view_observer_host.h \
render_widget_host_view_qt.h \ render_widget_host_view_qt.h \
......
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "proxy_config_service_qt.h" #include "proxy_config_service_qt.h"
#include "proxy_resolver_qt.h"
#include "base/bind.h" #include "base/bind.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -107,15 +105,9 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy ...@@ -107,15 +105,9 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy
return CONFIG_VALID; return CONFIG_VALID;
} }
m_qtApplicationProxy = qtProxy; m_qtApplicationProxy = qtProxy;
m_qtProxyConfig = (systemAvailability == CONFIG_VALID) ? systemConfig : net::ProxyConfig(); m_qtProxyConfig = net::ProxyConfig();
const bool useProxyResolver = ProxyResolverQt::useProxyResolverQt();
if (qtProxy.type() == QNetworkProxy::NoProxy) { if (qtProxy.type() == QNetworkProxy::NoProxy) {
*config = systemConfig; *config = systemConfig;
if (useProxyResolver) {
config->set_auto_detect(true);
config->set_pac_mandatory(true);
}
return systemAvailability; return systemAvailability;
} }
...@@ -140,10 +132,6 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy ...@@ -140,10 +132,6 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy
} }
m_qtProxyConfig.proxy_rules() = qtRules; m_qtProxyConfig.proxy_rules() = qtRules;
if (useProxyResolver) {
m_qtProxyConfig.set_pac_mandatory(true);
m_qtProxyConfig.set_auto_detect(true);
}
*config = m_qtProxyConfig; *config = m_qtProxyConfig;
return CONFIG_VALID; return CONFIG_VALID;
} }
......
/****************************************************************************
**
** 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;
}
/****************************************************************************
**
** 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
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
#include "content_client_qt.h" #include "content_client_qt.h"
#include "network_delegate_qt.h" #include "network_delegate_qt.h"
#include "proxy_config_service_qt.h" #include "proxy_config_service_qt.h"
#include "proxy_resolver_qt.h"
#include "qrc_protocol_handler_qt.h" #include "qrc_protocol_handler_qt.h"
#include "qwebenginecookiestoreclient.h" #include "qwebenginecookiestoreclient.h"
#include "qwebenginecookiestoreclient_p.h" #include "qwebenginecookiestoreclient_p.h"
...@@ -165,21 +164,17 @@ void URLRequestContextGetterQt::generateStorage() ...@@ -165,21 +164,17 @@ void URLRequestContextGetterQt::generateStorage()
// The System Proxy Resolver has issues on Windows with unconfigured network cards, // The System Proxy Resolver has issues on Windows with unconfigured network cards,
// which is why we want to use the v8 one // which is why we want to use the v8 one
if (ProxyResolverQt::useProxyResolverQt()) { if (!m_dhcpProxyScriptFetcherFactory)
scoped_ptr<ProxyResolverFactoryQt> factory(new ProxyResolverFactoryQt(false)); m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory);
m_storage->set_proxy_service(new net::ProxyService(proxyConfigService, factory.Pass(), nullptr));
} else { m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver(
if (!m_dhcpProxyScriptFetcherFactory) proxyConfigService,
m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()),
m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()),
m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver( host_resolver.get(),
proxyConfigService, NULL /* NetLog */,
new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()), m_networkDelegate.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_ssl_config_service(new net::SSLConfigServiceDefaults);
m_storage->set_transport_security_state(new net::TransportSecurityState()); m_storage->set_transport_security_state(new net::TransportSecurityState());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment