summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qnetworkproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/kernel/qnetworkproxy.cpp')
-rw-r--r--src/network/kernel/qnetworkproxy.cpp66
1 files changed, 18 insertions, 48 deletions
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 75f81a0037..62bba24bce 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*!
@@ -189,7 +153,7 @@
QNetworkProxy sets different capabilities by default when the
object is created (see QNetworkProxy::ProxyType for a list of the
- defaults). However, it is possible to change the capabitilies
+ defaults). However, it is possible to change the capabilities
after the object has been created with setCapabilities().
The capabilities that QNetworkProxy supports are:
@@ -243,6 +207,10 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN(QNetworkProxy)
+
class QSocks5SocketEngineHandler;
class QHttpSocketEngineHandler;
@@ -354,10 +322,8 @@ QList<QNetworkProxy> QGlobalNetworkProxy::proxyForQuery(const QNetworkProxyQuery
// don't look for proxies for a local connection
QHostAddress parsed;
QString hostname = query.url().host();
- if (hostname == QLatin1String("localhost")
- || hostname.startsWith(QLatin1String("localhost."))
- || (parsed.setAddress(hostname)
- && (parsed.isLoopback()))) {
+ if (hostname == "localhost"_L1 || hostname.startsWith("localhost."_L1)
+ || (parsed.setAddress(hostname) && (parsed.isLoopback()))) {
result << QNetworkProxy(QNetworkProxy::NoProxy);
return result;
}
@@ -1500,13 +1466,18 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
Internet Explorer's settings and use them.
On \macos, this function will obtain the proxy settings using the
- SystemConfiguration framework from Apple. It will apply the FTP,
+ CFNetwork framework from Apple. It will apply the FTP,
HTTP and HTTPS proxy configurations for queries that contain the
protocol tag "ftp", "http" and "https", respectively. If the SOCKS
proxy is enabled in that configuration, this function will use the
SOCKS server for all queries. If SOCKS isn't enabled, it will use
the HTTPS proxy for all TcpSocket and UrlRequest queries.
+ On systems configured with libproxy support, this function will
+ rely on libproxy to obtain the proxy settings. Depending on
+ libproxy configurations, this can in turn delegate to desktop
+ settings, environment variables, etc.
+
On other systems, this function will pick up proxy settings from
the "http_proxy" environment variable. This variable must be a URL
using one of the following schemes: "http", "socks5" or "socks5h".
@@ -1518,9 +1489,6 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
listed here.
\list
- \li On \macos, this function will ignore the Proxy Auto Configuration
- settings, since it cannot execute the associated ECMAScript code.
-
\li On Windows platforms, this function may take several seconds to
execute depending on the configuration of the user's system.
\endlist
@@ -1585,7 +1553,7 @@ QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
scaps << QStringLiteral("SctpTunnel");
if (caps & QNetworkProxy::SctpListeningCapability)
scaps << QStringLiteral("SctpListen");
- debug << '[' << scaps.join(QLatin1Char(' ')) << ']';
+ debug << '[' << scaps.join(u' ') << ']';
return debug;
}
@@ -1607,4 +1575,6 @@ QDebug operator<<(QDebug debug, const QNetworkProxyQuery &proxyQuery)
QT_END_NAMESPACE
+#include "moc_qnetworkproxy.cpp"
+
#endif // QT_NO_NETWORKPROXY