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