OpenCoverage

qnetworkproxy_generic.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/kernel/qnetworkproxy_generic.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4static bool ignoreProxyFor(const QNetworkProxyQuery &query)-
5{-
6 const QByteArray noProxy = qgetenv("no_proxy").trimmed();-
7 if (noProxy.isEmpty()
noProxy.isEmpty()Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEnever evaluated
)
0-39
8 return
executed 39 times by 1 test: return false;
Executed by:
  • tst_QNetworkProxyFactory
false;
executed 39 times by 1 test: return false;
Executed by:
  • tst_QNetworkProxyFactory
39
9-
10 const QList<QByteArray> noProxyTokens = noProxy.split(',');-
11-
12 for (const QByteArray &rawToken : noProxyTokens) {-
13 QByteArray token = rawToken.trimmed();-
14 QString peerHostName = query.peerHostName();-
15-
16-
17 if (token.startsWith('*')
token.startsWith('*')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
18 token = token.mid(1);
never executed: token = token.mid(1);
0
19-
20-
21 if (token.endsWith('.')
token.endsWith('.')Description
TRUEnever evaluated
FALSEnever evaluated
&& !peerHostName.endsWith('.')
!peerHostName.endsWith('.')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
22 token = token.left(token.length()-1);
never executed: token = token.left(token.length()-1);
0
23-
24-
25-
26 if (!token.startsWith('.')
!token.startsWith('.')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
27 token.prepend('.');
never executed: token.prepend('.');
0
28-
29 if (!peerHostName.startsWith('.')
!peerHostName.startsWith('.')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
30 peerHostName.prepend('.');
never executed: peerHostName.prepend('.');
0
31-
32 if (peerHostName.endsWith(QString::fromLatin1(token))
peerHostName.e...Latin1(token))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
33 return
never executed: return true;
true;
never executed: return true;
0
34 }
never executed: end of block
0
35-
36 return
never executed: return false;
false;
never executed: return false;
0
37}-
38-
39QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)-
40{-
41 QList<QNetworkProxy> proxyList;-
42-
43 if (ignoreProxyFor(query)
ignoreProxyFor(query)Description
TRUEnever evaluated
FALSEevaluated 39 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
)
0-39
44 return
never executed: return proxyList << QNetworkProxy::NoProxy;
proxyList << QNetworkProxy::NoProxy;
never executed: return proxyList << QNetworkProxy::NoProxy;
0
45-
46-
47 const QString queryProtocol = query.protocolTag();-
48 QByteArray proxy_env;-
49-
50 if (queryProtocol == QLatin1String("http")
queryProtocol ...String("http")Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
)
18-21
51 proxy_env = qgetenv("http_proxy");
executed 18 times by 1 test: proxy_env = qgetenv("http_proxy");
Executed by:
  • tst_QNetworkProxyFactory
18
52 else if (queryProtocol == QLatin1String("https")
queryProtocol ...tring("https")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
)
2-19
53 proxy_env = qgetenv("https_proxy");
executed 2 times by 1 test: proxy_env = qgetenv("https_proxy");
Executed by:
  • tst_QNetworkProxyFactory
2
54 else if (queryProtocol == QLatin1String("ftp")
queryProtocol ...1String("ftp")Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
)
3-16
55 proxy_env = qgetenv("ftp_proxy");
executed 3 times by 1 test: proxy_env = qgetenv("ftp_proxy");
Executed by:
  • tst_QNetworkProxyFactory
3
56 else-
57 proxy_env = qgetenv("all_proxy");
executed 16 times by 1 test: proxy_env = qgetenv("all_proxy");
Executed by:
  • tst_QNetworkProxyFactory
16
58-
59-
60 if (proxy_env.isEmpty()
proxy_env.isEmpty()Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEnever evaluated
)
0-39
61 proxy_env = qgetenv("http_proxy");
executed 39 times by 1 test: proxy_env = qgetenv("http_proxy");
Executed by:
  • tst_QNetworkProxyFactory
39
62-
63 if (!proxy_env.isEmpty()
!proxy_env.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 37 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
) {
2-37
64 QUrl url = QUrl(QString::fromLocal8Bit(proxy_env));-
65 const QString scheme = url.scheme();-
66 if (scheme == QLatin1String("socks5")
scheme == QLat...ring("socks5")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
) {
1
67 QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(),-
68 url.port() ? url.port() : 1080, url.userName(), url.password());-
69 proxyList << proxy;-
70 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkProxyFactory
else if (scheme == QLatin1String("socks5h")
scheme == QLat...ing("socks5h")Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
) {
0-1
71 QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(),-
72 url.port() ? url.port() : 1080, url.userName(), url.password());-
73 proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability);-
74 proxyList << proxy;-
75 }
never executed: end of block
else if ((scheme.isEmpty()
scheme.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
|| scheme == QLatin1String("http")
scheme == QLat...String("http")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEnever evaluated
)
0-1
76 && query.queryType() != QNetworkProxyQuery::UdpSocket
query.queryTyp...ery::UdpSocketDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEnever evaluated
0-1
77 && query.queryType() != QNetworkProxyQuery::TcpServer
query.queryTyp...ery::TcpServerDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEnever evaluated
) {
0-1
78 QNetworkProxy proxy(QNetworkProxy::HttpProxy, url.host(),-
79 url.port() ? url.port() : 8080, url.userName(), url.password());-
80 proxyList << proxy;-
81 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkProxyFactory
1
82 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkProxyFactory
2
83 if (proxyList.isEmpty()
proxyList.isEmpty()Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
)
2-37
84 proxyList << QNetworkProxy::NoProxy;
executed 37 times by 1 test: proxyList << QNetworkProxy::NoProxy;
Executed by:
  • tst_QNetworkProxyFactory
37
85-
86 return
executed 39 times by 1 test: return proxyList;
Executed by:
  • tst_QNetworkProxyFactory
proxyList;
executed 39 times by 1 test: return proxyList;
Executed by:
  • tst_QNetworkProxyFactory
39
87}-
88-
89-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9