qsocks5socketengine.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/socket/qsocks5socketengine.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qsocks5socketengine_p.h"-
41-
42#ifndef QT_NO_SOCKS5-
43-
44#include "qtcpsocket.h"-
45#include "qudpsocket.h"-
46#include "qtcpserver.h"-
47#include "qdebug.h"-
48#include "qhash.h"-
49#include "qqueue.h"-
50#include "qelapsedtimer.h"-
51#include "qmutex.h"-
52#include "qthread.h"-
53#include "qcoreapplication.h"-
54#include "qurl.h"-
55#include "qauthenticator.h"-
56#include "private/qiodevice_p.h"-
57#include <qendian.h>-
58#include <qnetworkinterface.h>-
59-
60QT_BEGIN_NAMESPACE-
61-
62static const int MaxWriteBufferSize = 128*1024;-
63-
64//#define QSOCKS5SOCKETLAYER_DEBUG-
65-
66#define MAX_DATA_DUMP 256-
67#if !defined(Q_OS_WINCE)-
68#define SOCKS5_BLOCKING_BIND_TIMEOUT 5000-
69#else-
70#define SOCKS5_BLOCKING_BIND_TIMEOUT 10000-
71#endif-
72-
73#define Q_INIT_CHECK(returnValue) do { \-
74 if (!d->data) { \-
75 return returnValue; \-
76 } } while (0)-
77-
78#define S5_VERSION_5 0x05-
79#define S5_CONNECT 0x01-
80#define S5_BIND 0x02-
81#define S5_UDP_ASSOCIATE 0x03-
82#define S5_IP_V4 0x01-
83#define S5_DOMAINNAME 0x03-
84#define S5_IP_V6 0x04-
85#define S5_SUCCESS 0x00-
86#define S5_R_ERROR_SOCKS_FAILURE 0x01-
87#define S5_R_ERROR_CON_NOT_ALLOWED 0x02-
88#define S5_R_ERROR_NET_UNREACH 0x03-
89#define S5_R_ERROR_HOST_UNREACH 0x04-
90#define S5_R_ERROR_CONN_REFUSED 0x05-
91#define S5_R_ERROR_TTL 0x06-
92#define S5_R_ERROR_CMD_NOT_SUPPORTED 0x07-
93#define S5_R_ERROR_ADD_TYPE_NOT_SUPORTED 0x08-
94-
95#define S5_AUTHMETHOD_NONE 0x00-
96#define S5_AUTHMETHOD_PASSWORD 0x02-
97#define S5_AUTHMETHOD_NOTACCEPTABLE 0xFF-
98-
99#define S5_PASSWORDAUTH_VERSION 0x01-
100-
101#ifdef QSOCKS5SOCKETLAYER_DEBUG-
102# define QSOCKS5_Q_DEBUG qDebug() << this-
103# define QSOCKS5_D_DEBUG qDebug() << q_ptr-
104# define QSOCKS5_DEBUG qDebug() << "[QSocks5]"-
105static QString s5StateToString(QSocks5SocketEnginePrivate::Socks5State s)-
106{-
107 switch (s) {-
108 case QSocks5SocketEnginePrivate::Uninitialized: return QLatin1String("Uninitialized");-
109 case QSocks5SocketEnginePrivate::ConnectError: return QLatin1String("ConnectError");-
110 case QSocks5SocketEnginePrivate::AuthenticationMethodsSent: return QLatin1String("AuthenticationMethodsSent");-
111 case QSocks5SocketEnginePrivate::Authenticating: return QLatin1String("Authenticating");-
112 case QSocks5SocketEnginePrivate::AuthenticatingError: return QLatin1String("AuthenticatingError");-
113 case QSocks5SocketEnginePrivate::RequestMethodSent: return QLatin1String("RequestMethodSent");-
114 case QSocks5SocketEnginePrivate::RequestError: return QLatin1String("RequestError");-
115 case QSocks5SocketEnginePrivate::Connected: return QLatin1String("Connected");-
116 case QSocks5SocketEnginePrivate::UdpAssociateSuccess: return QLatin1String("UdpAssociateSuccess");-
117 case QSocks5SocketEnginePrivate::BindSuccess: return QLatin1String("BindSuccess");-
118 case QSocks5SocketEnginePrivate::ControlSocketError: return QLatin1String("ControlSocketError");-
119 case QSocks5SocketEnginePrivate::SocksError: return QLatin1String("SocksError");-
120 case QSocks5SocketEnginePrivate::HostNameLookupError: return QLatin1String("HostNameLookupError");-
121 default: break;-
122 }-
123 return QLatin1String("unknown state");-
124}-
125-
126static QString dump(const QByteArray &buf)-
127{-
128 QString data;-
129 for (int i = 0; i < qMin<int>(MAX_DATA_DUMP, buf.size()); ++i) {-
130 if (i) data += QLatin1Char(' ');-
131 uint val = (unsigned char)buf.at(i);-
132 // data += QString("0x%1").arg(val, 3, 16, QLatin1Char('0'));-
133 data += QString::number(val);-
134 }-
135 if (buf.size() > MAX_DATA_DUMP)-
136 data += QLatin1String(" ...");-
137-
138 return QString::fromLatin1("size: %1 data: { %2 }").arg(buf.size()).arg(data);-
139}-
140-
141#else-
142# define QSOCKS5_DEBUG if (0) qDebug()-
143# define QSOCKS5_Q_DEBUG if (0) qDebug()-
144# define QSOCKS5_D_DEBUG if (0) qDebug()-
145-
146static
never executed: return QString();
inline QString s5StateToString(QSocks5SocketEnginePrivate::Socks5State) { return QString(); }
never executed: return QString();
0
147static
never executed: return QString();
inline QString dump(const QByteArray &) { return QString(); }
never executed: return QString();
0
148#endif-
149-
150/*-
151 inserts the host address in buf at pos and updates pos.-
152 if the func fails the data in buf and the vallue of pos is undefined-
153*/-
154static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, quint16 port, QByteArray *pBuf)-
155{-
156 QSOCKS5_DEBUG << "setting [" << address << ':' << port << ']';
dead code: QMessageLogger(__FILE__, 156, __PRETTY_FUNCTION__).debug() << "setting [" << address << ':' << port << ']';
-
157-
158 union {-
159 quint16 port;-
160 quint32 ipv4;-
161 QIPv6Address ipv6;-
162 char ptr;-
163 } data;-
164-
165 // add address-
166 if (address.protocol() == QAbstractSocket::IPv4Protocol) {
address.protoc...::IPv4ProtocolDescription
TRUEevaluated 246 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-246
167 data.ipv4 = qToBigEndian<quint32>(address.toIPv4Address());-
168 pBuf->append(S5_IP_V4);-
169 pBuf->append(QByteArray::fromRawData(&data.ptr, sizeof data.ipv4));-
170 } else if (address.protocol() == QAbstractSocket::IPv6Protocol) {
executed 246 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
address.protoc...::IPv6ProtocolDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-246
171 data.ipv6 = address.toIPv6Address();-
172 pBuf->append(S5_IP_V6);-
173 pBuf->append(QByteArray::fromRawData(&data.ptr, sizeof data.ipv6));-
174 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
1
175 return false;
never executed: return false;
0
176 }-
177-
178 // add port-
179 data.port = qToBigEndian<quint16>(port);-
180 pBuf->append(QByteArray::fromRawData(&data.ptr, sizeof data.port));-
181 return true;
executed 247 times by 4 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
247
182}-
183-
184/*-
185 like above, but for a hostname-
186*/-
187static bool qt_socks5_set_host_name_and_port(const QString &hostname, quint16 port, QByteArray *pBuf)-
188{-
189 QSOCKS5_DEBUG << "setting [" << hostname << ':' << port << ']';
dead code: QMessageLogger(__FILE__, 189, __PRETTY_FUNCTION__).debug() << "setting [" << hostname << ':' << port << ']';
-
190-
191 QByteArray encodedHostName = QUrl::toAce(hostname);-
192 QByteArray &buf = *pBuf;-
193-
194 if (encodedHostName.length() > 255)
encodedHostName.length() > 255Description
TRUEnever evaluated
FALSEevaluated 457 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-457
195 return false;
never executed: return false;
0
196-
197 buf.append(S5_DOMAINNAME);-
198 buf.append(uchar(encodedHostName.length()));-
199 buf.append(encodedHostName);-
200-
201 // add port-
202 union {-
203 quint16 port;-
204 char ptr;-
205 } data;-
206 data.port = qToBigEndian<quint16>(port);-
207 buf.append(QByteArray::fromRawData(&data.ptr, sizeof data.port));-
208-
209 return true;
executed 457 times by 7 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
457
210}-
211-
212-
213/*-
214 retrives the host address in buf at pos and updates pos.-
215 return 1 if OK, 0 if need more data, -1 if error-
216 if the func fails the value of the address and the pos is undefined-
217*/-
218static int qt_socks5_get_host_address_and_port(const QByteArray &buf, QHostAddress *pAddress, quint16 *pPort, int *pPos)-
219{-
220 int ret = -1;-
221 int pos = *pPos;-
222 const unsigned char *pBuf = reinterpret_cast<const unsigned char*>(buf.constData());-
223 QHostAddress address;-
224 quint16 port = 0;-
225-
226 if (buf.size() - pos < 1) {
buf.size() - pos < 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 693 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
4-693
227 QSOCKS5_DEBUG << "need more data address/port";
dead code: QMessageLogger(__FILE__, 227, __PRETTY_FUNCTION__).debug() << "need more data address/port";
-
228 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_qsocks5socketengine - unknown status
4
229 }-
230 if (pBuf[pos] == S5_IP_V4) {
pBuf[pos] == 0x01Description
TRUEevaluated 639 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
54-639
231 pos++;-
232 if (buf.size() - pos < 4) {
buf.size() - pos < 4Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 631 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
8-631
233 QSOCKS5_DEBUG << "need more data for ip4 address";
dead code: QMessageLogger(__FILE__, 233, __PRETTY_FUNCTION__).debug() << "need more data for ip4 address";
-
234 return 0;
executed 8 times by 1 test: return 0;
Executed by:
  • tst_qsocks5socketengine - unknown status
8
235 }-
236 address.setAddress(qFromBigEndian<quint32>(&pBuf[pos]));-
237 pos += 4;-
238 ret = 1;-
239 } else if (pBuf[pos] == S5_IP_V6) {
executed 631 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
pBuf[pos] == 0x04Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-631
240 pos++;-
241 if (buf.size() - pos < 16) {
buf.size() - pos < 16Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
22-32
242 QSOCKS5_DEBUG << "need more data for ip6 address";
dead code: QMessageLogger(__FILE__, 242, __PRETTY_FUNCTION__).debug() << "need more data for ip6 address";
-
243 return 0;
executed 32 times by 1 test: return 0;
Executed by:
  • tst_qsocks5socketengine - unknown status
32
244 }-
245 QIPv6Address add;-
246 for (int i = 0; i < 16; ++i)
i < 16Description
TRUEevaluated 352 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
22-352
247 add[i] = buf[pos++];
executed 352 times by 1 test: add[i] = buf[pos++];
Executed by:
  • tst_qsocks5socketengine - unknown status
352
248 address.setAddress(add);-
249 ret = 1;-
250 } else if (pBuf[pos] == S5_DOMAINNAME){
executed 22 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
pBuf[pos] == 0x03Description
TRUEnever evaluated
FALSEnever evaluated
0-22
251 // just skip it-
252 pos++;-
253 qDebug() << "skipping hostname of len" << uint(pBuf[pos]);-
254 pos += uchar(pBuf[pos]);-
255 } else {
never executed: end of block
0
256 QSOCKS5_DEBUG << "invalid address type" << (int)pBuf[pos];
dead code: QMessageLogger(__FILE__, 256, __PRETTY_FUNCTION__).debug() << "invalid address type" << (int)pBuf[pos];
-
257 ret = -1;-
258 }
never executed: end of block
0
259-
260 if (ret == 1) {
ret == 1Description
TRUEevaluated 653 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-653
261 if (buf.size() - pos < 2) {
buf.size() - pos < 2Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 649 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
4-649
262 QSOCKS5_DEBUG << "need more data for port";
dead code: QMessageLogger(__FILE__, 262, __PRETTY_FUNCTION__).debug() << "need more data for port";
-
263 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_qsocks5socketengine - unknown status
4
264 }-
265 port = qFromBigEndian<quint16>(&pBuf[pos]);-
266 pos += 2;-
267 }
executed 649 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
649
268-
269 if (ret == 1) {
ret == 1Description
TRUEevaluated 649 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-649
270 QSOCKS5_DEBUG << "got [" << address << ':' << port << ']';
dead code: QMessageLogger(__FILE__, 270, __PRETTY_FUNCTION__).debug() << "got [" << address << ':' << port << ']';
-
271 *pAddress = address;-
272 *pPort = port;-
273 *pPos = pos;-
274 }
executed 649 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
649
275-
276 return ret;
executed 649 times by 7 tests: return ret;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
649
277}-
278-
279struct QSocks5Data-
280{-
281 QTcpSocket *controlSocket;-
282 QSocks5Authenticator *authenticator;-
283};-
284-
285struct QSocks5ConnectData : public QSocks5Data-
286{-
287 QByteArray readBuffer;-
288};-
289-
290struct QSocks5BindData : public QSocks5Data-
291{-
292 QHostAddress localAddress;-
293 quint16 localPort;-
294 QHostAddress peerAddress;-
295 quint16 peerPort;-
296 QElapsedTimer timeStamp;-
297};-
298-
299struct QSocks5RevivedDatagram-
300{-
301 QByteArray data;-
302 QHostAddress address;-
303 quint16 port;-
304};-
305-
306#ifndef QT_NO_UDPSOCKET-
307struct QSocks5UdpAssociateData : public QSocks5Data-
308{-
309 QUdpSocket *udpSocket;-
310 QHostAddress associateAddress;-
311 quint16 associatePort;-
312 QQueue<QSocks5RevivedDatagram> pendingDatagrams;-
313};-
314#endif-
315-
316// needs to be thread safe-
317class QSocks5BindStore : public QObject-
318{-
319public:-
320 QSocks5BindStore();-
321 ~QSocks5BindStore();-
322-
323 void add(qintptr socketDescriptor, QSocks5BindData *bindData);-
324 bool contains(qintptr socketDescriptor);-
325 QSocks5BindData *retrieve(qintptr socketDescriptor);-
326-
327protected:-
328 void timerEvent(QTimerEvent * event) Q_DECL_OVERRIDE;-
329-
330 QMutex mutex;-
331 int sweepTimerId;-
332 //socket descriptor, data, timestamp-
333 QHash<int, QSocks5BindData *> store;-
334};-
335-
336Q_GLOBAL_STATIC(QSocks5BindStore, socks5BindStore)
executed 17 times by 17 tests: end of block
Executed by:
  • tst_qeventloop - unknown status
  • tst_qftp - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworksession - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpserver - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlsimplereader - unknown status
