Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | | - |
41 | | - |
42 | #include "qplatformdefs.h" | - |
43 | | - |
44 | #include "qhostinfo_p.h" | - |
45 | #include "private/qnativesocketengine_p.h" | - |
46 | #include "qiodevice.h" | - |
47 | #include <qbytearray.h> | - |
48 | #include <qlibrary.h> | - |
49 | #include <qbasicatomic.h> | - |
50 | #include <qurl.h> | - |
51 | #include <qfile.h> | - |
52 | #include <private/qnet_unix_p.h> | - |
53 | | - |
54 | #include <sys/types.h> | - |
55 | #include <netdb.h> | - |
56 | #include <arpa/inet.h> | - |
57 | #if defined(Q_OS_VXWORKS) | - |
58 | # include <hostLib.h> | - |
59 | #else | - |
60 | # include <resolv.h> | - |
61 | #endif | - |
62 | | - |
63 | #if defined(__GNU_LIBRARY__) && !defined(__UCLIBC__) | - |
64 | # include <gnu/lib-names.h> | - |
65 | #endif | - |
66 | | - |
67 | #if defined (QT_NO_GETADDRINFO) | - |
68 | static QBasicMutex getHostByNameMutex; | - |
69 | #endif | - |
70 | | - |
71 | QT_BEGIN_NAMESPACE | - |
72 | | - |
73 | | - |
74 | #if !defined(QT_SOCKOPTLEN_T) | - |
75 | # define QT_SOCKOPTLEN_T QT_SOCKLEN_T | - |
76 | #endif | - |
77 | | - |
78 | | - |
79 | | - |
80 | #if defined(AI_ADDRCONFIG) && !defined(Q_OS_HPUX) | - |
81 | # define Q_ADDRCONFIG AI_ADDRCONFIG | - |
82 | #endif | - |
83 | | - |
84 | typedef struct __res_state *res_state_ptr; | - |
85 | | - |
86 | typedef int (*res_init_proto)(void); | - |
87 | static res_init_proto local_res_init = 0; | - |
88 | typedef int (*res_ninit_proto)(res_state_ptr); | - |
89 | static res_ninit_proto local_res_ninit = 0; | - |
90 | typedef void (*res_nclose_proto)(res_state_ptr); | - |
91 | static res_nclose_proto local_res_nclose = 0; | - |
92 | static res_state_ptr local_res = 0; | - |
93 | | - |
94 | static bool resolveLibraryInternal() | - |
95 | { | - |
96 | #if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX) | - |
97 | QLibrary lib; | - |
98 | #ifdef LIBRESOLV_SO | - |
99 | lib.setFileName(QStringLiteral(LIBRESOLV_SO));executed 24 times by 24 tests: return qstring_literal_temp; Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 24 |
100 | if (!lib.load())TRUE | never evaluated | FALSE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 0-24 |
101 | #endif | - |
102 | { | - |
103 | lib.setFileName(QLatin1String("resolv")); | - |
104 | if (!lib.load())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
105 | return false; never executed: return false; | 0 |
106 | } never executed: end of block | 0 |
107 | | - |
108 | local_res_init = res_init_proto(lib.resolve("__res_init")); | - |
109 | if (!local_res_init)TRUE | never evaluated | FALSE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 0-24 |
110 | local_res_init = res_init_proto(lib.resolve("res_init")); never executed: local_res_init = res_init_proto(lib.resolve("res_init")); | 0 |
111 | | - |
112 | local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit")); | - |
113 | if (!local_res_ninit)TRUE | never evaluated | FALSE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 0-24 |
114 | local_res_ninit = res_ninit_proto(lib.resolve("res_ninit")); never executed: local_res_ninit = res_ninit_proto(lib.resolve("res_ninit")); | 0 |
115 | | - |
116 | if (!local_res_ninit) {TRUE | never evaluated | FALSE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 0-24 |
117 | | - |
118 | local_res = res_state_ptr(lib.resolve("_res")); | - |
119 | } else { never executed: end of block | 0 |
120 | local_res_nclose = res_nclose_proto(lib.resolve("res_nclose")); | - |
121 | if (!local_res_nclose)TRUE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | never evaluated |
| 0-24 |
122 | local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));executed 24 times by 24 tests: local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose")); Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 24 |
123 | if (!local_res_nclose)TRUE | never evaluated | FALSE | evaluated 24 times by 24 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 0-24 |
124 | local_res_ninit = 0; never executed: local_res_ninit = 0; | 0 |
125 | }executed 24 times by 24 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 24 |
126 | #endif | - |
127 | | - |
128 | return true;executed 24 times by 24 tests: return true; Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 24 |
129 | } | - |
130 | Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))executed 24 times by 24 tests: end of block Executed by:- tst_lancelot - unknown status
- tst_networkselftest - unknown status
- tst_platformsocketengine - unknown status
- tst_qabstractnetworkcache - unknown status
- tst_qftp - unknown status
- tst_qhostinfo - unknown status
- tst_qhttpnetworkconnection - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
- tst_qnetworkdiskcache - unknown status
- tst_qnetworkinterface - unknown status
- tst_qnetworkproxyfactory - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpserver - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
- tst_qudpsocket - unknown status
- tst_spdy - unknown status
executed 24 times by 24 tests: guard.store(QtGlobalStatic::Destroyed); Executed by:- tst_lancelot - unknown status
- tst_networkselftest - unknown status
- tst_platformsocketengine - unknown status
- tst_qabstractnetworkcache - unknown status
- tst_qftp - unknown status
- tst_qhostinfo - unknown status
- tst_qhttpnetworkconnection - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
- tst_qnetworkdiskcache - unknown status
- tst_qnetworkinterface - unknown status
- tst_qnetworkproxyfactory - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpserver - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
- tst_qudpsocket - unknown status
- tst_spdy - unknown status
executed 2446 times by 25 tests: return &holder.value; Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
TRUE | evaluated 24 times by 24 testsEvaluated by:- tst_lancelot - unknown status
- tst_networkselftest - unknown status
- tst_platformsocketengine - unknown status
- tst_qabstractnetworkcache - unknown status
- tst_qftp - unknown status
- tst_qhostinfo - unknown status
- tst_qhttpnetworkconnection - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
- tst_qnetworkdiskcache - unknown status
- tst_qnetworkinterface - unknown status
- tst_qnetworkproxyfactory - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpserver - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
- tst_qudpsocket - unknown status
- tst_spdy - unknown status
| FALSE | never evaluated |
| 0-2446 |
131 | | - |
132 | QHostInfo QHostInfoAgent::fromName(const QString &hostName) | - |
133 | { | - |
134 | QHostInfo results; | - |
135 | | - |
136 | #if defined(QHOSTINFO_DEBUG) | - |
137 | qDebug("QHostInfoAgent::fromName(%s) looking up...", | - |
138 | hostName.toLatin1().constData()); | - |
139 | #endif | - |
140 | | - |
141 | | - |
142 | resolveLibrary(); | - |
143 | | - |
144 | | - |
145 | if (local_res_init)TRUE | evaluated 2444 times by 25 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | never evaluated |
| 0-2444 |
146 | local_res_init();executed 2444 times by 25 tests: local_res_init(); Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 2444 |
147 | | - |
148 | QHostAddress address; | - |
149 | if (address.setAddress(hostName)) {TRUE | evaluated 33 times by 1 test | FALSE | evaluated 2411 times by 25 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 33-2411 |
150 | | - |
151 | | - |
152 | #if !defined (QT_NO_GETADDRINFO) && !defined (Q_OS_DARWIN) | - |
153 | sockaddr_in sa4; | - |
154 | sockaddr_in6 sa6; | - |
155 | sockaddr *sa = 0; | - |
156 | QT_SOCKLEN_T saSize = 0; | - |
157 | if (address.protocol() == QAbstractSocket::IPv4Protocol) {TRUE | evaluated 25 times by 1 test | FALSE | evaluated 8 times by 1 test |
| 8-25 |
158 | sa = (sockaddr *)&sa4; | - |
159 | saSize = sizeof(sa4); | - |
160 | memset(&sa4, 0, sizeof(sa4)); | - |
161 | sa4.sin_family = AF_INET; | - |
162 | sa4.sin_addr.s_addr = htonl(address.toIPv4Address()); | - |
163 | }executed 25 times by 1 test: end of block | 25 |
164 | else { | - |
165 | sa = (sockaddr *)&sa6; | - |
166 | saSize = sizeof(sa6); | - |
167 | memset(&sa6, 0, sizeof(sa6)); | - |
168 | sa6.sin6_family = AF_INET6; | - |
169 | memcpy(sa6.sin6_addr.s6_addr, address.toIPv6Address().c, sizeof(sa6.sin6_addr.s6_addr)); | - |
170 | }executed 8 times by 1 test: end of block | 8 |
171 | | - |
172 | char hbuf[NI_MAXHOST]; | - |
173 | if (sa && getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)TRUE | evaluated 33 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 33 times by 1 test | FALSE | never evaluated |
| 0-33 |
174 | results.setHostName(QString::fromLatin1(hbuf));executed 33 times by 1 test: results.setHostName(QString::fromLatin1(hbuf)); | 33 |
175 | #else | - |
176 | in_addr_t inetaddr = qt_safe_inet_addr(hostName.toLatin1().constData()); | - |
177 | struct hostent *ent = gethostbyaddr((const char *)&inetaddr, sizeof(inetaddr), AF_INET); | - |
178 | if (ent) | - |
179 | results.setHostName(QString::fromLatin1(ent->h_name)); | - |
180 | #endif | - |
181 | | - |
182 | if (results.hostName().isEmpty())TRUE | never evaluated | FALSE | evaluated 33 times by 1 test |
| 0-33 |
183 | results.setHostName(address.toString()); never executed: results.setHostName(address.toString()); | 0 |
184 | results.setAddresses(QList<QHostAddress>() << address); | - |
185 | return results;executed 33 times by 1 test: return results; | 33 |
186 | } | - |
187 | | - |
188 | | - |
189 | QByteArray aceHostname = QUrl::toAce(hostName); | - |
190 | results.setHostName(hostName); | - |
191 | if (aceHostname.isEmpty()) {TRUE | evaluated 28 times by 2 tests | FALSE | evaluated 2383 times by 25 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 28-2383 |
192 | results.setError(QHostInfo::HostNotFound); | - |
193 | results.setErrorString(hostName.isEmpty() ? | - |
194 | QCoreApplication::translate("QHostInfoAgent", "No host name given") : | - |
195 | QCoreApplication::translate("QHostInfoAgent", "Invalid hostname")); | - |
196 | return results;executed 28 times by 2 tests: return results; | 28 |
197 | } | - |
198 | | - |
199 | #if !defined (QT_NO_GETADDRINFO) | - |
200 | | - |
201 | | - |
202 | addrinfo *res = 0; | - |
203 | struct addrinfo hints; | - |
204 | memset(&hints, 0, sizeof(hints)); | - |
205 | hints.ai_family = PF_UNSPEC; | - |
206 | #ifdef Q_ADDRCONFIG | - |
207 | hints.ai_flags = Q_ADDRCONFIG; | - |
208 | #endif | - |
209 | | - |
210 | int result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); | - |
211 | # ifdef Q_ADDRCONFIG | - |
212 | if (result == EAI_BADFLAGS) {TRUE | never evaluated | FALSE | evaluated 2383 times by 26 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
- ...
|
| 0-2383 |
213 | | - |
214 | hints.ai_flags = 0; | - |
215 | result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); | - |
216 | } never executed: end of block | 0 |
217 | # endif | - |
218 | | - |
219 | if (result == 0) {TRUE | evaluated 2235 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | evaluated 148 times by 13 testsEvaluated by:- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkReply
- tst_QTcpServer
- tst_Spdy
- tst_lancelot - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qtcpsocket - unknown status
- tst_qudpsocket - unknown status
|
| 148-2235 |
220 | addrinfo *node = res; | - |
221 | QList<QHostAddress> addresses; | - |
222 | while (node) {TRUE | evaluated 7227 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | evaluated 2235 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 2235-7227 |
223 | #ifdef QHOSTINFO_DEBUG | - |
224 | qDebug() << "getaddrinfo node: flags:" << node->ai_flags << "family:" << node->ai_family << "ai_socktype:" << node->ai_socktype << "ai_protocol:" << node->ai_protocol << "ai_addrlen:" << node->ai_addrlen; | - |
225 | #endif | - |
226 | if (node->ai_family == AF_INET) {TRUE | evaluated 6831 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | evaluated 396 times by 11 testsEvaluated by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
|
| 396-6831 |
227 | QHostAddress addr; | - |
228 | addr.setAddress(ntohl(((sockaddr_in *) node->ai_addr)->sin_addr.s_addr)); | - |
229 | if (!addresses.contains(addr))TRUE | evaluated 2277 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| FALSE | evaluated 4554 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
| 2277-4554 |
230 | addresses.append(addr);executed 2277 times by 23 tests: addresses.append(addr); Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 2277 |
231 | }executed 6831 times by 23 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 6831 |
232 | else if (node->ai_family == AF_INET6) {TRUE | evaluated 396 times by 11 testsEvaluated by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
| FALSE | never evaluated |
| 0-396 |
233 | QHostAddress addr; | - |
234 | sockaddr_in6 *sa6 = (sockaddr_in6 *) node->ai_addr; | - |
235 | addr.setAddress(sa6->sin6_addr.s6_addr); | - |
236 | if (sa6->sin6_scope_id)TRUE | never evaluated | FALSE | evaluated 396 times by 11 testsEvaluated by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
|
| 0-396 |
237 | addr.setScopeId(QString::number(sa6->sin6_scope_id)); never executed: addr.setScopeId(QString::number(sa6->sin6_scope_id)); | 0 |
238 | if (!addresses.contains(addr))TRUE | evaluated 132 times by 11 testsEvaluated by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
| FALSE | evaluated 264 times by 11 testsEvaluated by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
|
| 132-264 |
239 | addresses.append(addr);executed 132 times by 11 tests: addresses.append(addr); Executed by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
| 132 |
240 | }executed 396 times by 11 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QFtp
- tst_QHostInfo
- tst_QNetworkDiskCache
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
| 396 |
241 | node = node->ai_next; | - |
242 | }executed 7227 times by 23 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
| 7227 |
243 | if (addresses.isEmpty() && node == 0) {TRUE | never evaluated | FALSE | evaluated 2235 times by 23 testsEvaluated by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
|
TRUE | never evaluated | FALSE | never evaluated |
| 0-2235 |
244 | | - |
245 | | - |
246 | results.setError(QHostInfo::UnknownError); | - |
247 | results.setErrorString(tr("Unknown address type")); | - |
248 | } never executed: end of block | 0 |
249 | | - |
250 | results.setAddresses(addresses); | - |
251 | freeaddrinfo(res); | - |
252 | } else if (result == EAI_NONAMEexecuted 2235 times by 23 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
TRUE | evaluated 140 times by 9 testsEvaluated by:- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkReply
- tst_QTcpServer
- tst_Spdy
- tst_lancelot - unknown status
- tst_qprocess - unknown status
- tst_qtcpsocket - unknown status
- tst_qudpsocket - unknown status
| FALSE | evaluated 8 times by 4 testsEvaluated by:- tst_QFtp
- tst_qhttpsocketengine - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
|
| 8-2235 |
253 | || result == EAI_FAILTRUE | never evaluated | FALSE | evaluated 8 times by 4 testsEvaluated by:- tst_QFtp
- tst_qhttpsocketengine - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
|
| 0-8 |
254 | #ifdef EAI_NODATA | - |
255 | | - |
256 | || result == EAI_NODATATRUE | evaluated 8 times by 4 testsEvaluated by:- tst_QFtp
- tst_qhttpsocketengine - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
| FALSE | never evaluated |
| 0-8 |
257 | #endif | - |
258 | ) { | - |
259 | results.setError(QHostInfo::HostNotFound); | - |
260 | results.setErrorString(tr("Host not found")); | - |
261 | } else {executed 148 times by 13 tests: end of block Executed by:- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkReply
- tst_QTcpServer
- tst_Spdy
- tst_lancelot - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qtcpsocket - unknown status
- tst_qudpsocket - unknown status
| 148 |
262 | results.setError(QHostInfo::UnknownError); | - |
263 | results.setErrorString(QString::fromLocal8Bit(gai_strerror(result))); | - |
264 | } never executed: end of block | 0 |
265 | | - |
266 | #else | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | | - |
272 | QMutexLocker locker(&getHostByNameMutex); | - |
273 | hostent *result = gethostbyname(aceHostname.constData()); | - |
274 | if (result) { | - |
275 | if (result->h_addrtype == AF_INET) { | - |
276 | QList<QHostAddress> addresses; | - |
277 | for (char **p = result->h_addr_list; *p != 0; p++) { | - |
278 | QHostAddress addr; | - |
279 | addr.setAddress(ntohl(*((quint32 *)*p))); | - |
280 | if (!addresses.contains(addr)) | - |
281 | addresses.prepend(addr); | - |
282 | } | - |
283 | results.setAddresses(addresses); | - |
284 | } else { | - |
285 | results.setError(QHostInfo::UnknownError); | - |
286 | results.setErrorString(tr("Unknown address type")); | - |
287 | } | - |
288 | #if !defined(Q_OS_VXWORKS) | - |
289 | } else if (h_errno == HOST_NOT_FOUND || h_errno == NO_DATA | - |
290 | || h_errno == NO_ADDRESS) { | - |
291 | results.setError(QHostInfo::HostNotFound); | - |
292 | results.setErrorString(tr("Host not found")); | - |
293 | #endif | - |
294 | } else { | - |
295 | results.setError(QHostInfo::UnknownError); | - |
296 | results.setErrorString(tr("Unknown error")); | - |
297 | } | - |
298 | #endif // !defined (QT_NO_GETADDRINFO) | - |
299 | | - |
300 | #if defined(QHOSTINFO_DEBUG) | - |
301 | if (results.error() != QHostInfo::NoError) { | - |
302 | qDebug("QHostInfoAgent::fromName(): error #%d %s", | - |
303 | h_errno, results.errorString().toLatin1().constData()); | - |
304 | } else { | - |
305 | QString tmp; | - |
306 | QList<QHostAddress> addresses = results.addresses(); | - |
307 | for (int i = 0; i < addresses.count(); ++i) { | - |
308 | if (i != 0) tmp += ", "; | - |
309 | tmp += addresses.at(i).toString(); | - |
310 | } | - |
311 | qDebug("QHostInfoAgent::fromName(): found %i entries for \"%s\": {%s}", | - |
312 | addresses.count(), hostName.toLatin1().constData(), | - |
313 | tmp.toLatin1().constData()); | - |
314 | } | - |
315 | #endif | - |
316 | return results;executed 2383 times by 26 tests: return results; Executed by:- tst_NetworkSelfTest
- tst_QAbstractNetworkCache
- tst_QFtp
- tst_QHostInfo
- tst_QHttpNetworkConnection
- tst_QNetworkAccessManager_And_QProgressDialog
- tst_QNetworkDiskCache
- tst_QNetworkInterface
- tst_QNetworkProxyFactory
- tst_QNetworkReply
- tst_QTcpServer
- tst_QUdpSocket
- tst_Spdy
- tst_lancelot - unknown status
- tst_platformsocketengine - unknown status
- tst_qhttpsocketengine - unknown status
- tst_qiodevice - unknown status
- tst_qobject - unknown status
- tst_qprocess - unknown status
- tst_qsocks5socketengine - unknown status
- tst_qsslsocket - unknown status
- tst_qsslsocket_onDemandCertificates_member - unknown status
- tst_qsslsocket_onDemandCertificates_static - unknown status
- tst_qtcpsocket - unknown status
- tst_qtextstream - unknown status
- ...
| 2383 |
317 | } | - |
318 | | - |
319 | QString QHostInfo::localDomainName() | - |
320 | { | - |
321 | #if !defined(Q_OS_VXWORKS) && !defined(Q_OS_ANDROID) | - |
322 | resolveLibrary(); | - |
323 | if (local_res_ninit) {TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
324 | | - |
325 | res_state_ptr state = res_state_ptr(malloc(sizeof(*state))); | - |
326 | Q_CHECK_PTR(state); never executed: qt_check_pointer(__FILE__,326); TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
| 0-2 |
327 | memset(state, 0, sizeof(*state)); | - |
328 | local_res_ninit(state); | - |
329 | QString domainName = QUrl::fromAce(state->defdname); | - |
330 | if (domainName.isEmpty())TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
| 0-2 |
331 | domainName = QUrl::fromAce(state->dnsrch[0]); never executed: domainName = QUrl::fromAce(state->dnsrch[0]); | 0 |
332 | local_res_nclose(state); | - |
333 | free(state); | - |
334 | | - |
335 | return domainName;executed 2 times by 1 test: return domainName; | 2 |
336 | } | - |
337 | | - |
338 | if (local_res_init && local_res) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
339 | | - |
340 | | - |
341 | #if defined(QT_NO_GETADDRINFO) | - |
342 | | - |
343 | | - |
344 | QMutexLocker locker(&getHostByNameMutex); | - |
345 | #endif | - |
346 | local_res_init(); | - |
347 | QString domainName = QUrl::fromAce(local_res->defdname); | - |
348 | if (domainName.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
349 | domainName = QUrl::fromAce(local_res->dnsrch[0]); never executed: domainName = QUrl::fromAce(local_res->dnsrch[0]); | 0 |
350 | return domainName; never executed: return domainName; | 0 |
351 | } | - |
352 | #endif | - |
353 | | - |
354 | QFile resolvconf; | - |
355 | #if defined(_PATH_RESCONF) | - |
356 | resolvconf.setFileName(QFile::decodeName(_PATH_RESCONF)); | - |
357 | #else | - |
358 | resolvconf.setFileName(QLatin1String("/etc/resolv.conf")); | - |
359 | #endif | - |
360 | if (!resolvconf.open(QIODevice::ReadOnly))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
361 | return QString(); never executed: return QString(); | 0 |
362 | | - |
363 | QString domainName; | - |
364 | while (!resolvconf.atEnd()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
365 | QByteArray line = resolvconf.readLine().trimmed(); | - |
366 | if (line.startsWith("domain "))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
367 | return QUrl::fromAce(line.mid(sizeof "domain " - 1).trimmed()); never executed: return QUrl::fromAce(line.mid(sizeof "domain " - 1).trimmed()); | 0 |
368 | | - |
369 | | - |
370 | if (domainName.isEmpty() && line.startsWith("search ")) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
371 | QByteArray searchDomain = line.mid(sizeof "search " - 1).trimmed(); | - |
372 | int pos = searchDomain.indexOf(' '); | - |
373 | if (pos != -1)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
374 | searchDomain.truncate(pos); never executed: searchDomain.truncate(pos); | 0 |
375 | domainName = QUrl::fromAce(searchDomain); | - |
376 | } never executed: end of block | 0 |
377 | } never executed: end of block | 0 |
378 | | - |
379 | | - |
380 | return domainName; never executed: return domainName; | 0 |
381 | } | - |
382 | | - |
383 | QT_END_NAMESPACE | - |
| | |