42static bool isExcluded(QStringView host, QStringView entry)
44 QStringView token = entry.trimmed();
47 if (token.size() == 1 && token.front() == u'*')
50 if (token.startsWith(u'*'))
51 token = token.sliced(1);
52 if (token.endsWith(u'.') && !host.endsWith(u'.'))
53 token = token.chopped(1);
54 if (token.startsWith(u'.'))
55 token = token.sliced(1);
57 if (token.isEmpty() || !host.endsWith(token, Qt::CaseInsensitive))
61 return (host.size() == token.size()) || (host[host.size() - token.size() - 1] == u'.');
64QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(
const QNetworkProxyQuery &query)
66 QList<QNetworkProxy> proxyList;
67 if (!proxyInfoInstance)
70 QJniObject proxyInfo = QtNetwork::callStaticMethod<ProxyInfo>(
"getProxyInfo",
71 QAndroidApplication::context());
72 if (proxyInfo.isValid()) {
73 const QJniArray exclusionList = proxyInfo.callMethod<String[]>(
"getExclusionList");
75 if (exclusionList.isValid()) {
76 const QString host = query.peerHostName();
77 for (
const auto &entry : exclusionList) {
78 if (isExcluded(host, entry.toString())) {
85 const QString hostName = proxyInfo.callMethod<QString>(
"getHost");
86 const int port = proxyInfo.callMethod<jint>(
"getPort");
87 QNetworkProxy proxy(QNetworkProxy::HttpProxy, hostName, port);
91 if (proxyList.isEmpty())
92 proxyList << QNetworkProxy::NoProxy;