executed 17 times by 17 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qeventloop - unknown status
  • tst_qftp - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworksession - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpserver - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlsimplereader - unknown status
executed 1011 times by 18 tests: return &holder.value;
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
guard.load() =...c::InitializedDescription
TRUEevaluated 17 times by 17 tests
Evaluated by:
  • tst_qeventloop - unknown status
  • tst_qftp - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworksession - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpserver - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEnever evaluated
0-1011
337-
338QSocks5BindStore::QSocks5BindStore()-
339 : mutex(QMutex::Recursive)-
340 , sweepTimerId(-1)-
341{-
342 QCoreApplication *app = QCoreApplication::instance();-
343 if (app && app->thread() != thread())
appDescription
TRUEevaluated 18 times by 18 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEnever evaluated
app->thread() != thread()Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 15 times by 15 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-18
344 moveToThread(app->thread());
executed 3 times by 3 tests: moveToThread(app->thread());
Executed by:
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qxmlsimplereader - unknown status
3
345}
executed 18 times by 18 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
18
346-
347QSocks5BindStore::~QSocks5BindStore()-
348{-
349}-
350-
351void QSocks5BindStore::add(qintptr socketDescriptor, QSocks5BindData *bindData)-
352{-
353 QMutexLocker lock(&mutex);-
354 if (store.contains(socketDescriptor)) {
store.contains...ketDescriptor)Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
0-6
355 // qDebug("delete it");-
356 }
never executed: end of block
0
357 bindData->timeStamp.start();-
358 store.insert(socketDescriptor, bindData);-
359 // start sweep timer if not started-
360 if (sweepTimerId == -1)
sweepTimerId == -1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-6
361 sweepTimerId = startTimer(60000);
executed 6 times by 3 tests: sweepTimerId = startTimer(60000);
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
362}
executed 6 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
363-
364bool QSocks5BindStore::contains(qintptr socketDescriptor)-
365{-
366 QMutexLocker lock(&mutex);-
367 return store.contains(socketDescriptor);
executed 999 times by 18 tests: return store.contains(socketDescriptor);
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
999
368}-
369-
370QSocks5BindData *QSocks5BindStore::retrieve(qintptr socketDescriptor)-
371{-
372 QMutexLocker lock(&mutex);-
373 const auto it = store.constFind(socketDescriptor);-
374 if (it == store.cend())
it == store.cend()Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
0-6
375 return 0;
never executed: return 0;
0
376 QSocks5BindData *bindData = it.value();-
377 store.erase(it);-
378 if (bindData) {
bindDataDescription
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-6
379 if (bindData->controlSocket->thread() != QThread::currentThread()) {
bindData->cont...urrentThread()Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
0-6
380 qWarning("Can not access socks5 bind data from different thread");-
381 return 0;
never executed: return 0;
0
382 }-
383 } else {
executed 6 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
384 QSOCKS5_DEBUG << "__ERROR__ binddata == 0";
dead code: QMessageLogger(__FILE__, 384, __PRETTY_FUNCTION__).debug() << "__ERROR__ binddata == 0";
-
385 }
never executed: end of block
0
386 // stop the sweep timer if not needed-
387 if (store.isEmpty()) {
store.isEmpty()Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-6
388 killTimer(sweepTimerId);-
389 sweepTimerId = -1;-
390 }
executed 6 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
391 return bindData;
executed 6 times by 3 tests: return bindData;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
392}-
393-
394void QSocks5BindStore::timerEvent(QTimerEvent * event)-
395{-
396 QMutexLocker lock(&mutex);-
397 if (event->timerId() == sweepTimerId) {
event->timerId...= sweepTimerIdDescription
TRUEnever evaluated
FALSEnever evaluated
0
398 QSOCKS5_DEBUG << "QSocks5BindStore performing sweep";
dead code: QMessageLogger(__FILE__, 398, __PRETTY_FUNCTION__).debug() << "QSocks5BindStore performing sweep";
-
399 for (auto it = store.begin(), end = store.end(); it != end;) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
400 if (it.value()->timeStamp.hasExpired(350000)) {
it.value()->ti...xpired(350000)Description
TRUEnever evaluated
FALSEnever evaluated
0
401 QSOCKS5_DEBUG << "QSocks5BindStore removing JJJJ";
dead code: QMessageLogger(__FILE__, 401, __PRETTY_FUNCTION__).debug() << "QSocks5BindStore removing JJJJ";
-
402 it = store.erase(it);-
403 } else {
never executed: end of block
0
404 ++it;-
405 }
never executed: end of block
0
406 }-
407 }
never executed: end of block
0
408}
never executed: end of block
0
409-
410QSocks5Authenticator::QSocks5Authenticator()-
411{-
412}-
413-
414QSocks5Authenticator::~QSocks5Authenticator()-
415{-
416}-
417-
418char QSocks5Authenticator::methodId()-
419{-
420 return 0x00;
executed 653 times by 9 tests: return 0x00;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
653
421}-
422-
423bool QSocks5Authenticator::beginAuthenticate(QTcpSocket *socket, bool *completed)-
424{-
425 Q_UNUSED(socket);-
426 *completed = true;-
427 return true;
never executed: return true;
0
428}-
429-
430bool QSocks5Authenticator::continueAuthenticate(QTcpSocket *socket, bool *completed)-
431{-
432 Q_UNUSED(socket);-
433 *completed = true;-
434 return true;
never executed: return true;
0
435}-
436-
437bool QSocks5Authenticator::seal(const QByteArray &buf, QByteArray *sealedBuf)-
438{-
439 *sealedBuf = buf;-
440 return true;
executed 2591 times by 9 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2591
441}-
442-
443bool QSocks5Authenticator::unSeal(const QByteArray &sealedBuf, QByteArray *buf)-
444{-
445 *buf = sealedBuf;-
446 return true;
executed 3655 times by 8 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
3655
447}-
448-
449bool QSocks5Authenticator::unSeal(QTcpSocket *sealedSocket, QByteArray *buf)-
450{-
451 return unSeal(sealedSocket->readAll(), buf);
executed 3655 times by 8 tests: return unSeal(sealedSocket->readAll(), buf);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
3655
452}-
453-
454QSocks5PasswordAuthenticator::QSocks5PasswordAuthenticator(const QString &userName, const QString &password)-
455{-
456 this->userName = userName;-
457 this->password = password;-
458}
executed 147 times by 7 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
147
459-
460char QSocks5PasswordAuthenticator::methodId()-
461{-
462 return 0x02;
executed 236 times by 7 tests: return 0x02;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
236
463}-
464-
465bool QSocks5PasswordAuthenticator::beginAuthenticate(QTcpSocket *socket, bool *completed)-
466{-
467 *completed = false;-
468 QByteArray uname = userName.toLatin1();-
469 QByteArray passwd = password.toLatin1();-
470 QByteArray dataBuf(3 + uname.size() + passwd.size(), 0);-
471 char *buf = dataBuf.data();-
472 int pos = 0;-
473 buf[pos++] = S5_PASSWORDAUTH_VERSION;-
474 buf[pos++] = uname.size();-
475 memcpy(&buf[pos], uname.data(), uname.size());-
476 pos += uname.size();-
477 buf[pos++] = passwd.size();-
478 memcpy(&buf[pos], passwd.data(), passwd.size());-
479 return socket->write(dataBuf) == dataBuf.size();
executed 89 times by 7 tests: return socket->write(dataBuf) == dataBuf.size();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
89
480}-
481-
482bool QSocks5PasswordAuthenticator::continueAuthenticate(QTcpSocket *socket, bool *completed)-
483{-
484 *completed = false;-
485-
486 if (socket->bytesAvailable() < 2)
socket->bytesAvailable() < 2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 88 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2-88
487 return true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
488-
489 QByteArray buf = socket->read(2);-
490 if (buf.at(0) == S5_PASSWORDAUTH_VERSION && buf.at(1) == 0x00) {
buf.at(0) == 0x01Description
TRUEevaluated 87 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
buf.at(1) == 0x00Description
TRUEevaluated 87 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-87
491 *completed = true;-
492 return true;
executed 87 times by 7 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
87
493 }-
494-
495 // must disconnect-
496 socket->close();-
497 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
498}-
499-
500QString QSocks5PasswordAuthenticator::errorString()-
501{-
502 return QLatin1String("Socks5 user name or password incorrect");
never executed: return QLatin1String("Socks5 user name or password incorrect");
0
503}-
504-
505-
506-
507QSocks5SocketEnginePrivate::QSocks5SocketEnginePrivate()-
508 : socks5State(Uninitialized)-
509 , readNotificationEnabled(false)-
510 , writeNotificationEnabled(false)-
511 , exceptNotificationEnabled(false)-
512 , socketDescriptor(-1)-
513 , data(0)-
514 , connectData(0)-
515#ifndef QT_NO_UDPSOCKET-
516 , udpData(0)-
517#endif-
518 , bindData(0)-
519 , readNotificationActivated(false)-
520 , writeNotificationActivated(false)-
521 , readNotificationPending(false)-
522 , writeNotificationPending(false)-
523 , connectionNotificationPending(false)-
524{-
525 mode = NoMode;-
526}
executed 726 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
726
527-
528QSocks5SocketEnginePrivate::~QSocks5SocketEnginePrivate()-
529{-
530}-
531-
532void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)-
533{-
534 Q_Q(QSocks5SocketEngine);-
535-
536 mode = socks5Mode;-
537 if (mode == ConnectMode) {
mode == ConnectModeDescription
TRUEevaluated 704 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
15-704
538 connectData = new QSocks5ConnectData;-
539 data = connectData;-
540#ifndef QT_NO_UDPSOCKET-
541 } else if (mode == UdpAssociateMode) {
executed 704 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
mode == UdpAssociateModeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
2-704
542 udpData = new QSocks5UdpAssociateData;-
543 data = udpData;-
544 udpData->udpSocket = new QUdpSocket(q);-
545#ifndef QT_NO_BEARERMANAGEMENT-
546 udpData->udpSocket->setProperty("_q_networksession", q->property("_q_networksession"));-
547#endif-
548 udpData->udpSocket->setProxy(QNetworkProxy::NoProxy);-
549 QObject::connect(udpData->udpSocket, SIGNAL(readyRead()),-
550 q, SLOT(_q_udpSocketReadNotification()),-
551 Qt::DirectConnection);-
552#endif // QT_NO_UDPSOCKET-
553 } else if (mode == BindMode) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
mode == BindModeDescription
TRUEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-13
554 bindData = new QSocks5BindData;-
555 data = bindData;-
556 }
executed 13 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
13
557-
558 data->controlSocket = new QTcpSocket(q);-
559#ifndef QT_NO_BEARERMANAGEMENT-
560 data->controlSocket->setProperty("_q_networksession", q->property("_q_networksession"));-
561#endif-
562 data->controlSocket->setProxy(QNetworkProxy::NoProxy);-
563 QObject::connect(data->controlSocket, SIGNAL(connected()), q, SLOT(_q_controlSocketConnected()),-
564 Qt::DirectConnection);-
565 QObject::connect(data->controlSocket, SIGNAL(readyRead()), q, SLOT(_q_controlSocketReadNotification()),-
566 Qt::DirectConnection);-
567 QObject::connect(data->controlSocket, SIGNAL(bytesWritten(qint64)), q, SLOT(_q_controlSocketBytesWritten()),-
568 Qt::DirectConnection);-
569 QObject::connect(data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)),-
570 q, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)),-
571 Qt::DirectConnection);-
572 QObject::connect(data->controlSocket, SIGNAL(disconnected()), q, SLOT(_q_controlSocketDisconnected()),-
573 Qt::DirectConnection);-
574 QObject::connect(data->controlSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),-
575 q, SLOT(_q_controlSocketStateChanged(QAbstractSocket::SocketState)),-
576 Qt::DirectConnection);-
577-
578 if (!proxyInfo.user().isEmpty() || !proxyInfo.password().isEmpty()) {
!proxyInfo.user().isEmpty()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 657 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
!proxyInfo.pas...rd().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 657 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-657
579 QSOCKS5_D_DEBUG << "using username/password authentication; user =" << proxyInfo.user();
dead code: QMessageLogger(__FILE__, 579, __PRETTY_FUNCTION__).debug() << "using username/password authentication; user =" << proxyInfo.user();
-
580 data->authenticator = new QSocks5PasswordAuthenticator(proxyInfo.user(), proxyInfo.password());-
581 } else {
executed 62 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
62
582 QSOCKS5_D_DEBUG << "not using authentication";
dead code: QMessageLogger(__FILE__, 582, __PRETTY_FUNCTION__).debug() << "not using authentication";
-
583 data->authenticator = new QSocks5Authenticator();-
584 }
executed 657 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
657
585}-
586-
587void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, const QString &extraMessage)-
588{-
589 Q_Q(QSocks5SocketEngine);-
590-
591 switch (state) {-
592 case Uninitialized:
never executed: case Uninitialized:
0
593 case Authenticating:
never executed: case Authenticating:
0
594 case AuthenticationMethodsSent:
never executed: case AuthenticationMethodsSent:
0
595 case RequestMethodSent:
never executed: case RequestMethodSent:
0
596 case Connected:
never executed: case Connected:
0
597 case UdpAssociateSuccess:
never executed: case UdpAssociateSuccess:
0
598 case BindSuccess:
never executed: case BindSuccess:
0
599 // these aren't error states-
600 return;
never executed: return;
0
601-
602 case ConnectError:
executed 6 times by 4 tests: case ConnectError:
Executed by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
6
603 case ControlSocketError: {
executed 37 times by 4 tests: case ControlSocketError:
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
37
604 QAbstractSocket::SocketError controlSocketError = data->controlSocket->error();-
605 if (socks5State != Connected) {
socks5State != ConnectedDescription
TRUEevaluated 43 times by 5 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-43
606 switch (controlSocketError) {-
607 case QAbstractSocket::ConnectionRefusedError:
executed 2 times by 2 tests: case QAbstractSocket::ConnectionRefusedError:
Executed by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
2
608 q->setError(QAbstractSocket::ProxyConnectionRefusedError,-
609 QSocks5SocketEngine::tr("Connection to proxy refused"));-
610 break;
executed 2 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
2
611 case QAbstractSocket::RemoteHostClosedError:
executed 30 times by 1 test: case QAbstractSocket::RemoteHostClosedError:
Executed by:
  • tst_qsocks5socketengine - unknown status
30
612 q->setError(QAbstractSocket::ProxyConnectionClosedError,-
613 QSocks5SocketEngine::tr("Connection to proxy closed prematurely"));-
614 break;
executed 30 times by 1 test: break;
Executed by:
  • tst_qsocks5socketengine - unknown status
30
615 case QAbstractSocket::HostNotFoundError:
executed 4 times by 3 tests: case QAbstractSocket::HostNotFoundError:
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
4
616 q->setError(QAbstractSocket::ProxyNotFoundError,-
617 QSocks5SocketEngine::tr("Proxy host not found"));-
618 break;
executed 4 times by 3 tests: break;
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
4
619 case QAbstractSocket::SocketTimeoutError:
executed 7 times by 3 tests: case QAbstractSocket::SocketTimeoutError:
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7
620 if (state == ConnectError) {
state == ConnectErrorDescription
TRUEnever evaluated
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-7
621 q->setError(QAbstractSocket::ProxyConnectionTimeoutError,-
622 QSocks5SocketEngine::tr("Connection to proxy timed out"));-
623 break;
never executed: break;
0
624 }-
625 /* fall through */-
626 default:
code before this statement executed 7 times by 3 tests: default:
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
never executed: default:
0-7
627 q->setError(controlSocketError, data->controlSocket->errorString());-
628 break;
executed 7 times by 3 tests: break;
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7
629 }-
630 } else {-
631 q->setError(controlSocketError, data->controlSocket->errorString());-
632 }
never executed: end of block
0
633 break;
executed 43 times by 5 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
43
634 }-
635-
636 case AuthenticatingError:
executed 6 times by 2 tests: case AuthenticatingError:
Executed by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
6
637 q->setError(QAbstractSocket::ProxyAuthenticationRequiredError,-
638 extraMessage.isEmpty() ?-
639 QSocks5SocketEngine::tr("Proxy authentication failed") :-
640 QSocks5SocketEngine::tr("Proxy authentication failed: %1").arg(extraMessage));-
641 break;
executed 6 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
6
642-
643 case RequestError:
executed 17 times by 3 tests: case RequestError:
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
17
644 // error code set by caller (overload)-
645 break;
executed 17 times by 3 tests: break;
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
17
646-
647 case SocksError:
executed 2 times by 1 test: case SocksError:
Executed by:
  • tst_qsocks5socketengine - unknown status
2
648 q->setError(QAbstractSocket::ProxyProtocolError,-
649 QSocks5SocketEngine::tr("SOCKS version 5 protocol error"));-
650 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
651-
652 case HostNameLookupError:
executed 4 times by 2 tests: case HostNameLookupError:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4
653 q->setError(QAbstractSocket::HostNotFoundError,-
654 QAbstractSocket::tr("Host not found"));-
655 break;
executed 4 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4
656 }-
657-
658 q->setState(QAbstractSocket::UnconnectedState);-
659 socks5State = state;-
660}
executed 72 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
72
661-
662void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, Socks5Error socks5error)-
663{-
664 Q_Q(QSocks5SocketEngine);-
665 switch (socks5error) {-
666 case SocksFailure:
never executed: case SocksFailure:
0
667 q->setError(QAbstractSocket::NetworkError,-
668 QSocks5SocketEngine::tr("General SOCKSv5 server failure"));-
669 break;
never executed: break;
0
670 case ConnectionNotAllowed:
executed 2 times by 1 test: case ConnectionNotAllowed:
Executed by:
  • tst_qsocks5socketengine - unknown status
2
671 q->setError(QAbstractSocket::SocketAccessError,-
672 QSocks5SocketEngine::tr("Connection not allowed by SOCKSv5 server"));-
673 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
674 case NetworkUnreachable:
executed 2 times by 1 test: case NetworkUnreachable:
Executed by:
  • tst_qsocks5socketengine - unknown status
2
675 q->setError(QAbstractSocket::NetworkError,-
676 QAbstractSocket::tr("Network unreachable"));-
677 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
678 case HostUnreachable:
executed 8 times by 3 tests: case HostUnreachable:
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
8
679 q->setError(QAbstractSocket::HostNotFoundError,-
680 QAbstractSocket::tr("Host not found"));-
681 break;
executed 8 times by 3 tests: break;
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
8
682 case ConnectionRefused:
executed 5 times by 2 tests: case ConnectionRefused:
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
5
683 q->setError(QAbstractSocket::ConnectionRefusedError,-
684 QAbstractSocket::tr("Connection refused"));-
685 break;
executed 5 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
5
686 case TTLExpired:
never executed: case TTLExpired:
0
687 q->setError(QAbstractSocket::NetworkError,-
688 QSocks5SocketEngine::tr("TTL expired"));-
689 break;
never executed: break;
0
690 case CommandNotSupported:
never executed: case CommandNotSupported:
0
691 q->setError(QAbstractSocket::UnsupportedSocketOperationError,-
692 QSocks5SocketEngine::tr("SOCKSv5 command not supported"));-
693 break;
never executed: break;
0
694 case AddressTypeNotSupported:
never executed: case AddressTypeNotSupported:
0
695 q->setError(QAbstractSocket::UnsupportedSocketOperationError,-
696 QSocks5SocketEngine::tr("Address type not supported"));-
697 break;
never executed: break;
0
698-
699 default:
never executed: default:
0
700 q->setError(QAbstractSocket::UnknownSocketError,-
701 QSocks5SocketEngine::tr("Unknown SOCKSv5 proxy error code 0x%1").arg(int(socks5error), 16));-
702 break;
never executed: break;
0
703 }-
704-
705 setErrorState(state, QString());-
706}
executed 17 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
17
707-
708void QSocks5SocketEnginePrivate::reauthenticate()-
709{-
710 Q_Q(QSocks5SocketEngine);-
711-
712 // we require authentication-
713 QAuthenticator auth;-
714 emit q->proxyAuthenticationRequired(proxyInfo, &auth);-
715-
716 if (!auth.user().isEmpty() || !auth.password().isEmpty()) {
!auth.user().isEmpty()Description
TRUEevaluated 85 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
!auth.password().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
0-85
717 // we have new credentials, let's try again-
718 QSOCKS5_DEBUG << "authentication failure: retrying connection";
dead code: QMessageLogger(__FILE__, 718, __PRETTY_FUNCTION__).debug() << "authentication failure: retrying connection";
-
719 socks5State = QSocks5SocketEnginePrivate::Uninitialized;-
720-
721 delete data->authenticator;-
722 proxyInfo.setUser(auth.user());-
723 proxyInfo.setPassword(auth.password());-
724 data->authenticator = new QSocks5PasswordAuthenticator(proxyInfo.user(), proxyInfo.password());-
725-
726 {-
727 const QSignalBlocker blocker(data->controlSocket);-
728 data->controlSocket->abort();-
729 }-
730 data->controlSocket->connectToHost(proxyInfo.hostName(), proxyInfo.port());-
731 } else {
executed 85 times by 7 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
85
732 // authentication failure-
733-
734 setErrorState(AuthenticatingError);-
735 data->controlSocket->close();-
736 emitConnectionNotification();-
737 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
4
738}-
739-
740void QSocks5SocketEnginePrivate::parseAuthenticationMethodReply()-
741{-
742 // not enough data to begin-
743 if (data->controlSocket->bytesAvailable() < 2)
data->controlS...vailable() < 2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 794 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2-794
744 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
745-
746 QByteArray buf = data->controlSocket->read(2);-
747 if (buf.at(0) != S5_VERSION_5) {
buf.at(0) != 0x05Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 793 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1-793
748 QSOCKS5_D_DEBUG << "Socks5 version incorrect";
dead code: QMessageLogger(__FILE__, 748, __PRETTY_FUNCTION__).debug() << "Socks5 version incorrect";
-
749 setErrorState(SocksError);-
750 data->controlSocket->close();-
751 emitConnectionNotification();-
752 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
753 }-
754-
755 bool authComplete = false;-
756 if (uchar(buf.at(1)) == S5_AUTHMETHOD_NONE) {
uchar(buf.at(1)) == 0x00Description
TRUEevaluated 614 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 179 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
179-614
757 authComplete = true;-
758 } else if (uchar(buf.at(1)) == S5_AUTHMETHOD_NOTACCEPTABLE) {
executed 614 times by 8 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
uchar(buf.at(1)) == 0xFFDescription
TRUEevaluated 88 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 91 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
88-614
759 reauthenticate();-
760 return;
executed 88 times by 7 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
88
761 } else if (buf.at(1) != data->authenticator->methodId()
buf.at(1) != d...or->methodId()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 89 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2-89
762 || !data->authenticator->beginAuthenticate(data->controlSocket, &authComplete)) {
!data->authent...&authComplete)Description
TRUEnever evaluated
FALSEevaluated 89 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-89
763 setErrorState(AuthenticatingError, QLatin1String("Socks5 host did not support authentication method."));-
764 socketError = QAbstractSocket::SocketAccessError; // change the socket error-
765 emitConnectionNotification();-
766 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
767 }-
768-
769 if (authComplete)
authCompleteDescription
TRUEevaluated 614 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 89 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
89-614
770 sendRequestMethod();
executed 614 times by 8 tests: sendRequestMethod();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
614
771 else-
772 socks5State = Authenticating;
executed 89 times by 7 tests: socks5State = Authenticating;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
89
773}-
774-
775void QSocks5SocketEnginePrivate::parseAuthenticatingReply()-
776{-
777 bool authComplete = false;-
778 if (!data->authenticator->continueAuthenticate(data->controlSocket, &authComplete)) {
!data->authent...&authComplete)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 89 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1-89
779 reauthenticate();-
780 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
781 }-
782 if (authComplete)
authCompleteDescription
TRUEevaluated 87 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-87
783 sendRequestMethod();
executed 87 times by 7 tests: sendRequestMethod();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
87
784}
executed 89 times by 7 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
89
785-
786void QSocks5SocketEnginePrivate::sendRequestMethod()-
787{-
788 QHostAddress address;-
789 quint16 port = 0;-
790 char command = 0;-
791 if (mode == ConnectMode) {
mode == ConnectModeDescription
TRUEevaluated 688 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
13-688
792 command = S5_CONNECT;-
793 address = peerAddress;-
794 port = peerPort;-
795 } else if (mode == BindMode) {
executed 688 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
mode == BindModeDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-688
796 command = S5_BIND;-
797 address = localAddress;-
798 port = localPort;-
799 } else {
executed 11 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
11
800#ifndef QT_NO_UDPSOCKET-
801 command = S5_UDP_ASSOCIATE;-
802 address = localAddress; //data->controlSocket->localAddress();-
803 port = localPort;-
804#endif-
805 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
2
806-
807 QByteArray buf;-
808 buf.reserve(270); // big enough for domain name;-
809 buf[0] = S5_VERSION_5;-
810 buf[1] = command;-
811 buf[2] = 0x00;-
812 if (peerName.isEmpty() && !qt_socks5_set_host_address_and_port(address, port, &buf)) {
peerName.isEmpty()Description
TRUEevaluated 244 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 457 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
!qt_socks5_set...s, port, &buf)Description
TRUEnever evaluated
FALSEevaluated 244 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-457
813 QSOCKS5_DEBUG << "error setting address" << address << " : " << port;
dead code: QMessageLogger(__FILE__, 813, __PRETTY_FUNCTION__).debug() << "error setting address" << address << " : " << port;
-
814 //### set error code ....-
815 return;
never executed: return;
0
816 } else if (!peerName.isEmpty() && !qt_socks5_set_host_name_and_port(peerName, port, &buf)) {
!peerName.isEmpty()Description
TRUEevaluated 457 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 244 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
!qt_socks5_set...e, port, &buf)Description
TRUEnever evaluated
FALSEevaluated 457 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-457
817 QSOCKS5_DEBUG << "error setting peer name" << peerName << " : " << port;
dead code: QMessageLogger(__FILE__, 817, __PRETTY_FUNCTION__).debug() << "error setting peer name" << peerName << " : " << port;
-
818 //### set error code ....-
819 return;
never executed: return;
0
820 }-
821 QSOCKS5_DEBUG << "sending" << dump(buf);
dead code: QMessageLogger(__FILE__, 821, __PRETTY_FUNCTION__).debug() << "sending" << dump(buf);
-
822 QByteArray sealedBuf;-
823 if (!data->authenticator->seal(buf, &sealedBuf)) {
!data->authent...f, &sealedBuf)Description
TRUEnever evaluated
FALSEevaluated 701 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-701
824 // ### Handle this error.-
825 }
never executed: end of block
0
826 data->controlSocket->write(sealedBuf);-
827 data->controlSocket->flush();-
828 socks5State = RequestMethodSent;-
829}
executed 701 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
701
830-
831void QSocks5SocketEnginePrivate::parseRequestMethodReply()-
832{-
833 Q_Q(QSocks5SocketEngine);-
834 QSOCKS5_DEBUG << "parseRequestMethodReply()";
dead code: QMessageLogger(__FILE__, 834, __PRETTY_FUNCTION__).debug() << "parseRequestMethodReply()";
-
835-
836 QByteArray inBuf;-
837 if (!data->authenticator->unSeal(data->controlSocket, &inBuf)) {
!data->authent...ocket, &inBuf)Description
TRUEnever evaluated
FALSEevaluated 727 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
0-727
838 // ### check error and not just not enough data-
839 QSOCKS5_DEBUG << "unSeal failed, needs more data";
dead code: QMessageLogger(__FILE__, 839, __PRETTY_FUNCTION__).debug() << "unSeal failed, needs more data";
-
840 return;
never executed: return;
0
841 }-
842-
843 inBuf.prepend(receivedHeaderFragment);-
844 receivedHeaderFragment.clear();-
845 QSOCKS5_DEBUG << dump(inBuf);
dead code: QMessageLogger(__FILE__, 845, __PRETTY_FUNCTION__).debug() << dump(inBuf);
-
846 if (inBuf.size() < 3) {
inBuf.size() < 3Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 719 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
8-719
847 QSOCKS5_DEBUG << "need more data for request reply header .. put this data somewhere";
dead code: QMessageLogger(__FILE__, 847, __PRETTY_FUNCTION__).debug() << "need more data for request reply header .. put this data somewhere";
-
848 receivedHeaderFragment = inBuf;-
849 return;
executed 8 times by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
8
850 }-
851-
852 QHostAddress address;-
853 quint16 port = 0;-
854-
855 if (inBuf.at(0) != S5_VERSION_5 || inBuf.at(2) != 0x00) {
inBuf.at(0) != 0x05Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 718 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
inBuf.at(2) != 0x00Description
TRUEnever evaluated
FALSEevaluated 718 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
0-718
856 QSOCKS5_DEBUG << "socks protocol error";
dead code: QMessageLogger(__FILE__, 856, __PRETTY_FUNCTION__).debug() << "socks protocol error";
-
857 setErrorState(SocksError);-
858 } else if (inBuf.at(1) != S5_SUCCESS) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
inBuf.at(1) != 0x00Description
TRUEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
FALSEevaluated 697 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
1-697
859 Socks5Error socks5Error = Socks5Error(inBuf.at(1));-
860 QSOCKS5_DEBUG << "Request error :" << socks5Error;
dead code: QMessageLogger(__FILE__, 860, __PRETTY_FUNCTION__).debug() << "Request error :" << socks5Error;
-
861 if ((socks5Error == SocksFailure || socks5Error == ConnectionNotAllowed)
socks5Error == SocksFailureDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
socks5Error ==...tionNotAllowedDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
2-19
862 && !peerName.isEmpty()) {
!peerName.isEmpty()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-4
863 // Dante seems to use this error code to indicate hostname resolution failure-
864 setErrorState(HostNameLookupError);-
865 } else {
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4
866 setErrorState(RequestError, socks5Error);-
867 }
executed 17 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
17
868 } else {-
869 // connection success, retrieve the remote addresses-
870 int pos = 3;-
871 int err = qt_socks5_get_host_address_and_port(inBuf, &address, &port, &pos);-
872 if (err == -1) {
err == -1Description
TRUEnever evaluated
FALSEevaluated 697 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-697
873 QSOCKS5_DEBUG << "error getting address";
dead code: QMessageLogger(__FILE__, 873, __PRETTY_FUNCTION__).debug() << "error getting address";
-
874 setErrorState(SocksError);-
875 } else if (err == 0) {
never executed: end of block
err == 0Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 649 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-649
876 //need more data-
877 receivedHeaderFragment = inBuf;-
878 return;
executed 48 times by 1 test: return;
Executed by:
  • tst_qsocks5socketengine - unknown status
48
879 } else {-
880 inBuf.remove(0, pos);-
881 for (int i = inBuf.size() - 1; i >= 0 ; --i)
i >= 0Description
TRUEnever evaluated
FALSEevaluated 649 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-649
882 data->controlSocket->ungetChar(inBuf.at(i));
never executed: data->controlSocket->ungetChar(inBuf.at(i));
0
883 }
executed 649 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
649
884 }-
885-
886 if (socks5State == RequestMethodSent) {
socks5State ==...uestMethodSentDescription
TRUEevaluated 647 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
24-647
887 // no error-
888 localAddress = address;-
889 localPort = port;-
890-
891 if (mode == ConnectMode) {
mode == ConnectModeDescription
TRUEevaluated 634 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
13-634
892 inboundStreamCount = outboundStreamCount = 1;-
893 socks5State = Connected;-
894 // notify the upper layer that we're done-
895 q->setState(QAbstractSocket::ConnectedState);-
896 emitConnectionNotification();-
897 } else if (mode == BindMode) {
executed 634 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
mode == BindModeDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-634
898 socks5State = BindSuccess;-
899 q->setState(QAbstractSocket::ListeningState);-
900 } else {
executed 11 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
11
901 socks5State = UdpAssociateSuccess;-
902 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
2
903 } else if (socks5State == BindSuccess) {
socks5State == BindSuccessDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 22 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
2-22
904 // no error and we got a connection-
905 bindData->peerAddress = address;-
906 bindData->peerPort = port;-
907-
908 emitReadNotification();-
909 } else {
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
2
910 // got an error-
911 data->controlSocket->close();-
912 emitConnectionNotification();-
913 }
executed 22 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
22
914}-
915-
916void QSocks5SocketEnginePrivate::_q_emitPendingReadNotification()-
917{-
918 Q_Q(QSocks5SocketEngine);-
919 readNotificationPending = false;-
920 if (readNotificationEnabled) {
readNotificationEnabledDescription
TRUEevaluated 3105 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-3105
921 QSOCKS5_D_DEBUG << "emitting readNotification";
dead code: QMessageLogger(__FILE__, 921, __PRETTY_FUNCTION__).debug() << "emitting readNotification";
-
922 QPointer<QSocks5SocketEngine> qq = q;-
923 emit q->readNotification();-
924 if (!qq)
!qqDescription
TRUEevaluated 356 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2749 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
356-2749
925 return;
executed 356 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
356
926 // check if there needs to be a new zero read notification-
927 if (data && data->controlSocket->state() == QAbstractSocket::UnconnectedState
dataDescription
TRUEevaluated 2745 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
data->controlS...connectedStateDescription
TRUEnever evaluated
FALSEevaluated 2745 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
0-2745
928 && data->controlSocket->error() == QAbstractSocket::RemoteHostClosedError) {
data->controlS...ostClosedErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
929 connectData->readBuffer.clear();-
930 emitReadNotification();-
931 }
never executed: end of block
0
932 }
executed 2749 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
2749
933}
executed 2749 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
2749
934-
935void QSocks5SocketEnginePrivate::emitReadNotification()-
936{-
937 Q_Q(QSocks5SocketEngine);-
938 readNotificationActivated = true;-
939 if (readNotificationEnabled && !readNotificationPending) {
readNotificationEnabledDescription
TRUEevaluated 3282 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
!readNotificationPendingDescription
TRUEevaluated 3193 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEevaluated 89 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
24-3282
940 QSOCKS5_D_DEBUG << "queueing readNotification";
dead code: QMessageLogger(__FILE__, 940, __PRETTY_FUNCTION__).debug() << "queueing readNotification";
-
941 readNotificationPending = true;-
942 QMetaObject::invokeMethod(q, "_q_emitPendingReadNotification", Qt::QueuedConnection);-
943 }
executed 3193 times by 5 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
3193
944}
executed 3306 times by 6 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
3306
945-
946void QSocks5SocketEnginePrivate::_q_emitPendingWriteNotification()-
947{-
948 writeNotificationPending = false;-
949 Q_Q(QSocks5SocketEngine);-
950 if (writeNotificationEnabled) {
writeNotificationEnabledDescription
TRUEevaluated 2135 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEevaluated 1616 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
1616-2135
951 QSOCKS5_D_DEBUG << "emitting writeNotification";
dead code: QMessageLogger(__FILE__, 951, __PRETTY_FUNCTION__).debug() << "emitting writeNotification";
-
952 emit q->writeNotification();-
953 }
executed 2135 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
2135
954}
executed 3751 times by 4 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
3751
955-
956void QSocks5SocketEnginePrivate::emitWriteNotification()-
957{-
958 Q_Q(QSocks5SocketEngine);-
959 writeNotificationActivated = true;-
960 if (writeNotificationEnabled && !writeNotificationPending) {
writeNotificationEnabledDescription
TRUEevaluated 4402 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 357 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
!writeNotificationPendingDescription
TRUEevaluated 3883 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 519 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
357-4402
961 QSOCKS5_D_DEBUG << "queueing writeNotification";
dead code: QMessageLogger(__FILE__, 961, __PRETTY_FUNCTION__).debug() << "queueing writeNotification";
-
962 writeNotificationPending = true;-
963 QMetaObject::invokeMethod(q, "_q_emitPendingWriteNotification", Qt::QueuedConnection);-
964 }
executed 3883 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
3883
965}
executed 4759 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
4759
966-
967void QSocks5SocketEnginePrivate::_q_emitPendingConnectionNotification()-
968{-
969 connectionNotificationPending = false;-
970 Q_Q(QSocks5SocketEngine);-
971 QSOCKS5_D_DEBUG << "emitting connectionNotification";
dead code: QMessageLogger(__FILE__, 971, __PRETTY_FUNCTION__).debug() << "emitting connectionNotification";
-
972 emit q->connectionNotification();-
973}
executed 598 times by 5 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
598
974-
975void QSocks5SocketEnginePrivate::emitConnectionNotification()-
976{-
977 Q_Q(QSocks5SocketEngine);-
978 QSOCKS5_D_DEBUG << "queueing connectionNotification";
dead code: QMessageLogger(__FILE__, 978, __PRETTY_FUNCTION__).debug() << "queueing connectionNotification";
-
979 connectionNotificationPending = true;-
980 QMetaObject::invokeMethod(q, "_q_emitPendingConnectionNotification", Qt::QueuedConnection);-
981}
executed 699 times by 8 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
699
982-
983QSocks5SocketEngine::QSocks5SocketEngine(QObject *parent)-
984:QAbstractSocketEngine(*new QSocks5SocketEnginePrivate(), parent)-
985{-
986}
executed 726 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
726
987-
988QSocks5SocketEngine::~QSocks5SocketEngine()-
989{-
990 Q_D(QSocks5SocketEngine);-
991-
992 if (d->data) {
d->dataDescription
TRUEevaluated 719 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
7-719
993 delete d->data->authenticator;-
994 delete d->data->controlSocket;-
995 }
executed 719 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
719
996 if (d->connectData)
d->connectDataDescription
TRUEevaluated 710 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 16 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
16-710
997 delete d->connectData;
executed 710 times by 9 tests: delete d->connectData;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
710
998#ifndef QT_NO_UDPSOCKET-
999 if (d->udpData) {
d->udpDataDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 724 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2-724
1000 delete d->udpData->udpSocket;-
1001 delete d->udpData;-
1002 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
2
1003#endif-
1004 if (d->bindData)
d->bindDataDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTcpServer
FALSEevaluated 719 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7-719
1005 delete d->bindData;
executed 7 times by 1 test: delete d->bindData;
Executed by:
  • tst_QTcpServer
7
1006}
executed 726 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
726
1007-
1008static QBasicAtomicInt descriptorCounter = Q_BASIC_ATOMIC_INITIALIZER(1);-
1009-
1010bool QSocks5SocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol)-
1011{-
1012 Q_D(QSocks5SocketEngine);-
1013-
1014 d->socketDescriptor = descriptorCounter.fetchAndAddRelaxed(1);-
1015-
1016 d->socketType = type;-
1017 d->socketProtocol = protocol;-
1018-
1019 return true;
executed 720 times by 9 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
720
1020}-
1021-
1022bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)-
1023{-
1024 Q_D(QSocks5SocketEngine);-
1025-
1026 QSOCKS5_Q_DEBUG << "initialize" << socketDescriptor;
dead code: QMessageLogger(__FILE__, 1026, __PRETTY_FUNCTION__).debug() << "initialize" << socketDescriptor;
-
1027-
1028 // this is only valid for the other side of a bind, nothing else is supported-
1029-
1030 if (socketState != QAbstractSocket::ConnectedState) {
socketState !=...ConnectedStateDescription
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
0-6
1031 //### must be connected state ???-
1032 return false;
never executed: return false;
0
1033 }-
1034-
1035 QSocks5BindData *bindData = socks5BindStore()->retrieve(socketDescriptor);-
1036 if (bindData) {
bindDataDescription
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-6
1037-
1038 d->socketState = QAbstractSocket::ConnectedState;-
1039 d->socketType = QAbstractSocket::TcpSocket;-
1040 d->connectData = new QSocks5ConnectData;-
1041 d->data = d->connectData;-
1042 d->mode = QSocks5SocketEnginePrivate::ConnectMode;-
1043 d->data->controlSocket = bindData->controlSocket;-
1044 bindData->controlSocket = 0;-
1045 d->data->controlSocket->setParent(this);-
1046 d->socketProtocol = d->data->controlSocket->localAddress().protocol();-
1047 d->data->authenticator = bindData->authenticator;-
1048 bindData->authenticator = 0;-
1049 d->localPort = bindData->localPort;-
1050 d->localAddress = bindData->localAddress;-
1051 d->peerPort = bindData->peerPort;-
1052 d->peerAddress = bindData->peerAddress;-
1053 d->inboundStreamCount = d->outboundStreamCount = 1;-
1054 delete bindData;-
1055-
1056 QObject::connect(d->data->controlSocket, SIGNAL(connected()), this, SLOT(_q_controlSocketConnected()),-
1057 Qt::DirectConnection);-
1058 QObject::connect(d->data->controlSocket, SIGNAL(readyRead()), this, SLOT(_q_controlSocketReadNotification()),-
1059 Qt::DirectConnection);-
1060 QObject::connect(d->data->controlSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_controlSocketBytesWritten()),-
1061 Qt::DirectConnection);-
1062 QObject::connect(d->data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)),-
1063 Qt::DirectConnection);-
1064 QObject::connect(d->data->controlSocket, SIGNAL(disconnected()), this, SLOT(_q_controlSocketDisconnected()),-
1065 Qt::DirectConnection);-
1066 QObject::connect(d->data->controlSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),-
1067 this, SLOT(_q_controlSocketStateChanged(QAbstractSocket::SocketState)),-
1068 Qt::DirectConnection);-
1069-
1070 d->socks5State = QSocks5SocketEnginePrivate::Connected;-
1071-
1072 if (d->data->controlSocket->bytesAvailable() != 0)
d->data->contr...ailable() != 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
0-6
1073 d->_q_controlSocketReadNotification();
never executed: d->_q_controlSocketReadNotification();
0
1074 return true;
executed 6 times by 3 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
1075 }-
1076 return false;
never executed: return false;
0
1077}-
1078-
1079void QSocks5SocketEngine::setProxy(const QNetworkProxy &networkProxy)-
1080{-
1081 Q_D(QSocks5SocketEngine);-
1082 d->proxyInfo = networkProxy;-
1083}
executed 719 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
719
1084-
1085qintptr QSocks5SocketEngine::socketDescriptor() const-
1086{-
1087 Q_D(const QSocks5SocketEngine);-
1088 return d->socketDescriptor;
executed 1090 times by 9 tests: return d->socketDescriptor;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1090
1089}-
1090-
1091bool QSocks5SocketEngine::isValid() const-
1092{-
1093 Q_D(const QSocks5SocketEngine);-
1094 return d->socketType != QAbstractSocket::UnknownSocketType
executed 9767 times by 6 tests: return d->socketType != QAbstractSocket::UnknownSocketType && d->socks5State != QSocks5SocketEnginePrivate::SocksError && (d->socketError == QAbstractSocket::UnknownSocketError || d->socketError == QAbstractSocket::SocketTimeoutError || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
9767
1095 && d->socks5State != QSocks5SocketEnginePrivate::SocksError
executed 9767 times by 6 tests: return d->socketType != QAbstractSocket::UnknownSocketType && d->socks5State != QSocks5SocketEnginePrivate::SocksError && (d->socketError == QAbstractSocket::UnknownSocketError || d->socketError == QAbstractSocket::SocketTimeoutError || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
9767
1096 && (d->socketError == QAbstractSocket::UnknownSocketError
executed 9767 times by 6 tests: return d->socketType != QAbstractSocket::UnknownSocketType && d->socks5State != QSocks5SocketEnginePrivate::SocksError && (d->socketError == QAbstractSocket::UnknownSocketError || d->socketError == QAbstractSocket::SocketTimeoutError || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
9767
1097 || d->socketError == QAbstractSocket::SocketTimeoutError
executed 9767 times by 6 tests: return d->socketType != QAbstractSocket::UnknownSocketType && d->socks5State != QSocks5SocketEnginePrivate::SocksError && (d->socketError == QAbstractSocket::UnknownSocketError || d->socketError == QAbstractSocket::SocketTimeoutError || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
9767
1098 || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
executed 9767 times by 6 tests: return d->socketType != QAbstractSocket::UnknownSocketType && d->socks5State != QSocks5SocketEnginePrivate::SocksError && (d->socketError == QAbstractSocket::UnknownSocketError || d->socketError == QAbstractSocket::SocketTimeoutError || d->socketError == QAbstractSocket::UnfinishedSocketOperationError);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
9767
1099}-
1100-
1101bool QSocks5SocketEngine::connectInternal()-
1102{-
1103 Q_D(QSocks5SocketEngine);-
1104-
1105 if (!d->data) {
!d->dataDescription
TRUEevaluated 705 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
4-705
1106 if (socketType() == QAbstractSocket::TcpSocket) {
socketType() =...ket::TcpSocketDescription
TRUEevaluated 704 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-704
1107 d->initialize(QSocks5SocketEnginePrivate::ConnectMode);-
1108#ifndef QT_NO_UDPSOCKET-
1109 } else if (socketType() == QAbstractSocket::UdpSocket) {
executed 704 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
socketType() =...ket::UdpSocketDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-704
1110 d->initialize(QSocks5SocketEnginePrivate::UdpAssociateMode);-
1111 // all udp needs to be bound-
1112 if (!bind(QHostAddress(QLatin1String("0.0.0.0")), 0))
!bind(QHostAdd...0.0.0.0")), 0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-1
1113 return false;
never executed: return false;
0
1114-
1115 setState(QAbstractSocket::ConnectedState);-
1116 return true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
1117#endif-
1118 } else {-
1119 qFatal("QSocks5SocketEngine::connectToHost: in QTcpServer mode");-
1120 return false;
never executed: return false;
0
1121 }-
1122 }-
1123-
1124 if (d->socketState != QAbstractSocket::ConnectingState) {
d->socketState...onnectingStateDescription
TRUEevaluated 708 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-708
1125 if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized
d->socks5State...:UninitializedDescription
TRUEevaluated 704 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsocks5socketengine - unknown status
4-704
1126 // We may have new auth credentials since an earlier failure:-
1127 || d->socks5State == QSocks5SocketEnginePrivate::AuthenticatingError) {
d->socks5State...nticatingErrorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2
1128 setState(QAbstractSocket::ConnectingState);-
1129 //limit buffer in internal socket, data is buffered in the external socket under application control-
1130 d->data->controlSocket->setReadBufferSize(65536);-
1131 }
executed 706 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
706
1132-
1133 d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port());-
1134 }
executed 708 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
708
1135-
1136 return false;
executed 708 times by 9 tests: return false;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
708
1137}-
1138-
1139bool QSocks5SocketEngine::connectToHost(const QHostAddress &address, quint16 port)-
1140{-
1141 Q_D(QSocks5SocketEngine);-
1142 QSOCKS5_DEBUG << "connectToHost" << address << ':' << port;
dead code: QMessageLogger(__FILE__, 1142, __PRETTY_FUNCTION__).debug() << "connectToHost" << address << ':' << port;
-
1143-
1144 setPeerAddress(address);-
1145 setPeerPort(port);-
1146 d->peerName.clear();-
1147-
1148 return connectInternal();
executed 249 times by 5 tests: return connectInternal();
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
249
1149}-
1150-
1151bool QSocks5SocketEngine::connectToHostByName(const QString &hostname, quint16 port)-
1152{-
1153 Q_D(QSocks5SocketEngine);-
1154-
1155 setPeerAddress(QHostAddress());-
1156 setPeerPort(port);-
1157 d->peerName = hostname;-
1158-
1159 return connectInternal();
executed 460 times by 7 tests: return connectInternal();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
460
1160}-
1161-
1162void QSocks5SocketEnginePrivate::_q_controlSocketConnected()-
1163{-
1164 QSOCKS5_DEBUG << "_q_controlSocketConnected";
dead code: QMessageLogger(__FILE__, 1164, __PRETTY_FUNCTION__).debug() << "_q_controlSocketConnected";
-
1165 QByteArray buf(3, 0);-
1166 buf[0] = S5_VERSION_5;-
1167 buf[1] = 0x01;-
1168 buf[2] = data->authenticator->methodId();-
1169 data->controlSocket->write(buf);-
1170 socks5State = AuthenticationMethodsSent;-
1171}
executed 798 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
798
1172-
1173void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification()-
1174{-
1175 QSOCKS5_D_DEBUG << "_q_controlSocketReadNotification socks5state" << s5StateToString(socks5State)
dead code: QMessageLogger(__FILE__, 1175, __PRETTY_FUNCTION__).debug() << "_q_controlSocketReadNotification socks5state" << s5StateToString(socks5State) << "bytes available" << data->controlSocket->bytesAvailable();
-
1176 << "bytes available" << data->controlSocket->bytesAvailable();
dead code: QMessageLogger(__FILE__, 1175, __PRETTY_FUNCTION__).debug() << "_q_controlSocketReadNotification socks5state" << s5StateToString(socks5State) << "bytes available" << data->controlSocket->bytesAvailable();
-
1177-
1178 if (data->controlSocket->bytesAvailable() == 0) {
data->controlS...ailable() == 0Description
TRUEnever evaluated
FALSEevaluated 4541 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-4541
1179 QSOCKS5_D_DEBUG << "########## bogus read why do we get these ... on windows only";
dead code: QMessageLogger(__FILE__, 1179, __PRETTY_FUNCTION__).debug() << "########## bogus read why do we get these ... on windows only";
-
1180 return;
never executed: return;
0
1181 }-
1182-
1183 switch (socks5State) {-
1184 case AuthenticationMethodsSent:
executed 796 times by 9 tests: case AuthenticationMethodsSent:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
796
1185 parseAuthenticationMethodReply();-
1186 break;
executed 796 times by 9 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
796
1187 case Authenticating:
executed 90 times by 7 tests: case Authenticating:
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
90
1188 parseAuthenticatingReply();-
1189 break;
executed 90 times by 7 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
90
1190 case RequestMethodSent:
executed 725 times by 8 tests: case RequestMethodSent:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
725
1191 parseRequestMethodReply();-
1192 break;
executed 725 times by 8 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
725
1193 case Connected: {
executed 2928 times by 6 tests: case Connected:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
2928
1194 QByteArray buf;-
1195 if (!data->authenticator->unSeal(data->controlSocket, &buf)) {
!data->authent...lSocket, &buf)Description
TRUEnever evaluated
FALSEevaluated 2928 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-2928
1196 // qDebug("unseal error maybe need to wait for more data");-
1197 }
never executed: end of block
0
1198 if (buf.size()) {
buf.size()Description
TRUEevaluated 2928 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-2928
1199 QSOCKS5_DEBUG << dump(buf);
dead code: QMessageLogger(__FILE__, 1199, __PRETTY_FUNCTION__).debug() << dump(buf);
-
1200 connectData->readBuffer += buf;-
1201 emitReadNotification();-
1202 }
executed 2928 times by 6 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
2928
1203 break;
executed 2928 times by 6 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
2928
1204 }-
1205 case BindSuccess:
executed 2 times by 2 tests: case BindSuccess:
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
2
1206 // only get here if command is bind-
1207 if (mode == BindMode) {
mode == BindModeDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-2
1208 parseRequestMethodReply();-
1209 break;
executed 2 times by 2 tests: break;
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
2
1210 }-
1211-
1212 // fall through-
1213 default:
code before this statement never executed: default:
never executed: default:
0
1214 qWarning("QSocks5SocketEnginePrivate::_q_controlSocketReadNotification: "-
1215 "Unexpectedly received data while in state=%d and mode=%d",-
1216 socks5State, mode);-
1217 break;
never executed: break;
0
1218 };-
1219}-
1220-
1221void QSocks5SocketEnginePrivate::_q_controlSocketBytesWritten()-
1222{-
1223 QSOCKS5_DEBUG << "_q_controlSocketBytesWritten";
dead code: QMessageLogger(__FILE__, 1223, __PRETTY_FUNCTION__).debug() << "_q_controlSocketBytesWritten";
-
1224-
1225 if (socks5State != Connected
socks5State != ConnectedDescription
TRUEevaluated 1588 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1886 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
1588-1886
1226 || (mode == ConnectMode
mode == ConnectModeDescription
TRUEevaluated 1886 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-1886
1227 && data->controlSocket->bytesToWrite()))
data->controlS...bytesToWrite()Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
FALSEevaluated 1883 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
3-1883
1228 return;
executed 1591 times by 9 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1591
1229 if (data->controlSocket->bytesToWrite() < MaxWriteBufferSize) {
data->controlS...riteBufferSizeDescription
TRUEevaluated 1883 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-1883
1230 emitWriteNotification();-
1231 writeNotificationActivated = false;-
1232 }
executed 1883 times by 6 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
1883
1233}
executed 1883 times by 6 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
1883
1234-
1235void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketError error)-
1236{-
1237 QSOCKS5_D_DEBUG << "controlSocketError" << error << data->controlSocket->errorString();
dead code: QMessageLogger(__FILE__, 1237, __PRETTY_FUNCTION__).debug() << "controlSocketError" << error << data->controlSocket->errorString();
-
1238-
1239 if (error == QAbstractSocket::SocketTimeoutError)
error == QAbst...etTimeoutErrorDescription
TRUEevaluated 33 times by 5 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 391 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
33-391
1240 return; // ignore this error -- comes from the waitFor* functions
executed 33 times by 5 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
33
1241-
1242 if (error == QAbstractSocket::RemoteHostClosedError
error == QAbst...ostClosedErrorDescription
TRUEevaluated 383 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
8-383
1243 && socks5State == Connected) {
socks5State == ConnectedDescription
TRUEevaluated 353 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
30-353
1244 // clear the read buffer in connect mode so that bytes available returns 0-
1245 // if there already is a read notification pending then this will be processed first-
1246 if (!readNotificationPending)
!readNotificationPendingDescription
TRUEevaluated 351 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
2-351
1247 connectData->readBuffer.clear();
executed 351 times by 2 tests: connectData->readBuffer.clear();
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
351
1248 emitReadNotification();-
1249 data->controlSocket->close();-
1250 // cause a disconnect in the outer socket-
1251 emitWriteNotification();-
1252 } else if (socks5State == Uninitialized
executed 353 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
socks5State == UninitializedDescription
TRUEevaluated 6 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
6-353
1253 || socks5State == AuthenticationMethodsSent
socks5State ==...ionMethodsSentDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-31
1254 || socks5State == Authenticating
socks5State == AuthenticatingDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-30
1255 || socks5State == RequestMethodSent) {
socks5State ==...uestMethodSentDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-28
1256 setErrorState(socks5State == Uninitialized ? ConnectError : ControlSocketError);-
1257 data->controlSocket->close();-
1258 emitConnectionNotification();-
1259 } else {
executed 36 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
36
1260 q_func()->setError(data->controlSocket->error(), data->controlSocket->errorString());-
1261 emitReadNotification();-
1262 emitWriteNotification();-
1263 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
2
1264}-
1265-
1266void QSocks5SocketEnginePrivate::_q_controlSocketDisconnected()-
1267{-
1268 QSOCKS5_D_DEBUG << "_q_controlSocketDisconnected";
dead code: QMessageLogger(__FILE__, 1268, __PRETTY_FUNCTION__).debug() << "_q_controlSocketDisconnected";
-
1269}
executed 713 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
713
1270-
1271void QSocks5SocketEnginePrivate::_q_controlSocketStateChanged(QAbstractSocket::SocketState state)-
1272{-
1273 QSOCKS5_D_DEBUG << "_q_controlSocketStateChanged" << state;
dead code: QMessageLogger(__FILE__, 1273, __PRETTY_FUNCTION__).debug() << "_q_controlSocketStateChanged" << state;
-
1274}
executed 3835 times by 9 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
3835
1275-
1276#ifndef QT_NO_UDPSOCKET-
1277void QSocks5SocketEnginePrivate::checkForDatagrams() const-
1278{-
1279 // udp should be unbuffered so we need to do some polling at certain points-
1280 if (udpData->udpSocket->hasPendingDatagrams())
udpData->udpSo...ingDatagrams()Description
TRUEnever evaluated
FALSEnever evaluated
0
1281 const_cast<QSocks5SocketEnginePrivate *>(this)->_q_udpSocketReadNotification();
never executed: const_cast<QSocks5SocketEnginePrivate *>(this)->_q_udpSocketReadNotification();
0
1282}
never executed: end of block
0
1283-
1284void QSocks5SocketEnginePrivate::_q_udpSocketReadNotification()-
1285{-
1286 QSOCKS5_D_DEBUG << "_q_udpSocketReadNotification()";
dead code: QMessageLogger(__FILE__, 1286, __PRETTY_FUNCTION__).debug() << "_q_udpSocketReadNotification()";
-
1287-
1288 // check some state stuff-
1289 if (!udpData->udpSocket->hasPendingDatagrams()) {
!udpData->udpS...ingDatagrams()Description
TRUEnever evaluated
FALSEnever evaluated
0
1290 QSOCKS5_D_DEBUG << "false read ??";
dead code: QMessageLogger(__FILE__, 1290, __PRETTY_FUNCTION__).debug() << "false read ??";
-
1291 return;
never executed: return;
0
1292 }-
1293-
1294 while (udpData->udpSocket->hasPendingDatagrams()) {
udpData->udpSo...ingDatagrams()Description
TRUEnever evaluated
FALSEnever evaluated
0
1295 QByteArray sealedBuf(udpData->udpSocket->pendingDatagramSize(), 0);-
1296 QSOCKS5_D_DEBUG << "new datagram";
dead code: QMessageLogger(__FILE__, 1296, __PRETTY_FUNCTION__).debug() << "new datagram";
-
1297 udpData->udpSocket->readDatagram(sealedBuf.data(), sealedBuf.size());-
1298 QByteArray inBuf;-
1299 if (!data->authenticator->unSeal(sealedBuf, &inBuf)) {
!data->authent...edBuf, &inBuf)Description
TRUEnever evaluated
FALSEnever evaluated
0
1300 QSOCKS5_D_DEBUG << "failed unsealing datagram discarding";
dead code: QMessageLogger(__FILE__, 1300, __PRETTY_FUNCTION__).debug() << "failed unsealing datagram discarding";
-
1301 return;
never executed: return;
0
1302 }-
1303 QSOCKS5_DEBUG << dump(inBuf);
dead code: QMessageLogger(__FILE__, 1303, __PRETTY_FUNCTION__).debug() << dump(inBuf);
-
1304 int pos = 0;-
1305 const char *buf = inBuf.constData();-
1306 if (inBuf.size() < 4) {
inBuf.size() < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
1307 QSOCKS5_D_DEBUG << "bugus udp data, discarding";
dead code: QMessageLogger(__FILE__, 1307, __PRETTY_FUNCTION__).debug() << "bugus udp data, discarding";
-
1308 return;
never executed: return;
0
1309 }-
1310 QSocks5RevivedDatagram datagram;-
1311 if (buf[pos++] != 0 || buf[pos++] != 0) {
buf[pos++] != 0Description
TRUEnever evaluated
FALSEnever evaluated
buf[pos++] != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1312 QSOCKS5_D_DEBUG << "invalid datagram discarding";
dead code: QMessageLogger(__FILE__, 1312, __PRETTY_FUNCTION__).debug() << "invalid datagram discarding";
-
1313 return;
never executed: return;
0
1314 }-
1315 if (buf[pos++] != 0) { //### add fragmentation reading support
buf[pos++] != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1316 QSOCKS5_D_DEBUG << "don't support fragmentation yet disgarding";
dead code: QMessageLogger(__FILE__, 1316, __PRETTY_FUNCTION__).debug() << "don't support fragmentation yet disgarding";
-
1317 return;
never executed: return;
0
1318 }-
1319 if (qt_socks5_get_host_address_and_port(inBuf, &datagram.address, &datagram.port, &pos) != 1) {
qt_socks5_get_...rt, &pos) != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1320 QSOCKS5_D_DEBUG << "failed to get address from datagram disgarding";
dead code: QMessageLogger(__FILE__, 1320, __PRETTY_FUNCTION__).debug() << "failed to get address from datagram disgarding";
-
1321 return;
never executed: return;
0
1322 }-
1323 datagram.data = QByteArray(&buf[pos], inBuf.size() - pos);-
1324 udpData->pendingDatagrams.enqueue(datagram);-
1325 }
never executed: end of block
0
1326 emitReadNotification();-
1327}
never executed: end of block
0
1328#endif // QT_NO_UDPSOCKET-
1329-
1330bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port)-
1331{-
1332 Q_D(QSocks5SocketEngine);-
1333-
1334 // when bind wee will block until the bind is finished as the info from the proxy server is needed-
1335-
1336 QHostAddress address;-
1337 if (addr.protocol() == QAbstractSocket::AnyIPProtocol)
addr.protocol(...:AnyIPProtocolDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTcpServer
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
7-8
1338 address = QHostAddress::AnyIPv4; //SOCKS5 doesn't support dual stack, and there isn't any implementation of udp on ipv6 yet
executed 8 times by 1 test: address = QHostAddress::AnyIPv4;
Executed by:
  • tst_QTcpServer
8
1339 else-
1340 address = addr;
executed 7 times by 2 tests: address = addr;
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
7
1341-
1342 if (!d->data) {
!d->dataDescription
TRUEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-14
1343 if (socketType() == QAbstractSocket::TcpSocket) {
socketType() =...ket::TcpSocketDescription
TRUEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-13
1344 d->initialize(QSocks5SocketEnginePrivate::BindMode);-
1345#ifndef QT_NO_UDPSOCKET-
1346 } else if (socketType() == QAbstractSocket::UdpSocket) {
executed 13 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
socketType() =...ket::UdpSocketDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-13
1347 d->initialize(QSocks5SocketEnginePrivate::UdpAssociateMode);-
1348#endif-
1349 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
1
1350 //### something invalid-
1351 return false;
never executed: return false;
0
1352 }-
1353 }-
1354-
1355#ifndef QT_NO_UDPSOCKET-
1356 if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) {
d->mode == QSo...pAssociateModeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
2-13
1357 if (!d->udpData->udpSocket->bind(address, port)) {
!d->udpData->u...address, port)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-2
1358 QSOCKS5_Q_DEBUG << "local udp bind failed";
dead code: QMessageLogger(__FILE__, 1358, __PRETTY_FUNCTION__).debug() << "local udp bind failed";
-
1359 setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());-
1360 return false;
never executed: return false;
0
1361 }-
1362 d->localAddress = d->udpData->udpSocket->localAddress();-
1363 d->localPort = d->udpData->udpSocket->localPort();-
1364 } else
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsocks5socketengine - unknown status
2
1365#endif-
1366 if (d->mode == QSocks5SocketEnginePrivate::BindMode) {
d->mode == QSo...vate::BindModeDescription
TRUEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-13
1367 d->localAddress = address;-
1368 d->localPort = port;-
1369 } else {
executed 13 times by 3 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
13
1370 //### something invalid-
1371 return false;
never executed: return false;
0
1372 }-
1373-
1374 int msecs = SOCKS5_BLOCKING_BIND_TIMEOUT;-
1375 QElapsedTimer stopWatch;-
1376 stopWatch.start();-
1377 d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port());-
1378 if (!d->waitForConnected(msecs, 0) ||
!d->waitForConnected(msecs, 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTcpServer
FALSEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
1-14
1379 d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) {
d->data->contr...connectedStateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTcpServer
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
1-13
1380 // waitForConnected sets the error state and closes the socket-
1381 QSOCKS5_Q_DEBUG << "waitForConnected to proxy server" << d->data->controlSocket->errorString();
dead code: QMessageLogger(__FILE__, 1381, __PRETTY_FUNCTION__).debug() << "waitForConnected to proxy server" << d->data->controlSocket->errorString();
-
1382 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QTcpServer
2
1383 }-
1384 if (d->socks5State == QSocks5SocketEnginePrivate::BindSuccess) {
d->socks5State...e::BindSuccessDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
2-11
1385 setState(QAbstractSocket::BoundState);-
1386 return true;
executed 11 times by 3 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
11
1387#ifndef QT_NO_UDPSOCKET-
1388 } else if (d->socks5State == QSocks5SocketEnginePrivate::UdpAssociateSuccess) {
d->socks5State...sociateSuccessDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-2
1389 setState(QAbstractSocket::BoundState);-
1390 d->udpData->associateAddress = d->localAddress;-
1391 d->localAddress = QHostAddress();-
1392 d->udpData->associatePort = d->localPort;-
1393 d->localPort = 0;-
1394 QUdpSocket dummy;-
1395#ifndef QT_NO_BEARERMANAGEMENT-
1396 dummy.setProperty("_q_networksession", property("_q_networksession"));-
1397#endif-
1398 dummy.setProxy(QNetworkProxy::NoProxy);-
1399 if (!dummy.bind()
!dummy.bind()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-2
1400 || writeDatagram(0,0, QIpPacketHeader(d->data->controlSocket->localAddress(), dummy.localPort())) != 0
writeDatagram(...lPort())) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-2
1401 || !dummy.waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))
!dummy.waitFor...ch.elapsed()))Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-2
1402 || dummy.readDatagram(0,0, &d->localAddress, &d->localPort) != 0) {
dummy.readData...ocalPort) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-2
1403 QSOCKS5_DEBUG << "udp actual address and port lookup failed";
dead code: QMessageLogger(__FILE__, 1403, __PRETTY_FUNCTION__).debug() << "udp actual address and port lookup failed";
-
1404 setState(QAbstractSocket::UnconnectedState);-
1405 setError(dummy.error(), dummy.errorString());-
1406 d->data->controlSocket->close();-
1407 //### reset and error-
1408 return false;
never executed: return false;
0
1409 }-
1410 QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ':' << d->localPort;
dead code: QMessageLogger(__FILE__, 1410, __PRETTY_FUNCTION__).debug() << "udp actual address and port" << d->localAddress << ':' << d->localPort;
-
1411 return true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qsocks5socketengine - unknown status
2
1412#endif // QT_NO_UDPSOCKET-
1413 }-
1414-
1415 // binding timed out-
1416 setError(QAbstractSocket::SocketTimeoutError,-
1417 QLatin1String(QT_TRANSLATE_NOOP("QSocks5SocketEngine", "Network operation timed out")));-
1418-
1419///### delete d->udpSocket;-
1420///### d->udpSocket = 0;-
1421 return false;
never executed: return false;
0
1422}-
1423-
1424-
1425bool QSocks5SocketEngine::listen()-
1426{-
1427 Q_D(QSocks5SocketEngine);-
1428-
1429 QSOCKS5_Q_DEBUG << "listen()";
dead code: QMessageLogger(__FILE__, 1429, __PRETTY_FUNCTION__).debug() << "listen()";
-
1430-
1431 // check that we are in bound and then go to listening.-
1432 if (d->socketState == QAbstractSocket::BoundState) {
d->socketState...et::BoundStateDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-11
1433 d->socketState = QAbstractSocket::ListeningState;-
1434-
1435 // check if we already have a connection-
1436 if (d->socks5State == QSocks5SocketEnginePrivate::BindSuccess)
d->socks5State...e::BindSuccessDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-11
1437 d->emitReadNotification();
executed 11 times by 3 tests: d->emitReadNotification();
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
11
1438-
1439 return true;
executed 11 times by 3 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
11
1440 }-
1441 return false;
never executed: return false;
0
1442}-
1443-
1444int QSocks5SocketEngine::accept()-
1445{-
1446 Q_D(QSocks5SocketEngine);-
1447 // check we are listing ----
1448-
1449 QSOCKS5_Q_DEBUG << "accept()";
dead code: QMessageLogger(__FILE__, 1449, __PRETTY_FUNCTION__).debug() << "accept()";
-
1450-
1451 qintptr sd = -1;-
1452 switch (d->socks5State) {-
1453 case QSocks5SocketEnginePrivate::BindSuccess:
executed 6 times by 3 tests: case QSocks5SocketEnginePrivate::BindSuccess:
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
1454 QSOCKS5_Q_DEBUG << "BindSuccess adding" << d->socketDescriptor << "to the bind store";
dead code: QMessageLogger(__FILE__, 1454, __PRETTY_FUNCTION__).debug() << "BindSuccess adding" << d->socketDescriptor << "to the bind store";
-
1455 d->data->controlSocket->disconnect();-
1456 d->data->controlSocket->setParent(0);-
1457 d->bindData->localAddress = d->localAddress;-
1458 d->bindData->localPort = d->localPort;-
1459 sd = d->socketDescriptor;-
1460 socks5BindStore()->add(sd, d->bindData);-
1461 d->data = 0;-
1462 d->bindData = 0;-
1463 d->socketDescriptor = 0;-
1464 //### do something about this socket layer ... set it closed and an error about why ...-
1465 // reset state and local port/address-
1466 d->socks5State = QSocks5SocketEnginePrivate::Uninitialized; // ..??-
1467 d->socketState = QAbstractSocket::UnconnectedState;-
1468 break;
executed 6 times by 3 tests: break;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
1469 case QSocks5SocketEnginePrivate::ControlSocketError:
never executed: case QSocks5SocketEnginePrivate::ControlSocketError:
0
1470 setError(QAbstractSocket::ProxyProtocolError, QLatin1String("Control socket error"));-
1471 break;
never executed: break;
0
1472 default:
never executed: default:
0
1473 setError(QAbstractSocket::ProxyProtocolError, QLatin1String("SOCKS5 proxy error"));-
1474 break;
never executed: break;
0
1475 }-
1476 return sd;
executed 6 times by 3 tests: return sd;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
6
1477}-
1478-
1479void QSocks5SocketEngine::close()-
1480{-
1481 QSOCKS5_Q_DEBUG << "close()";
dead code: QMessageLogger(__FILE__, 1481, __PRETTY_FUNCTION__).debug() << "close()";
-
1482 Q_D(QSocks5SocketEngine);-
1483 if (d->data && d->data->controlSocket) {
d->dataDescription
TRUEevaluated 1008 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
d->data->controlSocketDescription
TRUEevaluated 1008 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-1008
1484 if (d->data->controlSocket->state() == QAbstractSocket::ConnectedState) {
d->data->contr...ConnectedStateDescription
TRUEevaluated 298 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 710 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
298-710
1485 int msecs = 100;-
1486 QElapsedTimer stopWatch;-
1487 stopWatch.start();-
1488 while (!d->data->controlSocket->bytesToWrite()) {
!d->data->cont...bytesToWrite()Description
TRUEevaluated 296 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
2-296
1489 if (!d->data->controlSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed())))
!d->data->cont...ch.elapsed()))Description
TRUEevaluated 296 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-296
1490 break;
executed 296 times by 8 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
296
1491 }
never executed: end of block
0
1492 }
executed 298 times by 8 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
298
1493 d->data->controlSocket->close();-
1494 }
executed 1008 times by 8 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1008
1495 d->inboundStreamCount = d->outboundStreamCount = 0;-
1496#ifndef QT_NO_UDPSOCKET-
1497 if (d->udpData && d->udpData->udpSocket)
d->udpDataDescription
TRUEnever evaluated
FALSEevaluated 1013 times by 8 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
d->udpData->udpSocketDescription
TRUEnever evaluated
FALSEnever evaluated
0-1013
1498 d->udpData->udpSocket->close();
never executed: d->udpData->udpSocket->close();
0
1499#endif-
1500}
executed 1013 times by 8 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1013
1501-
1502qint64 QSocks5SocketEngine::bytesAvailable() const-
1503{-
1504 Q_D(const QSocks5SocketEngine);-
1505 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode)
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 3280 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-3280
1506 return d->connectData->readBuffer.size();
executed 3280 times by 6 tests: return d->connectData->readBuffer.size();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
3280
1507#ifndef QT_NO_UDPSOCKET-
1508 else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode
d->mode == QSo...pAssociateModeDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-1
1509 && !d->udpData->pendingDatagrams.isEmpty())
!d->udpData->p...rams.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1510 return d->udpData->pendingDatagrams.first().data.size();
never executed: return d->udpData->pendingDatagrams.first().data.size();
0
1511#endif-
1512 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
1513}-
1514-
1515qint64 QSocks5SocketEngine::read(char *data, qint64 maxlen)-
1516{-
1517 Q_D(QSocks5SocketEngine);-
1518 QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ')';
dead code: QMessageLogger(__FILE__, 1518, __PRETTY_FUNCTION__).debug() << "read( , maxlen = " << maxlen << ')';
-
1519 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode) {
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 3283 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-3283
1520 if (d->connectData->readBuffer.size() == 0) {
d->connectData...er.size() == 0Description
TRUEevaluated 355 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 2928 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
355-2928
1521 if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) {
d->data->contr...connectedStateDescription
TRUEevaluated 353 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
2-353
1522 //imitate remote closed-
1523 close();-
1524 setError(QAbstractSocket::RemoteHostClosedError,-
1525 QLatin1String("Remote host closed connection###"));-
1526 setState(QAbstractSocket::UnconnectedState);-
1527 return -1;
executed 353 times by 3 tests: return -1;
Executed by:
  • tst_QFtp
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
353
1528 } else {-
1529 return 0; // nothing to be read
executed 2 times by 1 test: return 0;
Executed by:
  • tst_qsslsocket - unknown status
2
1530 }-
1531 }-
1532 qint64 copy = qMin<qint64>(d->connectData->readBuffer.size(), maxlen);-
1533 memcpy(data, d->connectData->readBuffer.constData(), copy);-
1534 d->connectData->readBuffer.remove(0, copy);-
1535 QSOCKS5_DEBUG << "read" << dump(QByteArray(data, copy));
dead code: QMessageLogger(__FILE__, 1535, __PRETTY_FUNCTION__).debug() << "read" << dump(QByteArray(data, copy));
-
1536 return copy;
executed 2928 times by 6 tests: return copy;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
2928
1537#ifndef QT_NO_UDPSOCKET-
1538 } else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) {
d->mode == QSo...pAssociateModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1539 return readDatagram(data, maxlen);
never executed: return readDatagram(data, maxlen);
0
1540#endif-
1541 }-
1542 return 0;
never executed: return 0;
0
1543}-
1544-
1545qint64 QSocks5SocketEngine::write(const char *data, qint64 len)-
1546{-
1547 Q_D(QSocks5SocketEngine);-
1548 QSOCKS5_Q_DEBUG << "write" << dump(QByteArray(data, len));
dead code: QMessageLogger(__FILE__, 1548, __PRETTY_FUNCTION__).debug() << "write" << dump(QByteArray(data, len));
-
1549-
1550 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode) {
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 1891 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-1891
1551 // clamp down the amount of bytes to transfer at once-
1552 len = qMin<qint64>(len, MaxWriteBufferSize) - d->data->controlSocket->bytesToWrite();-
1553 if (len <= 0)
len <= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
FALSEevaluated 1887 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
4-1887
1554 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_qsslsocket - unknown status
4
1555-
1556 QByteArray buf = QByteArray::fromRawData(data, len);-
1557 QByteArray sealedBuf;-
1558 if (!d->data->authenticator->seal(buf, &sealedBuf)) {
!d->data->auth...f, &sealedBuf)Description
TRUEnever evaluated
FALSEevaluated 1887 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-1887
1559 // ### Handle this error.-
1560 }
never executed: end of block
0
1561-
1562 qint64 written = d->data->controlSocket->write(sealedBuf);-
1563 if (written <= 0) {
written <= 0Description
TRUEnever evaluated
FALSEevaluated 1887 times by 6 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-1887
1564 QSOCKS5_Q_DEBUG << "native write returned" << written;
dead code: QMessageLogger(__FILE__, 1564, __PRETTY_FUNCTION__).debug() << "native write returned" << written;
-
1565 return written;
never executed: return written;
0
1566 }-
1567 d->data->controlSocket->waitForBytesWritten(0);-
1568 //NB: returning len rather than written for the OK case, because the "sealing" may increase the length-
1569 return len;
executed 1887 times by 6 tests: return len;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
1887
1570#ifndef QT_NO_UDPSOCKET-
1571 } else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) {
d->mode == QSo...pAssociateModeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-1
1572 // send to connected address-
1573 return writeDatagram(data, len, QIpPacketHeader(d->peerAddress, d->peerPort));
executed 1 time by 1 test: return writeDatagram(data, len, QIpPacketHeader(d->peerAddress, d->peerPort));
Executed by:
  • tst_qsocks5socketengine - unknown status
1
1574#endif-
1575 }-
1576 //### set an error ???-
1577 return -1;
never executed: return -1;
0
1578}-
1579-
1580#ifndef QT_NO_UDPSOCKET-
1581#ifndef QT_NO_NETWORKINTERFACE-
1582bool QSocks5SocketEngine::joinMulticastGroup(const QHostAddress &,-
1583 const QNetworkInterface &)-
1584{-
1585 setError(QAbstractSocket::UnsupportedSocketOperationError,-
1586 QLatin1String("Operation on socket is not supported"));-
1587 return false;
never executed: return false;
0
1588}-
1589-
1590bool QSocks5SocketEngine::leaveMulticastGroup(const QHostAddress &,-
1591 const QNetworkInterface &)-
1592{-
1593 setError(QAbstractSocket::UnsupportedSocketOperationError,-
1594 QLatin1String("Operation on socket is not supported"));-
1595 return false;
never executed: return false;
0
1596}-
1597-
1598-
1599QNetworkInterface QSocks5SocketEngine::multicastInterface() const-
1600{-
1601 return QNetworkInterface();
never executed: return QNetworkInterface();
0
1602}-
1603-
1604bool QSocks5SocketEngine::setMulticastInterface(const QNetworkInterface &)-
1605{-
1606 setError(QAbstractSocket::UnsupportedSocketOperationError,-
1607 QLatin1String("Operation on socket is not supported"));-
1608 return false;
never executed: return false;
0
1609}-
1610#endif // QT_NO_NETWORKINTERFACE-
1611-
1612qint64 QSocks5SocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header, PacketHeaderOptions)-
1613{-
1614 Q_D(QSocks5SocketEngine);-
1615-
1616 d->checkForDatagrams();-
1617-
1618 if (d->udpData->pendingDatagrams.isEmpty())
d->udpData->pe...rams.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1619 return 0;
never executed: return 0;
0
1620-
1621 QSocks5RevivedDatagram datagram = d->udpData->pendingDatagrams.dequeue();-
1622 int copyLen = qMin<int>(maxlen, datagram.data.size());-
1623 memcpy(data, datagram.data.constData(), copyLen);-
1624 header->senderAddress = datagram.address;-
1625 header->senderPort = datagram.port;-
1626 return copyLen;
never executed: return copyLen;
0
1627}-
1628-
1629qint64 QSocks5SocketEngine::writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header)-
1630{-
1631 Q_D(QSocks5SocketEngine);-
1632-
1633 // it is possible to send with out first binding with udp, but socks5 requires a bind.-
1634 if (!d->data) {
!d->dataDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-3
1635 d->initialize(QSocks5SocketEnginePrivate::UdpAssociateMode);-
1636 // all udp needs to be bound-
1637 if (!bind(QHostAddress(QLatin1String("0.0.0.0")), 0)) {
!bind(QHostAdd...0.0.0.0")), 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1638 //### set error-
1639 return -1;
never executed: return -1;
0
1640 }-
1641 }
never executed: end of block
0
1642-
1643 QByteArray outBuf;-
1644 outBuf.reserve(270 + len);-
1645 outBuf[0] = 0x00;-
1646 outBuf[1] = 0x00;-
1647 outBuf[2] = 0x00;-
1648 if (!qt_socks5_set_host_address_and_port(header.destinationAddress, header.destinationPort, &outBuf)) {
!qt_socks5_set...Port, &outBuf)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-3
1649 }
never executed: end of block
0
1650 outBuf += QByteArray(data, len);-
1651 QSOCKS5_DEBUG << "sending" << dump(outBuf);
dead code: QMessageLogger(__FILE__, 1651, __PRETTY_FUNCTION__).debug() << "sending" << dump(outBuf);
-
1652 QByteArray sealedBuf;-
1653 if (!d->data->authenticator->seal(outBuf, &sealedBuf)) {
!d->data->auth...f, &sealedBuf)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-3
1654 QSOCKS5_DEBUG << "sealing data failed";
dead code: QMessageLogger(__FILE__, 1654, __PRETTY_FUNCTION__).debug() << "sealing data failed";
-
1655 setError(QAbstractSocket::SocketAccessError, d->data->authenticator->errorString());-
1656 return -1;
never executed: return -1;
0
1657 }-
1658 if (d->udpData->udpSocket->writeDatagram(sealedBuf, d->udpData->associateAddress, d->udpData->associatePort) != sealedBuf.size()) {
d->udpData->ud...aledBuf.size()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
0-3
1659 //### try frgamenting-
1660 if (d->udpData->udpSocket->error() == QAbstractSocket::DatagramTooLargeError)
d->udpData->ud...mTooLargeErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1661 setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());
never executed: setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());
0
1662 //### else maybe more serious error-
1663 return -1;
never executed: return -1;
0
1664 }-
1665-
1666 return len;
executed 3 times by 1 test: return len;
Executed by:
  • tst_qsocks5socketengine - unknown status
