kernel/qnetworkproxy_generic.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4static bool ignoreProxyFor(const QNetworkProxyQuery &query) -
5{ -
6 const QList<QByteArray> noProxyTokens = qgetenv("no_proxy").split(','); -
7 -
8 for (QForeachContainer<__typeof__(noProxyTokens)> _container_(noProxyTokens); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QByteArray &rawToken = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
9 QByteArray token = rawToken.trimmed(); -
10 QString peerHostName = query.peerHostName(); -
11 -
12 -
13 if (token.startsWith("*"))
partially evaluated: token.startsWith("*")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
14 token = token.mid(1);
never executed: token = token.mid(1);
0
15 -
16 -
17 if (token.endsWith('.') && !peerHostName.endsWith('.'))
partially evaluated: token.endsWith('.')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
never evaluated: !peerHostName.endsWith('.')
0-41
18 token = token.left(token.length()-1);
never executed: token = token.left(token.length()-1);
0
19 -
20 -
21 -
22 if (!token.startsWith('.'))
partially evaluated: !token.startsWith('.')
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
23 token.prepend('.');
executed: token.prepend('.');
Execution Count:41
41
24 -
25 if (!peerHostName.startsWith('.'))
partially evaluated: !peerHostName.startsWith('.')
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
26 peerHostName.prepend('.');
executed: peerHostName.prepend('.');
Execution Count:41
41
27 -
28 if (peerHostName.endsWith(QString::fromLatin1(token)))
evaluated: peerHostName.endsWith(QString::fromLatin1(token))
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:32
9-32
29 return true;
executed: return true;
Execution Count:9
9
30 }
executed: }
Execution Count:32
32
31 -
32 return false;
executed: return false;
Execution Count:32
32
33} -
34 -
35QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) -
36{ -
37 QList<QNetworkProxy> proxyList; -
38 -
39 if (ignoreProxyFor(query))
evaluated: ignoreProxyFor(query)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:32
9-32
40 return proxyList << QNetworkProxy::NoProxy;
executed: return proxyList << QNetworkProxy::NoProxy;
Execution Count:9
9
41 -
42 -
43 const QString queryProtocol = query.protocolTag(); -
44 QByteArray proxy_env; -
45 -
46 if (queryProtocol == QLatin1String("http"))
evaluated: queryProtocol == QLatin1String("http")
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:12
12-20
47 proxy_env = qgetenv("http_proxy");
executed: proxy_env = qgetenv("http_proxy");
Execution Count:20
20
48 else if (queryProtocol == QLatin1String("https"))
evaluated: queryProtocol == QLatin1String("https")
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
49 proxy_env = qgetenv("https_proxy");
executed: proxy_env = qgetenv("https_proxy");
Execution Count:2
2
50 else if (queryProtocol == QLatin1String("ftp"))
evaluated: queryProtocol == QLatin1String("ftp")
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
51 proxy_env = qgetenv("ftp_proxy");
executed: proxy_env = qgetenv("ftp_proxy");
Execution Count:2
2
52 else -
53 proxy_env = qgetenv("all_proxy");
executed: proxy_env = qgetenv("all_proxy");
Execution Count:8
8
54 -
55 -
56 if (proxy_env.isEmpty())
partially evaluated: proxy_env.isEmpty()
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
0-32
57 proxy_env = qgetenv("http_proxy");
executed: proxy_env = qgetenv("http_proxy");
Execution Count:32
32
58 -
59 if (!proxy_env.isEmpty()) {
partially evaluated: !proxy_env.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
60 QUrl url = QUrl(QString::fromLocal8Bit(proxy_env)); -
61 if (url.scheme() == QLatin1String("socks5")) {
never evaluated: url.scheme() == QLatin1String("socks5")
0
62 QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(), -
63 url.port() ? url.port() : 1080, url.userName(), url.password()); -
64 proxyList << proxy; -
65 } else if (url.scheme() == QLatin1String("socks5h")) {
never executed: }
never evaluated: url.scheme() == QLatin1String("socks5h")
0
66 QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(), -
67 url.port() ? url.port() : 1080, url.userName(), url.password()); -
68 proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability); -
69 proxyList << proxy; -
70 } else if ((url.scheme() == QLatin1String("http") || url.scheme().isEmpty())
never executed: }
never evaluated: url.scheme() == QLatin1String("http")
never evaluated: url.scheme().isEmpty()
0
71 && query.queryType() != QNetworkProxyQuery::UdpSocket
never evaluated: query.queryType() != QNetworkProxyQuery::UdpSocket
0
72 && query.queryType() != QNetworkProxyQuery::TcpServer) {
never evaluated: query.queryType() != QNetworkProxyQuery::TcpServer
0
73 QNetworkProxy proxy(QNetworkProxy::HttpProxy, url.host(), -
74 url.port() ? url.port() : 8080, url.userName(), url.password()); -
75 proxyList << proxy; -
76 }
never executed: }
0
77 } -
78 if (proxyList.isEmpty())
partially evaluated: proxyList.isEmpty()
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
0-32
79 proxyList << QNetworkProxy::NoProxy;
executed: proxyList << QNetworkProxy::NoProxy;
Execution Count:32
32
80 -
81 return proxyList;
executed: return proxyList;
Execution Count:32
32
82} -
83 -
84 -
85 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial