6#include <QtCore/QByteArray>
9#ifndef QT_NO_NETWORKPROXY
23 if (noProxy.isEmpty())
28 const QList<QByteArray> noProxyTokens = noProxy.
split(
',');
30 for (
const QByteArray &rawToken : noProxyTokens) {
34 if (
token.startsWith(u
'*'))
41 if (
token.startsWith(u
'.'))
51 if (host[host.
size() -
token.size() - 1] == u
'.')
61 QList<QNetworkProxy> proxyList;
70 if (queryProtocol ==
"http"_L1)
71 proxy_env =
qgetenv(
"http_proxy");
72 else if (queryProtocol ==
"https"_L1)
73 proxy_env =
qgetenv(
"https_proxy");
74 else if (queryProtocol ==
"ftp"_L1)
75 proxy_env =
qgetenv(
"ftp_proxy");
77 proxy_env =
qgetenv(
"all_proxy");
80 if (proxy_env.isEmpty())
81 proxy_env =
qgetenv(
"http_proxy");
83 if (!proxy_env.isEmpty()) {
86 if (scheme ==
"socks5"_L1) {
90 }
else if (scheme ==
"socks5h"_L1) {
95 }
else if ((scheme.
isEmpty() || scheme ==
"http"_L1)
103 if (proxyList.isEmpty())
QLatin1StringView trimmed() const noexcept
static QList< QNetworkProxy > systemProxyForQuery(const QNetworkProxyQuery &query=QNetworkProxyQuery())
This function takes the query request, query, examines the details of the type of socket or request a...
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
The QNetworkProxy class provides a network layer proxy.
void setCapabilities(Capabilities capab)
@ HostNameLookupCapability
\macro QT_RESTRICTED_CAST_FROM_ASCII
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
int port(int defaultPort=-1) const
Combined button and popup list for selecting options.
static bool ignoreProxyFor(const QNetworkProxyQuery &query)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QUrl url("example.com")
[constructor-url-reference]