3
1667}-
1668-
1669bool QSocks5SocketEngine::hasPendingDatagrams() const-
1670{-
1671 Q_D(const QSocks5SocketEngine);-
1672 Q_INIT_CHECK(false);
executed 1 time by 1 test: return false;
Executed by:
  • tst_qsocks5socketengine - unknown status
!d->dataDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-1
1673-
1674 d->checkForDatagrams();-
1675-
1676 return !d->udpData->pendingDatagrams.isEmpty();
never executed: return !d->udpData->pendingDatagrams.isEmpty();
0
1677}-
1678-
1679qint64 QSocks5SocketEngine::pendingDatagramSize() const-
1680{-
1681 Q_D(const QSocks5SocketEngine);-
1682-
1683 d->checkForDatagrams();-
1684-
1685 if (!d->udpData->pendingDatagrams.isEmpty())
!d->udpData->p...rams.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1686 return d->udpData->pendingDatagrams.head().data.size();
never executed: return d->udpData->pendingDatagrams.head().data.size();
0
1687 return 0;
never executed: return 0;
0
1688}-
1689#endif // QT_NO_UDPSOCKET-
1690-
1691qint64 QSocks5SocketEngine::bytesToWrite() const-
1692{-
1693 Q_D(const QSocks5SocketEngine);-
1694 if (d->data && d->data->controlSocket) {
d->dataDescription
TRUEevaluated 4687 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEnever evaluated
d->data->controlSocketDescription
TRUEevaluated 4687 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-4687
1695 return d->data->controlSocket->bytesToWrite();
executed 4687 times by 5 tests: return d->data->controlSocket->bytesToWrite();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
4687
1696 } else {-
1697 return 0;
never executed: return 0;
0
1698 }-
1699}-
1700-
1701int QSocks5SocketEngine::option(SocketOption option) const-
1702{-
1703 Q_D(const QSocks5SocketEngine);-
1704 if (d->data && d->data->controlSocket) {
d->dataDescription
TRUEnever evaluated
FALSEnever evaluated
d->data->controlSocketDescription
TRUEnever evaluated
FALSEnever evaluated
0
1705 // convert the enum and call the real socket-
1706 if (option == QAbstractSocketEngine::LowDelayOption)
option == QAbs...LowDelayOptionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1707 return d->data->controlSocket->socketOption(QAbstractSocket::LowDelayOption).toInt();
never executed: return d->data->controlSocket->socketOption(QAbstractSocket::LowDelayOption).toInt();
0
1708 if (option == QAbstractSocketEngine::KeepAliveOption)
option == QAbs...eepAliveOptionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1709 return d->data->controlSocket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
never executed: return d->data->controlSocket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
0
1710 }
never executed: end of block
0
1711 return -1;
never executed: return -1;
0
1712}-
1713-
1714bool QSocks5SocketEngine::setOption(SocketOption option, int value)-
1715{-
1716 Q_D(QSocks5SocketEngine);-
1717 if (d->data && d->data->controlSocket) {
d->dataDescription
TRUEevaluated 345 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
d->data->controlSocketDescription
TRUEevaluated 345 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-345
1718 // convert the enum and call the real socket-
1719 if (option == QAbstractSocketEngine::LowDelayOption)
option == QAbs...LowDelayOptionDescription
TRUEevaluated 294 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
51-294
1720 d->data->controlSocket->setSocketOption(QAbstractSocket::LowDelayOption, value);
executed 294 times by 1 test: d->data->controlSocket->setSocketOption(QAbstractSocket::LowDelayOption, value);
Executed by:
  • tst_QFtp
294
1721 if (option == QAbstractSocketEngine::KeepAliveOption)
option == QAbs...eepAliveOptionDescription
TRUEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 294 times by 1 test
Evaluated by:
  • tst_QFtp
51-294
1722 d->data->controlSocket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
executed 51 times by 2 tests: d->data->controlSocket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
51
1723 return true;
executed 345 times by 3 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
345
1724 }-
1725 return false;
executed 12 times by 2 tests: return false;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
12
1726}-
1727-
1728bool QSocks5SocketEnginePrivate::waitForConnected(int msecs, bool *timedOut)-
1729{-
1730 if (data->controlSocket->state() == QAbstractSocket::UnconnectedState)
data->controlS...connectedStateDescription
TRUEnever evaluated
FALSEevaluated 494 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-494
1731 return false;
never executed: return false;
0
1732-
1733 const Socks5State wantedState =-
1734 mode == ConnectMode ? Connected :
mode == ConnectModeDescription
TRUEevaluated 476 times by 6 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
18-476
1735 mode == BindMode ? BindSuccess :
mode == BindModeDescription
TRUEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
3-15
1736 UdpAssociateSuccess;-
1737-
1738 QElapsedTimer stopWatch;-
1739 stopWatch.start();-
1740-
1741 while (socks5State != wantedState) {
socks5State != wantedStateDescription
TRUEevaluated 352 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 479 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
352-479
1742 if (!data->controlSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) {
!data->control...ch.elapsed()))Description
TRUEevaluated 15 times by 5 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 337 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
15-337
1743 if (data->controlSocket->state() == QAbstractSocket::UnconnectedState)
data->controlS...connectedStateDescription
TRUEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7-8
1744 return true;
executed 8 times by 4 tests: return true;
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
8
1745-
1746 setErrorState(QSocks5SocketEnginePrivate::ControlSocketError);-
1747 if (timedOut && data->controlSocket->error() == QAbstractSocket::SocketTimeoutError)
timedOutDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTcpServer
data->controlS...etTimeoutErrorDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-6
1748 *timedOut = true;
executed 6 times by 2 tests: *timedOut = true;
Executed by:
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
6
1749 return false;
executed 7 times by 3 tests: return false;
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7
1750 }-
1751 }
executed 337 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
337
1752-
1753 return true;
executed 479 times by 5 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
479
1754}-
1755-
1756bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut)-
1757{-
1758 Q_D(QSocks5SocketEngine);-
1759 QSOCKS5_DEBUG << "waitForRead" << msecs;
dead code: QMessageLogger(__FILE__, 1759, __PRETTY_FUNCTION__).debug() << "waitForRead" << msecs;
-
1760-
1761 d->readNotificationActivated = false;-
1762-
1763 QElapsedTimer stopWatch;-
1764 stopWatch.start();-
1765-
1766 // are we connected yet?-
1767 if (!d->waitForConnected(msecs, timedOut))
!d->waitForCon...ecs, timedOut)Description
TRUEnever evaluated
FALSEevaluated 187 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-187
1768 return false;
never executed: return false;
0
1769 if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState)
d->data->contr...connectedStateDescription
TRUEnever evaluated
FALSEevaluated 187 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
0-187
1770 return true;
never executed: return true;
0
1771-
1772 // we're connected-
1773 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode ||
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 184 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
3-184
1774 d->mode == QSocks5SocketEnginePrivate::BindMode) {
d->mode == QSo...vate::BindModeDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
1-2
1775 while (!d->readNotificationActivated) {
!d->readNotificationActivatedDescription
TRUEevaluated 186 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 179 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
179-186
1776 if (!d->data->controlSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) {
!d->data->cont...ch.elapsed()))Description
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 179 times by 3 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
7-179
1777 if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState)
d->data->contr...connectedStateDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
2-5
1778 return true;
executed 5 times by 2 tests: return true;
Executed by:
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
5
1779-
1780 setError(d->data->controlSocket->error(), d->data->controlSocket->errorString());-
1781 if (timedOut && d->data->controlSocket->error() == QAbstractSocket::SocketTimeoutError)
timedOutDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
d->data->contr...etTimeoutErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0-2
1782 *timedOut = true;
never executed: *timedOut = true;
0
1783 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qsslsocket - unknown status
2
1784 }-
1785 }
executed 179 times by 3 tests: end of block
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
179
1786#ifndef QT_NO_UDPSOCKET-
1787 } else {
executed 179 times by 3 tests: end of block
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
179
1788 while (!d->readNotificationActivated) {
!d->readNotificationActivatedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-1
1789 if (!d->udpData->udpSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) {
!d->udpData->u...ch.elapsed()))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-1
1790 setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());-
1791 if (timedOut && d->udpData->udpSocket->error() == QAbstractSocket::SocketTimeoutError)
timedOutDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsocks5socketengine - unknown status
d->udpData->ud...etTimeoutErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0-1
1792 *timedOut = true;
never executed: *timedOut = true;
0
1793 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qsocks5socketengine - unknown status
1
1794 }-
1795 }
never executed: end of block
0
1796#endif // QT_NO_UDPSOCKET-
1797 }
never executed: end of block
0
1798-
1799-
1800 bool ret = d->readNotificationActivated;-
1801 d->readNotificationActivated = false;-
1802-
1803 QSOCKS5_DEBUG << "waitForRead returned" << ret;
dead code: QMessageLogger(__FILE__, 1803, __PRETTY_FUNCTION__).debug() << "waitForRead returned" << ret;
-
1804 return ret;
executed 179 times by 3 tests: return ret;
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
179
1805}-
1806-
1807-
1808bool QSocks5SocketEngine::waitForWrite(int msecs, bool *timedOut)-
1809{-
1810 Q_D(QSocks5SocketEngine);-
1811 QSOCKS5_DEBUG << "waitForWrite" << msecs;
dead code: QMessageLogger(__FILE__, 1811, __PRETTY_FUNCTION__).debug() << "waitForWrite" << msecs;
-
1812-
1813 QElapsedTimer stopWatch;-
1814 stopWatch.start();-
1815-
1816 // are we connected yet?-
1817 if (!d->waitForConnected(msecs, timedOut))
!d->waitForCon...ecs, timedOut)Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 286 times by 5 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
6-286
1818 return false;
executed 6 times by 2 tests: return false;
Executed by:
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
6
1819 if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState)
d->data->contr...connectedStateDescription
TRUEevaluated 7 times by 3 tests
Evaluated by:
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 279 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
7-279
1820 return true;
executed 7 times by 3 tests: return true;
Executed by:
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qtcpsocket - unknown status
7
1821-
1822 // we're connected-
1823-
1824 // flush any bytes we may still have buffered in the time that we have left-
1825 if (d->data->controlSocket->bytesToWrite())
d->data->contr...bytesToWrite()Description
TRUEnever evaluated
FALSEevaluated 279 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-279
1826 d->data->controlSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));
never executed: d->data->controlSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));
0
1827 while ((msecs == -1 || stopWatch.elapsed() < msecs)
msecs == -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
FALSEevaluated 273 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
stopWatch.elapsed() < msecsDescription
TRUEevaluated 273 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-273
1828 && d->data->controlSocket->state() == QAbstractSocket::ConnectedState
d->data->contr...ConnectedStateDescription
TRUEevaluated 279 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-279
1829 && d->data->controlSocket->bytesToWrite() >= MaxWriteBufferSize)
d->data->contr...riteBufferSizeDescription
TRUEnever evaluated
FALSEevaluated 279 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-279
1830 d->data->controlSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));
never executed: d->data->controlSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));
0
1831 return d->data->controlSocket->bytesToWrite() < MaxWriteBufferSize;
executed 279 times by 4 tests: return d->data->controlSocket->bytesToWrite() < MaxWriteBufferSize;
Executed by:
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
279
1832}-
1833-
1834bool QSocks5SocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,-
1835 bool checkRead, bool checkWrite,-
1836 int msecs, bool *timedOut)-
1837{-
1838 Q_UNUSED(checkRead);-
1839 if (!checkWrite) {
!checkWriteDescription
TRUEevaluated 174 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
FALSEevaluated 184 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
174-184
1840 bool canRead = waitForRead(msecs, timedOut);-
1841 if (readyToRead)
readyToReadDescription
TRUEevaluated 174 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-174
1842 *readyToRead = canRead;
executed 174 times by 2 tests: *readyToRead = canRead;
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
174
1843 return canRead;
executed 174 times by 2 tests: return canRead;
Executed by:
  • tst_QTcpServer
  • tst_qsslsocket - unknown status
174
1844 }-
1845-
1846 bool canWrite = waitForWrite(msecs, timedOut);-
1847 if (readyToWrite)
readyToWriteDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-184
1848 *readyToWrite = canWrite;
executed 184 times by 1 test: *readyToWrite = canWrite;
Executed by:
  • tst_qsslsocket - unknown status
184
1849 return canWrite;
executed 184 times by 1 test: return canWrite;
Executed by:
  • tst_qsslsocket - unknown status
184
1850}-
1851-
1852bool QSocks5SocketEngine::isReadNotificationEnabled() const-
1853{-
1854 Q_D(const QSocks5SocketEngine);-
1855 return d->readNotificationEnabled;
executed 3016 times by 5 tests: return d->readNotificationEnabled;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
3016
1856}-
1857-
1858void QSocks5SocketEngine::setReadNotificationEnabled(bool enable)-
1859{-
1860 Q_D(QSocks5SocketEngine);-
1861-
1862 QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ')';
dead code: QMessageLogger(__FILE__, 1862, __PRETTY_FUNCTION__).debug() << "setReadNotificationEnabled(" << enable << ')';
-
1863-
1864 bool emitSignal = false;-
1865 if (!d->readNotificationEnabled
!d->readNotificationEnabledDescription
TRUEevaluated 786 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 3229 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
786-3229
1866 && enable) {
enableDescription
TRUEevaluated 696 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 90 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
90-696
1867 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode)
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 686 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
10-686
1868 emitSignal = !d->connectData->readBuffer.isEmpty();
executed 686 times by 7 tests: emitSignal = !d->connectData->readBuffer.isEmpty();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
686
1869#ifndef QT_NO_UDPSOCKET-
1870 else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode)
d->mode == QSo...pAssociateModeDescription
TRUEnever evaluated
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
0-10
1871 emitSignal = !d->udpData->pendingDatagrams.isEmpty();
never executed: emitSignal = !d->udpData->pendingDatagrams.isEmpty();
0
1872#endif-
1873 else if (d->mode == QSocks5SocketEnginePrivate::BindMode
d->mode == QSo...vate::BindModeDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
FALSEnever evaluated
0-10
1874 && d->socketState == QAbstractSocket::ListeningState
d->socketState...ListeningStateDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
FALSEnever evaluated
0-10
1875 && d->socks5State == QSocks5SocketEnginePrivate::BindSuccess)
d->socks5State...e::BindSuccessDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
FALSEnever evaluated
0-10
1876 emitSignal = true;
executed 10 times by 2 tests: emitSignal = true;
Executed by:
  • tst_QFtp
  • tst_QTcpServer
10
1877 }
executed 696 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
696
1878-
1879 d->readNotificationEnabled = enable;-
1880-
1881 if (emitSignal)
emitSignalDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
FALSEevaluated 4005 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
10-4005
1882 d->emitReadNotification();
executed 10 times by 2 tests: d->emitReadNotification();
Executed by:
  • tst_QFtp
  • tst_QTcpServer
10
1883}
executed 4015 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
4015
1884-
1885bool QSocks5SocketEngine::isWriteNotificationEnabled() const-
1886{-
1887 Q_D(const QSocks5SocketEngine);-
1888 return d->writeNotificationEnabled;
executed 1923 times by 5 tests: return d->writeNotificationEnabled;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
1923
1889}-
1890-
1891void QSocks5SocketEngine::setWriteNotificationEnabled(bool enable)-
1892{-
1893 Q_D(QSocks5SocketEngine);-
1894 d->writeNotificationEnabled = enable;-
1895 if (enable && d->socketState == QAbstractSocket::ConnectedState) {
enableDescription
TRUEevaluated 2794 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 4258 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsslsocket - unknown status
d->socketState...ConnectedStateDescription
TRUEevaluated 2553 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 241 times by 5 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
241-4258
1896 if (d->mode == QSocks5SocketEnginePrivate::ConnectMode && d->data->controlSocket->bytesToWrite())
d->mode == QSo...e::ConnectModeDescription
TRUEevaluated 2553 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
d->data->contr...bytesToWrite()Description
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
FALSEevaluated 2521 times by 7 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
0-2553
1897 return; // will be emitted as a result of bytes written
executed 32 times by 2 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
32
1898 d->emitWriteNotification();-
1899 d->writeNotificationActivated = false;-
1900 }
executed 2521 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
2521
1901}
executed 7020 times by 7 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
7020
1902-
1903bool QSocks5SocketEngine::isExceptionNotificationEnabled() const-
1904{-
1905 Q_D(const QSocks5SocketEngine);-
1906 return d->exceptNotificationEnabled;
executed 81 times by 3 tests: return d->exceptNotificationEnabled;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
81
1907}-
1908-
1909void QSocks5SocketEngine::setExceptionNotificationEnabled(bool enable)-
1910{-
1911 Q_D(QSocks5SocketEngine);-
1912 d->exceptNotificationEnabled = enable;-
1913}
executed 162 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
162
1914-
1915QAbstractSocketEngine *-
1916QSocks5SocketEngineHandler::createSocketEngine(QAbstractSocket::SocketType socketType,-
1917 const QNetworkProxy &proxy, QObject *parent)-
1918{-
1919 Q_UNUSED(socketType);-
1920-
1921 // proxy type must have been resolved by now-
1922 if (proxy.type() != QNetworkProxy::Socks5Proxy) {
proxy.type() !...y::Socks5ProxyDescription
TRUEevaluated 4743 times by 28 tests
Evaluated 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_QXmlInputSource
  • tst_Spdy
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
FALSEevaluated 711 times by 9 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
711-4743
1923 QSOCKS5_DEBUG << "not proxying";
dead code: QMessageLogger(__FILE__, 1923, __PRETTY_FUNCTION__).debug() << "not proxying";
-
1924 return 0;
executed 4743 times by 28 tests: return 0;
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_QXmlInputSource
  • tst_Spdy
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
4743
1925 }-
1926 QScopedPointer<QSocks5SocketEngine> engine(new QSocks5SocketEngine(parent));-
1927 engine->setProxy(proxy);-
1928 return engine.take();
executed 711 times by 9 tests: return engine.take();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
711
1929}-
1930-
1931QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr socketDescriptor, QObject *parent)-
1932{-
1933 QSOCKS5_DEBUG << "createSocketEngine" << socketDescriptor;
dead code: QMessageLogger(__FILE__, 1933, __PRETTY_FUNCTION__).debug() << "createSocketEngine" << socketDescriptor;
-
1934 if (socks5BindStore()->contains(socketDescriptor)) {
socks5BindStor...ketDescriptor)Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QTcpServer
FALSEevaluated 994 times by 18 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
5-994
1935 QSOCKS5_DEBUG << "bind store contains" << socketDescriptor;
dead code: QMessageLogger(__FILE__, 1935, __PRETTY_FUNCTION__).debug() << "bind store contains" << socketDescriptor;
-
1936 return new QSocks5SocketEngine(parent);
executed 5 times by 2 tests: return new QSocks5SocketEngine(parent);
Executed by:
  • tst_QFtp
  • tst_QTcpServer
5
1937 }-
1938 return 0;
executed 994 times by 18 tests: return 0;
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
994
1939}-
1940-
1941#endif // QT_NO_SOCKS5-
1942-
1943QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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