Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslsocket.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | class QSslSocketGlobalData | - | ||||||||||||||||||||||||
6 | { | - | ||||||||||||||||||||||||
7 | public: | - | ||||||||||||||||||||||||
8 | QSslSocketGlobalData() : config(new QSslConfigurationPrivate) {} executed 15 times by 15 tests: end of block Executed by:
| 15 | ||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | QMutex mutex; | - | ||||||||||||||||||||||||
11 | QList<QSslCipher> supportedCiphers; | - | ||||||||||||||||||||||||
12 | QVector<QSslEllipticCurve> supportedEllipticCurves; | - | ||||||||||||||||||||||||
13 | QExplicitlySharedDataPointer<QSslConfigurationPrivate> config; | - | ||||||||||||||||||||||||
14 | }; | - | ||||||||||||||||||||||||
15 | namespace { namespace Q_QGS_globalData { typedef QSslSocketGlobalData Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 15 times by 15 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 15 times by 15 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 4198 times by 16 tests: &holder.value;return &holder.value; Executed by:
executed 4198 times by 16 tests: } } } static QGlobalStatic<QSslSocketGlobalData, Q_QGS_globalData::innerFunction, Q_QGS_globalData::guard> globalData;return &holder.value; Executed by:
| 0-4198 | ||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||
22 | QSslSocket::QSslSocket(QObject *parent) | - | ||||||||||||||||||||||||
23 | : QTcpSocket(*new QSslSocketBackendPrivate, parent) | - | ||||||||||||||||||||||||
24 | { | - | ||||||||||||||||||||||||
25 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||
29 | d->q_ptr = this; | - | ||||||||||||||||||||||||
30 | d->init(); | - | ||||||||||||||||||||||||
31 | } executed 713 times by 8 tests: end of block Executed by:
| 713 | ||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||
36 | QSslSocket::~QSslSocket() | - | ||||||||||||||||||||||||
37 | { | - | ||||||||||||||||||||||||
38 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||
42 | delete d->plainSocket; | - | ||||||||||||||||||||||||
43 | d->plainSocket = 0; | - | ||||||||||||||||||||||||
44 | } executed 707 times by 9 tests: end of block Executed by:
| 707 | ||||||||||||||||||||||||
45 | void QSslSocket::resume() | - | ||||||||||||||||||||||||
46 | { | - | ||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||
48 | QMetaObject::invokeMethod(this, "_q_resumeImplementation", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
49 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||
50 | void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode, NetworkLayerProtocol protocol) | - | ||||||||||||||||||||||||
51 | { | - | ||||||||||||||||||||||||
52 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
53 | if (d->state == ConnectedState
| 0-402 | ||||||||||||||||||||||||
54 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
55 | __FILE__ never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
56 | , never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
57 | 434 never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
58 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
59 | ; never executed: QMessageLogger( __FILE__ , 434 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
60 | return; never executed: return; | 0 | ||||||||||||||||||||||||
61 | } | - | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | d->init(); | - | ||||||||||||||||||||||||
64 | d->autoStartHandshake = true; | - | ||||||||||||||||||||||||
65 | d->initialized = true; | - | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | connectToHost(hostName, port, mode, protocol); | - | ||||||||||||||||||||||||
70 | } executed 402 times by 6 tests: end of block Executed by:
| 402 | ||||||||||||||||||||||||
71 | void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, | - | ||||||||||||||||||||||||
72 | const QString &sslPeerName, OpenMode mode, | - | ||||||||||||||||||||||||
73 | NetworkLayerProtocol protocol) | - | ||||||||||||||||||||||||
74 | { | - | ||||||||||||||||||||||||
75 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
76 | if (d->state == ConnectedState
| 0-5 | ||||||||||||||||||||||||
77 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
78 | __FILE__ never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
79 | , never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
80 | 465 never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
81 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
82 | ; never executed: QMessageLogger( __FILE__ , 465 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") ; | 0 | ||||||||||||||||||||||||
83 | return; never executed: return; | 0 | ||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | d->init(); | - | ||||||||||||||||||||||||
87 | d->autoStartHandshake = true; | - | ||||||||||||||||||||||||
88 | d->initialized = true; | - | ||||||||||||||||||||||||
89 | d->verificationPeerName = sslPeerName; | - | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||
93 | connectToHost(hostName, port, mode, protocol); | - | ||||||||||||||||||||||||
94 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||
95 | bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state, OpenMode openMode) | - | ||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||
97 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | if (!d->plainSocket
| 0-67 | ||||||||||||||||||||||||
103 | d->createPlainSocket(openMode); executed 67 times by 3 tests: d->createPlainSocket(openMode); Executed by:
| 67 | ||||||||||||||||||||||||
104 | bool retVal = d->plainSocket->setSocketDescriptor(socketDescriptor, state, openMode); | - | ||||||||||||||||||||||||
105 | d->cachedSocketDescriptor = d->plainSocket->socketDescriptor(); | - | ||||||||||||||||||||||||
106 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||||||||||||||
107 | setSocketState(state); | - | ||||||||||||||||||||||||
108 | setOpenMode(openMode); | - | ||||||||||||||||||||||||
109 | setLocalPort(d->plainSocket->localPort()); | - | ||||||||||||||||||||||||
110 | setLocalAddress(d->plainSocket->localAddress()); | - | ||||||||||||||||||||||||
111 | setPeerPort(d->plainSocket->peerPort()); | - | ||||||||||||||||||||||||
112 | setPeerAddress(d->plainSocket->peerAddress()); | - | ||||||||||||||||||||||||
113 | setPeerName(d->plainSocket->peerName()); | - | ||||||||||||||||||||||||
114 | return executed 67 times by 3 tests: retVal;return retVal; Executed by:
executed 67 times by 3 tests: return retVal; Executed by:
| 67 | ||||||||||||||||||||||||
115 | } | - | ||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) | - | ||||||||||||||||||||||||
124 | { | - | ||||||||||||||||||||||||
125 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
126 | if (d->plainSocket
| 0-120 | ||||||||||||||||||||||||
127 | d->plainSocket->setSocketOption(option, value); executed 120 times by 3 tests: d->plainSocket->setSocketOption(option, value); Executed by:
| 120 | ||||||||||||||||||||||||
128 | } executed 120 times by 3 tests: end of block Executed by:
| 120 | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | QVariant QSslSocket::socketOption(QAbstractSocket::SocketOption option) | - | ||||||||||||||||||||||||
137 | { | - | ||||||||||||||||||||||||
138 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
139 | if (d->plainSocket
| 0 | ||||||||||||||||||||||||
140 | return never executed: d->plainSocket->socketOption(option);return d->plainSocket->socketOption(option); never executed: return d->plainSocket->socketOption(option); | 0 | ||||||||||||||||||||||||
141 | else | - | ||||||||||||||||||||||||
142 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
143 | } | - | ||||||||||||||||||||||||
144 | QSslSocket::SslMode QSslSocket::mode() const | - | ||||||||||||||||||||||||
145 | { | - | ||||||||||||||||||||||||
146 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
147 | return executed 24 times by 1 test: d->mode;return d->mode; Executed by:
executed 24 times by 1 test: return d->mode; Executed by:
| 24 | ||||||||||||||||||||||||
148 | } | - | ||||||||||||||||||||||||
149 | bool QSslSocket::isEncrypted() const | - | ||||||||||||||||||||||||
150 | { | - | ||||||||||||||||||||||||
151 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
152 | return executed 122 times by 1 test: d->connectionEncrypted;return d->connectionEncrypted; Executed by:
executed 122 times by 1 test: return d->connectionEncrypted; Executed by:
| 122 | ||||||||||||||||||||||||
153 | } | - | ||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | QSsl::SslProtocol QSslSocket::protocol() const | - | ||||||||||||||||||||||||
161 | { | - | ||||||||||||||||||||||||
162 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
163 | return executed 130 times by 1 test: d->configuration.protocol;return d->configuration.protocol; Executed by:
executed 130 times by 1 test: return d->configuration.protocol; Executed by:
| 130 | ||||||||||||||||||||||||
164 | } | - | ||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||
168 | - | |||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | void QSslSocket::setProtocol(QSsl::SslProtocol protocol) | - | ||||||||||||||||||||||||
172 | { | - | ||||||||||||||||||||||||
173 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
174 | d->configuration.protocol = protocol; | - | ||||||||||||||||||||||||
175 | } executed 115 times by 2 tests: end of block Executed by:
| 115 | ||||||||||||||||||||||||
176 | QSslSocket::PeerVerifyMode QSslSocket::peerVerifyMode() const | - | ||||||||||||||||||||||||
177 | { | - | ||||||||||||||||||||||||
178 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
179 | return executed 3 times by 1 test: d->configuration.peerVerifyMode;return d->configuration.peerVerifyMode; Executed by:
executed 3 times by 1 test: return d->configuration.peerVerifyMode; Executed by:
| 3 | ||||||||||||||||||||||||
180 | } | - | ||||||||||||||||||||||||
181 | void QSslSocket::setPeerVerifyMode(QSslSocket::PeerVerifyMode mode) | - | ||||||||||||||||||||||||
182 | { | - | ||||||||||||||||||||||||
183 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
184 | d->configuration.peerVerifyMode = mode; | - | ||||||||||||||||||||||||
185 | } executed 65 times by 1 test: end of block Executed by:
| 65 | ||||||||||||||||||||||||
186 | int QSslSocket::peerVerifyDepth() const | - | ||||||||||||||||||||||||
187 | { | - | ||||||||||||||||||||||||
188 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
189 | return executed 15 times by 1 test: d->configuration.peerVerifyDepth;return d->configuration.peerVerifyDepth; Executed by:
executed 15 times by 1 test: return d->configuration.peerVerifyDepth; Executed by:
| 15 | ||||||||||||||||||||||||
190 | } | - | ||||||||||||||||||||||||
191 | void QSslSocket::setPeerVerifyDepth(int depth) | - | ||||||||||||||||||||||||
192 | { | - | ||||||||||||||||||||||||
193 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
194 | if (depth < 0
| 5 | ||||||||||||||||||||||||
195 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
executed 5 times by 1 test: QMessageLogger(__FILE__, 679, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::setPeerVerifyDepth: cannot set negative depth of %d", depth); Executed by:
| 5 | ||||||||||||||||||||||||
196 | return; executed 5 times by 1 test: return; Executed by:
| 5 | ||||||||||||||||||||||||
197 | } | - | ||||||||||||||||||||||||
198 | d->configuration.peerVerifyDepth = depth; | - | ||||||||||||||||||||||||
199 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||
200 | QString QSslSocket::peerVerifyName() const | - | ||||||||||||||||||||||||
201 | { | - | ||||||||||||||||||||||||
202 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
203 | return never executed: d->verificationPeerName;return d->verificationPeerName; never executed: return d->verificationPeerName; | 0 | ||||||||||||||||||||||||
204 | } | - | ||||||||||||||||||||||||
205 | void QSslSocket::setPeerVerifyName(const QString &hostName) | - | ||||||||||||||||||||||||
206 | { | - | ||||||||||||||||||||||||
207 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
208 | d->verificationPeerName = hostName; | - | ||||||||||||||||||||||||
209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||
217 | qint64 QSslSocket::bytesAvailable() const | - | ||||||||||||||||||||||||
218 | { | - | ||||||||||||||||||||||||
219 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
220 | if (d->mode == UnencryptedMode
| 886-18874 | ||||||||||||||||||||||||
221 | return executed 886 times by 3 tests: QIODevice::bytesAvailable() + (d->plainSocketreturn QIODevice::bytesAvailable() + (d->plainSocket ? d->plainSocket->bytesAvailable() : 0); Executed by:
executed 886 times by 3 tests: return QIODevice::bytesAvailable() + (d->plainSocket ? d->plainSocket->bytesAvailable() : 0); Executed by:
| 16-886 | ||||||||||||||||||||||||
222 | return executed 18874 times by 5 tests: QIODevice::bytesAvailable();return QIODevice::bytesAvailable(); Executed by:
executed 18874 times by 5 tests: return QIODevice::bytesAvailable(); Executed by:
| 18874 | ||||||||||||||||||||||||
223 | } | - | ||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||
225 | - | |||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||
229 | - | |||||||||||||||||||||||||
230 | - | |||||||||||||||||||||||||
231 | qint64 QSslSocket::bytesToWrite() const | - | ||||||||||||||||||||||||
232 | { | - | ||||||||||||||||||||||||
233 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
234 | if (d->mode == UnencryptedMode
| 327-7596 | ||||||||||||||||||||||||
235 | return executed 327 times by 3 tests: d->plainSocketreturn d->plainSocket ? d->plainSocket->bytesToWrite() : 0; Executed by:
executed 327 times by 3 tests: return d->plainSocket ? d->plainSocket->bytesToWrite() : 0; Executed by:
| 5-327 | ||||||||||||||||||||||||
236 | return executed 7596 times by 3 tests: d->writeBuffer.size();return d->writeBuffer.size(); Executed by:
executed 7596 times by 3 tests: return d->writeBuffer.size(); Executed by:
| 7596 | ||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||
238 | qint64 QSslSocket::encryptedBytesAvailable() const | - | ||||||||||||||||||||||||
239 | { | - | ||||||||||||||||||||||||
240 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
241 | if (d->mode == UnencryptedMode
| 0 | ||||||||||||||||||||||||
242 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
243 | return never executed: d->plainSocket->bytesAvailable();return d->plainSocket->bytesAvailable(); never executed: return d->plainSocket->bytesAvailable(); | 0 | ||||||||||||||||||||||||
244 | } | - | ||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | qint64 QSslSocket::encryptedBytesToWrite() const | - | ||||||||||||||||||||||||
253 | { | - | ||||||||||||||||||||||||
254 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
255 | if (d->mode == UnencryptedMode
| 217-3037 | ||||||||||||||||||||||||
256 | return executed 217 times by 5 tests: 0;return 0; Executed by:
executed 217 times by 5 tests: return 0; Executed by:
| 217 | ||||||||||||||||||||||||
257 | return executed 3037 times by 6 tests: d->plainSocket->bytesToWrite();return d->plainSocket->bytesToWrite(); Executed by:
executed 3037 times by 6 tests: return d->plainSocket->bytesToWrite(); Executed by:
| 3037 | ||||||||||||||||||||||||
258 | } | - | ||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | bool QSslSocket::canReadLine() const | - | ||||||||||||||||||||||||
267 | { | - | ||||||||||||||||||||||||
268 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
269 | if (d->mode == UnencryptedMode
| 1-89 | ||||||||||||||||||||||||
270 | return executed 89 times by 2 tests: QIODevice::canReadLine()return QIODevice::canReadLine() || (d->plainSocket && d->plainSocket->canReadLine()); Executed by:
executed 89 times by 2 tests: return QIODevice::canReadLine() || (d->plainSocket && d->plainSocket->canReadLine()); Executed by:
| 11-89 | ||||||||||||||||||||||||
271 | return executed 1 time by 1 test: QIODevice::canReadLine();return QIODevice::canReadLine(); Executed by:
executed 1 time by 1 test: return QIODevice::canReadLine(); Executed by:
| 1 | ||||||||||||||||||||||||
272 | } | - | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | void QSslSocket::close() | - | ||||||||||||||||||||||||
278 | { | - | ||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||
282 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
283 | if (encryptedBytesToWrite()
| 0-257 | ||||||||||||||||||||||||
284 | flush(); executed 3 times by 1 test: flush(); Executed by:
| 3 | ||||||||||||||||||||||||
285 | if (d->plainSocket
| 0-260 | ||||||||||||||||||||||||
286 | d->plainSocket->close(); executed 260 times by 6 tests: d->plainSocket->close(); Executed by:
| 260 | ||||||||||||||||||||||||
287 | QTcpSocket::close(); | - | ||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | d->buffer.clear(); | - | ||||||||||||||||||||||||
291 | d->writeBuffer.clear(); | - | ||||||||||||||||||||||||
292 | } executed 260 times by 6 tests: end of block Executed by:
| 260 | ||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | - | |||||||||||||||||||||||||
296 | - | |||||||||||||||||||||||||
297 | bool QSslSocket::atEnd() const | - | ||||||||||||||||||||||||
298 | { | - | ||||||||||||||||||||||||
299 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
300 | if (d->mode == UnencryptedMode
| 0-11 | ||||||||||||||||||||||||
301 | return executed 11 times by 2 tests: QIODevice::atEnd()return QIODevice::atEnd() && (!d->plainSocket || d->plainSocket->atEnd()); Executed by:
executed 11 times by 2 tests: return QIODevice::atEnd() && (!d->plainSocket || d->plainSocket->atEnd()); Executed by:
| 0-11 | ||||||||||||||||||||||||
302 | return never executed: QIODevice::atEnd();return QIODevice::atEnd(); never executed: return QIODevice::atEnd(); | 0 | ||||||||||||||||||||||||
303 | } | - | ||||||||||||||||||||||||
304 | bool QSslSocket::flush() | - | ||||||||||||||||||||||||
305 | { | - | ||||||||||||||||||||||||
306 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | if (d->mode != UnencryptedMode
| 16-1816 | ||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||
312 | d->transmit(); executed 1816 times by 3 tests: d->transmit(); Executed by:
| 1816 | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | return executed 1832 times by 4 tests: d->plainSocketreturn d->plainSocket ? d->plainSocket->flush() : false; Executed by:
executed 1832 times by 4 tests: return d->plainSocket ? d->plainSocket->flush() : false; Executed by:
| 8-1832 | ||||||||||||||||||||||||
315 | } | - | ||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||
322 | void QSslSocket::setReadBufferSize(qint64 size) | - | ||||||||||||||||||||||||
323 | { | - | ||||||||||||||||||||||||
324 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
325 | d->readBufferMaxSize = size; | - | ||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||
327 | if (d->plainSocket
| 0-808 | ||||||||||||||||||||||||
328 | d->plainSocket->setReadBufferSize(size); executed 808 times by 8 tests: d->plainSocket->setReadBufferSize(size); Executed by:
| 808 | ||||||||||||||||||||||||
329 | } executed 808 times by 8 tests: end of block Executed by:
| 808 | ||||||||||||||||||||||||
330 | void QSslSocket::abort() | - | ||||||||||||||||||||||||
331 | { | - | ||||||||||||||||||||||||
332 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | if (d->plainSocket
| 0-81 | ||||||||||||||||||||||||
337 | d->plainSocket->abort(); executed 81 times by 3 tests: d->plainSocket->abort(); Executed by:
| 81 | ||||||||||||||||||||||||
338 | close(); | - | ||||||||||||||||||||||||
339 | } executed 81 times by 3 tests: end of block Executed by:
| 81 | ||||||||||||||||||||||||
340 | QSslConfiguration QSslSocket::sslConfiguration() const | - | ||||||||||||||||||||||||
341 | { | - | ||||||||||||||||||||||||
342 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | QSslConfigurationPrivate *copy = new QSslConfigurationPrivate(d->configuration); | - | ||||||||||||||||||||||||
346 | copy->ref.store(0); | - | ||||||||||||||||||||||||
347 | copy->sessionCipher = d->sessionCipher(); | - | ||||||||||||||||||||||||
348 | copy->sessionProtocol = d->sessionProtocol(); | - | ||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||
350 | return executed 626 times by 4 tests: QSslConfiguration(copy);return QSslConfiguration(copy); Executed by:
executed 626 times by 4 tests: return QSslConfiguration(copy); Executed by:
| 626 | ||||||||||||||||||||||||
351 | } | - | ||||||||||||||||||||||||
352 | void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration) | - | ||||||||||||||||||||||||
353 | { | - | ||||||||||||||||||||||||
354 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
355 | d->configuration.localCertificateChain = configuration.localCertificateChain(); | - | ||||||||||||||||||||||||
356 | d->configuration.privateKey = configuration.privateKey(); | - | ||||||||||||||||||||||||
357 | d->configuration.ciphers = configuration.ciphers(); | - | ||||||||||||||||||||||||
358 | d->configuration.ellipticCurves = configuration.ellipticCurves(); | - | ||||||||||||||||||||||||
359 | d->configuration.caCertificates = configuration.caCertificates(); | - | ||||||||||||||||||||||||
360 | d->configuration.peerVerifyDepth = configuration.peerVerifyDepth(); | - | ||||||||||||||||||||||||
361 | d->configuration.peerVerifyMode = configuration.peerVerifyMode(); | - | ||||||||||||||||||||||||
362 | d->configuration.protocol = configuration.protocol(); | - | ||||||||||||||||||||||||
363 | d->configuration.sslOptions = configuration.d->sslOptions; | - | ||||||||||||||||||||||||
364 | d->configuration.sslSession = configuration.sessionTicket(); | - | ||||||||||||||||||||||||
365 | d->configuration.sslSessionTicketLifeTimeHint = configuration.sessionTicketLifeTimeHint(); | - | ||||||||||||||||||||||||
366 | d->configuration.nextAllowedProtocols = configuration.allowedNextProtocols(); | - | ||||||||||||||||||||||||
367 | d->configuration.nextNegotiatedProtocol = configuration.nextNegotiatedProtocol(); | - | ||||||||||||||||||||||||
368 | d->configuration.nextProtocolNegotiationStatus = configuration.nextProtocolNegotiationStatus(); | - | ||||||||||||||||||||||||
369 | - | |||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||
371 | - | |||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | if (!configuration.d->allowRootCertOnDemandLoading
| 52-84 | ||||||||||||||||||||||||
374 | d->allowRootCertOnDemandLoading = false; executed 52 times by 2 tests: d->allowRootCertOnDemandLoading = false; Executed by:
| 52 | ||||||||||||||||||||||||
375 | } executed 136 times by 4 tests: end of block Executed by:
| 136 | ||||||||||||||||||||||||
376 | void QSslSocket::setLocalCertificateChain(const QList<QSslCertificate> &localChain) | - | ||||||||||||||||||||||||
377 | { | - | ||||||||||||||||||||||||
378 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
379 | d->configuration.localCertificateChain = localChain; | - | ||||||||||||||||||||||||
380 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||||||||
381 | QList<QSslCertificate> QSslSocket::localCertificateChain() const | - | ||||||||||||||||||||||||
382 | { | - | ||||||||||||||||||||||||
383 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
384 | return never executed: d->configuration.localCertificateChain;return d->configuration.localCertificateChain; never executed: return d->configuration.localCertificateChain; | 0 | ||||||||||||||||||||||||
385 | } | - | ||||||||||||||||||||||||
386 | void QSslSocket::setLocalCertificate(const QSslCertificate &certificate) | - | ||||||||||||||||||||||||
387 | { | - | ||||||||||||||||||||||||
388 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
389 | d->configuration.localCertificateChain = QList<QSslCertificate>(); | - | ||||||||||||||||||||||||
390 | d->configuration.localCertificateChain += certificate; | - | ||||||||||||||||||||||||
391 | } executed 77 times by 2 tests: end of block Executed by:
| 77 | ||||||||||||||||||||||||
392 | void QSslSocket::setLocalCertificate(const QString &path, | - | ||||||||||||||||||||||||
393 | QSsl::EncodingFormat format) | - | ||||||||||||||||||||||||
394 | { | - | ||||||||||||||||||||||||
395 | QFile file(path); | - | ||||||||||||||||||||||||
396 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)
| 0-19 | ||||||||||||||||||||||||
397 | setLocalCertificate(QSslCertificate(file.readAll(), format)); executed 19 times by 2 tests: setLocalCertificate(QSslCertificate(file.readAll(), format)); Executed by:
| 19 | ||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||
399 | } executed 19 times by 2 tests: end of block Executed by:
| 19 | ||||||||||||||||||||||||
400 | - | |||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||
407 | QSslCertificate QSslSocket::localCertificate() const | - | ||||||||||||||||||||||||
408 | { | - | ||||||||||||||||||||||||
409 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
410 | if (d->configuration.localCertificateChain.isEmpty()
| 5 | ||||||||||||||||||||||||
411 | return executed 5 times by 1 test: QSslCertificate();return QSslCertificate(); Executed by:
executed 5 times by 1 test: return QSslCertificate(); Executed by:
| 5 | ||||||||||||||||||||||||
412 | return executed 5 times by 1 test: d->configuration.localCertificateChain[0];return d->configuration.localCertificateChain[0]; Executed by:
executed 5 times by 1 test: return d->configuration.localCertificateChain[0]; Executed by:
| 5 | ||||||||||||||||||||||||
413 | } | - | ||||||||||||||||||||||||
414 | QSslCertificate QSslSocket::peerCertificate() const | - | ||||||||||||||||||||||||
415 | { | - | ||||||||||||||||||||||||
416 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
417 | return executed 26 times by 1 test: d->configuration.peerCertificate;return d->configuration.peerCertificate; Executed by:
executed 26 times by 1 test: return d->configuration.peerCertificate; Executed by:
| 26 | ||||||||||||||||||||||||
418 | } | - | ||||||||||||||||||||||||
419 | QList<QSslCertificate> QSslSocket::peerCertificateChain() const | - | ||||||||||||||||||||||||
420 | { | - | ||||||||||||||||||||||||
421 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
422 | return executed 26 times by 1 test: d->configuration.peerCertificateChain;return d->configuration.peerCertificateChain; Executed by:
executed 26 times by 1 test: return d->configuration.peerCertificateChain; Executed by:
| 26 | ||||||||||||||||||||||||
423 | } | - | ||||||||||||||||||||||||
424 | QSslCipher QSslSocket::sessionCipher() const | - | ||||||||||||||||||||||||
425 | { | - | ||||||||||||||||||||||||
426 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
427 | return executed 27 times by 1 test: d->sessionCipher();return d->sessionCipher(); Executed by:
executed 27 times by 1 test: return d->sessionCipher(); Executed by:
| 27 | ||||||||||||||||||||||||
428 | } | - | ||||||||||||||||||||||||
429 | QSsl::SslProtocol QSslSocket::sessionProtocol() const | - | ||||||||||||||||||||||||
430 | { | - | ||||||||||||||||||||||||
431 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
432 | return never executed: d->sessionProtocol();return d->sessionProtocol(); never executed: return d->sessionProtocol(); | 0 | ||||||||||||||||||||||||
433 | } | - | ||||||||||||||||||||||||
434 | void QSslSocket::setPrivateKey(const QSslKey &key) | - | ||||||||||||||||||||||||
435 | { | - | ||||||||||||||||||||||||
436 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
437 | d->configuration.privateKey = key; | - | ||||||||||||||||||||||||
438 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||
439 | void QSslSocket::setPrivateKey(const QString &fileName, QSsl::KeyAlgorithm algorithm, | - | ||||||||||||||||||||||||
440 | QSsl::EncodingFormat format, const QByteArray &passPhrase) | - | ||||||||||||||||||||||||
441 | { | - | ||||||||||||||||||||||||
442 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
443 | QFile file(fileName); | - | ||||||||||||||||||||||||
444 | if (file.open(QIODevice::ReadOnly)
| 0-9 | ||||||||||||||||||||||||
445 | d->configuration.privateKey = QSslKey(file.readAll(), algorithm, | - | ||||||||||||||||||||||||
446 | format, QSsl::PrivateKey, passPhrase); | - | ||||||||||||||||||||||||
447 | } executed 9 times by 2 tests: end of block Executed by:
| 9 | ||||||||||||||||||||||||
448 | } executed 9 times by 2 tests: end of block Executed by:
| 9 | ||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||
454 | - | |||||||||||||||||||||||||
455 | QSslKey QSslSocket::privateKey() const | - | ||||||||||||||||||||||||
456 | { | - | ||||||||||||||||||||||||
457 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
458 | return never executed: d->configuration.privateKey;return d->configuration.privateKey; never executed: return d->configuration.privateKey; | 0 | ||||||||||||||||||||||||
459 | } | - | ||||||||||||||||||||||||
460 | QList<QSslCipher> QSslSocket::ciphers() const | - | ||||||||||||||||||||||||
461 | { | - | ||||||||||||||||||||||||
462 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
463 | return executed 30 times by 1 test: d->configuration.ciphers;return d->configuration.ciphers; Executed by:
executed 30 times by 1 test: return d->configuration.ciphers; Executed by:
| 30 | ||||||||||||||||||||||||
464 | } | - | ||||||||||||||||||||||||
465 | void QSslSocket::setCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||||||||||||||
466 | { | - | ||||||||||||||||||||||||
467 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
468 | d->configuration.ciphers = ciphers; | - | ||||||||||||||||||||||||
469 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||
470 | void QSslSocket::setCiphers(const QString &ciphers) | - | ||||||||||||||||||||||||
471 | { | - | ||||||||||||||||||||||||
472 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
473 | d->configuration.ciphers.clear(); | - | ||||||||||||||||||||||||
474 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts))>::type> _container_((ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &cipherName = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
475 | QSslCipher cipher(cipherName); | - | ||||||||||||||||||||||||
476 | if (!cipher.isNull()
| 11-30 | ||||||||||||||||||||||||
477 | d->configuration.ciphers << cipher; executed 11 times by 1 test: d->configuration.ciphers << cipher; Executed by:
| 11 | ||||||||||||||||||||||||
478 | } executed 41 times by 1 test: end of block Executed by:
| 41 | ||||||||||||||||||||||||
479 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||
480 | void QSslSocket::setDefaultCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||||||||||||||
481 | { | - | ||||||||||||||||||||||||
482 | QSslSocketPrivate::setDefaultCiphers(ciphers); | - | ||||||||||||||||||||||||
483 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||
484 | QList<QSslCipher> QSslSocket::defaultCiphers() | - | ||||||||||||||||||||||||
485 | { | - | ||||||||||||||||||||||||
486 | return executed 40 times by 1 test: QSslSocketPrivate::defaultCiphers();return QSslSocketPrivate::defaultCiphers(); Executed by:
executed 40 times by 1 test: return QSslSocketPrivate::defaultCiphers(); Executed by:
| 40 | ||||||||||||||||||||||||
487 | } | - | ||||||||||||||||||||||||
488 | QList<QSslCipher> QSslSocket::supportedCiphers() | - | ||||||||||||||||||||||||
489 | { | - | ||||||||||||||||||||||||
490 | return executed 20 times by 1 test: QSslSocketPrivate::supportedCiphers();return QSslSocketPrivate::supportedCiphers(); Executed by:
executed 20 times by 1 test: return QSslSocketPrivate::supportedCiphers(); Executed by:
| 20 | ||||||||||||||||||||||||
491 | } | - | ||||||||||||||||||||||||
492 | bool QSslSocket::addCaCertificates(const QString &path, QSsl::EncodingFormat format, | - | ||||||||||||||||||||||||
493 | QRegExp::PatternSyntax syntax) | - | ||||||||||||||||||||||||
494 | { | - | ||||||||||||||||||||||||
495 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
496 | QList<QSslCertificate> certs = QSslCertificate::fromPath(path, format, syntax); | - | ||||||||||||||||||||||||
497 | if (certs.isEmpty()
| 0-12 | ||||||||||||||||||||||||
498 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | d->configuration.caCertificates += certs; | - | ||||||||||||||||||||||||
501 | return executed 12 times by 1 test: true;return true; Executed by:
executed 12 times by 1 test: return true; Executed by:
| 12 | ||||||||||||||||||||||||
502 | } | - | ||||||||||||||||||||||||
503 | void QSslSocket::addCaCertificate(const QSslCertificate &certificate) | - | ||||||||||||||||||||||||
504 | { | - | ||||||||||||||||||||||||
505 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
506 | d->configuration.caCertificates += certificate; | - | ||||||||||||||||||||||||
507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
508 | void QSslSocket::addCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||||||||||||||
509 | { | - | ||||||||||||||||||||||||
510 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
511 | d->configuration.caCertificates += certificates; | - | ||||||||||||||||||||||||
512 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||
513 | void QSslSocket::setCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||||||||||||||
514 | { | - | ||||||||||||||||||||||||
515 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
516 | d->configuration.caCertificates = certificates; | - | ||||||||||||||||||||||||
517 | d->allowRootCertOnDemandLoading = false; | - | ||||||||||||||||||||||||
518 | } executed 38 times by 2 tests: end of block Executed by:
| 38 | ||||||||||||||||||||||||
519 | QList<QSslCertificate> QSslSocket::caCertificates() const | - | ||||||||||||||||||||||||
520 | { | - | ||||||||||||||||||||||||
521 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
522 | return executed 20 times by 1 test: d->configuration.caCertificates;return d->configuration.caCertificates; Executed by:
executed 20 times by 1 test: return d->configuration.caCertificates; Executed by:
| 20 | ||||||||||||||||||||||||
523 | } | - | ||||||||||||||||||||||||
524 | bool QSslSocket::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat encoding, | - | ||||||||||||||||||||||||
525 | QRegExp::PatternSyntax syntax) | - | ||||||||||||||||||||||||
526 | { | - | ||||||||||||||||||||||||
527 | return never executed: QSslSocketPrivate::addDefaultCaCertificates(path, encoding, syntax);return QSslSocketPrivate::addDefaultCaCertificates(path, encoding, syntax); never executed: return QSslSocketPrivate::addDefaultCaCertificates(path, encoding, syntax); | 0 | ||||||||||||||||||||||||
528 | } | - | ||||||||||||||||||||||||
529 | void QSslSocket::addDefaultCaCertificate(const QSslCertificate &certificate) | - | ||||||||||||||||||||||||
530 | { | - | ||||||||||||||||||||||||
531 | QSslSocketPrivate::addDefaultCaCertificate(certificate); | - | ||||||||||||||||||||||||
532 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||
533 | void QSslSocket::addDefaultCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||||||||||||||
534 | { | - | ||||||||||||||||||||||||
535 | QSslSocketPrivate::addDefaultCaCertificates(certificates); | - | ||||||||||||||||||||||||
536 | } never executed: end of block | 0 | ||||||||||||||||||||||||
537 | void QSslSocket::setDefaultCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||||||||||||||
538 | { | - | ||||||||||||||||||||||||
539 | QSslSocketPrivate::setDefaultCaCertificates(certificates); | - | ||||||||||||||||||||||||
540 | } executed 51 times by 2 tests: end of block Executed by:
| 51 | ||||||||||||||||||||||||
541 | QList<QSslCertificate> QSslSocket::defaultCaCertificates() | - | ||||||||||||||||||||||||
542 | { | - | ||||||||||||||||||||||||
543 | return executed 41 times by 2 tests: QSslSocketPrivate::defaultCaCertificates();return QSslSocketPrivate::defaultCaCertificates(); Executed by:
executed 41 times by 2 tests: return QSslSocketPrivate::defaultCaCertificates(); Executed by:
| 41 | ||||||||||||||||||||||||
544 | } | - | ||||||||||||||||||||||||
545 | QList<QSslCertificate> QSslSocket::systemCaCertificates() | - | ||||||||||||||||||||||||
546 | { | - | ||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||
548 | return executed 53 times by 2 tests: QSslSocketPrivate::systemCaCertificates();return QSslSocketPrivate::systemCaCertificates(); Executed by:
executed 53 times by 2 tests: return QSslSocketPrivate::systemCaCertificates(); Executed by:
| 53 | ||||||||||||||||||||||||
549 | } | - | ||||||||||||||||||||||||
550 | bool QSslSocket::waitForConnected(int msecs) | - | ||||||||||||||||||||||||
551 | { | - | ||||||||||||||||||||||||
552 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
553 | if (!d->plainSocket
| 5-196 | ||||||||||||||||||||||||
554 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
555 | bool retVal = d->plainSocket->waitForConnected(msecs); | - | ||||||||||||||||||||||||
556 | if (!retVal
| 25-171 | ||||||||||||||||||||||||
557 | setSocketState(d->plainSocket->state()); | - | ||||||||||||||||||||||||
558 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||||||||||||||
559 | } executed 25 times by 2 tests: end of block Executed by:
| 25 | ||||||||||||||||||||||||
560 | return executed 196 times by 3 tests: retVal;return retVal; Executed by:
executed 196 times by 3 tests: return retVal; Executed by:
| 196 | ||||||||||||||||||||||||
561 | } | - | ||||||||||||||||||||||||
562 | bool QSslSocket::waitForEncrypted(int msecs) | - | ||||||||||||||||||||||||
563 | { | - | ||||||||||||||||||||||||
564 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
565 | if (!d->plainSocket
| 0-210 | ||||||||||||||||||||||||
566 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
567 | if (d->mode == UnencryptedMode
| 0-156 | ||||||||||||||||||||||||
568 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||
570 | QElapsedTimer stopWatch; | - | ||||||||||||||||||||||||
571 | stopWatch.start(); | - | ||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||
573 | if (d->plainSocket->state() != QAbstractSocket::ConnectedState
| 54-156 | ||||||||||||||||||||||||
574 | - | |||||||||||||||||||||||||
575 | if (!d->plainSocket->waitForConnected(msecs)
| 8-148 | ||||||||||||||||||||||||
576 | return executed 8 times by 2 tests: false;return false; Executed by:
executed 8 times by 2 tests: return false; Executed by:
| 8 | ||||||||||||||||||||||||
577 | } executed 148 times by 3 tests: end of block Executed by:
| 148 | ||||||||||||||||||||||||
578 | - | |||||||||||||||||||||||||
579 | while (!d->connectionEncrypted
| 137-469 | ||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||
581 | if (d->mode == UnencryptedMode
| 0-469 | ||||||||||||||||||||||||
582 | startClientEncryption(); never executed: startClientEncryption(); | 0 | ||||||||||||||||||||||||
583 | - | |||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||
585 | if (!d->plainSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))
| 65-404 | ||||||||||||||||||||||||
586 | return executed 65 times by 3 tests: false;return false; Executed by:
executed 65 times by 3 tests: return false; Executed by:
| 65 | ||||||||||||||||||||||||
587 | } executed 404 times by 5 tests: end of block Executed by:
| 404 | ||||||||||||||||||||||||
588 | return executed 137 times by 5 tests: d->connectionEncrypted;return d->connectionEncrypted; Executed by:
executed 137 times by 5 tests: return d->connectionEncrypted; Executed by:
| 137 | ||||||||||||||||||||||||
589 | } | - | ||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||
591 | - | |||||||||||||||||||||||||
592 | - | |||||||||||||||||||||||||
593 | - | |||||||||||||||||||||||||
594 | bool QSslSocket::waitForReadyRead(int msecs) | - | ||||||||||||||||||||||||
595 | { | - | ||||||||||||||||||||||||
596 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
597 | if (!d->plainSocket
| 5-286 | ||||||||||||||||||||||||
598 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
599 | if (d->mode == UnencryptedMode
| 0-232 | ||||||||||||||||||||||||
600 | return executed 232 times by 2 tests: d->plainSocket->waitForReadyRead(msecs);return d->plainSocket->waitForReadyRead(msecs); Executed by:
executed 232 times by 2 tests: return d->plainSocket->waitForReadyRead(msecs); Executed by:
| 232 | ||||||||||||||||||||||||
601 | - | |||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||
606 | bool readyReadEmitted = false; | - | ||||||||||||||||||||||||
607 | bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; | - | ||||||||||||||||||||||||
608 | d->readyReadEmittedPointer = &readyReadEmitted; | - | ||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||
610 | QElapsedTimer stopWatch; | - | ||||||||||||||||||||||||
611 | stopWatch.start(); | - | ||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||
613 | if (!d->connectionEncrypted
| 3-51 | ||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||
615 | if (!waitForEncrypted(msecs)
| 0-3 | ||||||||||||||||||||||||
616 | d->readyReadEmittedPointer = previousReadyReadEmittedPointer; | - | ||||||||||||||||||||||||
617 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
618 | } | - | ||||||||||||||||||||||||
619 | } executed 3 times by 2 tests: end of block Executed by:
| 3 | ||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||
621 | if (!d->writeBuffer.isEmpty()
| 1-53 | ||||||||||||||||||||||||
622 | - | |||||||||||||||||||||||||
623 | d->transmit(); | - | ||||||||||||||||||||||||
624 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | while (!readyReadEmitted
| 34-54 | ||||||||||||||||||||||||
629 | d->plainSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))
| 20-34 | ||||||||||||||||||||||||
630 | } executed 34 times by 3 tests: end of block Executed by:
| 34 | ||||||||||||||||||||||||
631 | - | |||||||||||||||||||||||||
632 | d->readyReadEmittedPointer = previousReadyReadEmittedPointer; | - | ||||||||||||||||||||||||
633 | return executed 54 times by 3 tests: readyReadEmitted;return readyReadEmitted; Executed by:
executed 54 times by 3 tests: return readyReadEmitted; Executed by:
| 54 | ||||||||||||||||||||||||
634 | } | - | ||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||
636 | - | |||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | - | |||||||||||||||||||||||||
639 | bool QSslSocket::waitForBytesWritten(int msecs) | - | ||||||||||||||||||||||||
640 | { | - | ||||||||||||||||||||||||
641 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
642 | if (!d->plainSocket
| 5-2543 | ||||||||||||||||||||||||
643 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
644 | if (d->mode == UnencryptedMode
| 169-2374 | ||||||||||||||||||||||||
645 | return executed 169 times by 2 tests: d->plainSocket->waitForBytesWritten(msecs);return d->plainSocket->waitForBytesWritten(msecs); Executed by:
executed 169 times by 2 tests: return d->plainSocket->waitForBytesWritten(msecs); Executed by:
| 169 | ||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||
647 | QElapsedTimer stopWatch; | - | ||||||||||||||||||||||||
648 | stopWatch.start(); | - | ||||||||||||||||||||||||
649 | - | |||||||||||||||||||||||||
650 | if (!d->connectionEncrypted
| 0-2374 | ||||||||||||||||||||||||
651 | - | |||||||||||||||||||||||||
652 | if (!waitForEncrypted(msecs)
| 0 | ||||||||||||||||||||||||
653 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
654 | } never executed: end of block | 0 | ||||||||||||||||||||||||
655 | if (!d->writeBuffer.isEmpty()
| 1-2373 | ||||||||||||||||||||||||
656 | - | |||||||||||||||||||||||||
657 | d->transmit(); | - | ||||||||||||||||||||||||
658 | } executed 2373 times by 3 tests: end of block Executed by:
| 2373 | ||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | return executed 2374 times by 3 tests: d->plainSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));return d->plainSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed())); Executed by:
executed 2374 times by 3 tests: return d->plainSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed())); Executed by:
| 2374 | ||||||||||||||||||||||||
661 | } | - | ||||||||||||||||||||||||
662 | bool QSslSocket::waitForDisconnected(int msecs) | - | ||||||||||||||||||||||||
663 | { | - | ||||||||||||||||||||||||
664 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||
666 | - | |||||||||||||||||||||||||
667 | if (state() == UnconnectedState
| 5-120 | ||||||||||||||||||||||||
668 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
executed 5 times by 1 test: QMessageLogger(__FILE__, 1669, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::waitForDisconnected() is not allowed in UnconnectedState"); Executed by:
| 5 | ||||||||||||||||||||||||
669 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
670 | } | - | ||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||
672 | if (!d->plainSocket
| 0-120 | ||||||||||||||||||||||||
673 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
674 | if (d->mode == UnencryptedMode
| 40-80 | ||||||||||||||||||||||||
675 | return executed 80 times by 3 tests: d->plainSocket->waitForDisconnected(msecs);return d->plainSocket->waitForDisconnected(msecs); Executed by:
executed 80 times by 3 tests: return d->plainSocket->waitForDisconnected(msecs); Executed by:
| 80 | ||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | QElapsedTimer stopWatch; | - | ||||||||||||||||||||||||
678 | stopWatch.start(); | - | ||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||
680 | if (!d->connectionEncrypted
| 0-40 | ||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||
682 | if (!waitForEncrypted(msecs)
| 0 | ||||||||||||||||||||||||
683 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
684 | } never executed: end of block | 0 | ||||||||||||||||||||||||
685 | bool retVal = d->plainSocket->waitForDisconnected(qt_subtract_from_timeout(msecs, stopWatch.elapsed())); | - | ||||||||||||||||||||||||
686 | if (!retVal
| 0-40 | ||||||||||||||||||||||||
687 | setSocketState(d->plainSocket->state()); | - | ||||||||||||||||||||||||
688 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||||||||||||||
689 | } never executed: end of block | 0 | ||||||||||||||||||||||||
690 | return executed 40 times by 2 tests: retVal;return retVal; Executed by:
executed 40 times by 2 tests: return retVal; Executed by:
| 40 | ||||||||||||||||||||||||
691 | } | - | ||||||||||||||||||||||||
692 | QList<QSslError> QSslSocket::sslErrors() const | - | ||||||||||||||||||||||||
693 | { | - | ||||||||||||||||||||||||
694 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
695 | return executed 13 times by 1 test: d->sslErrors;return d->sslErrors; Executed by:
executed 13 times by 1 test: return d->sslErrors; Executed by:
| 13 | ||||||||||||||||||||||||
696 | } | - | ||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | - | |||||||||||||||||||||||||
699 | - | |||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | bool QSslSocket::supportsSsl() | - | ||||||||||||||||||||||||
704 | { | - | ||||||||||||||||||||||||
705 | return executed 38789 times by 26 tests: QSslSocketPrivate::supportsSsl();return QSslSocketPrivate::supportsSsl(); Executed by:
executed 38789 times by 26 tests: return QSslSocketPrivate::supportsSsl(); Executed by:
| 38789 | ||||||||||||||||||||||||
706 | } | - | ||||||||||||||||||||||||
707 | long QSslSocket::sslLibraryVersionNumber() | - | ||||||||||||||||||||||||
708 | { | - | ||||||||||||||||||||||||
709 | return executed 6 times by 1 test: QSslSocketPrivate::sslLibraryVersionNumber();return QSslSocketPrivate::sslLibraryVersionNumber(); Executed by:
executed 6 times by 1 test: return QSslSocketPrivate::sslLibraryVersionNumber(); Executed by:
| 6 | ||||||||||||||||||||||||
710 | } | - | ||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||
712 | - | |||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||
714 | - | |||||||||||||||||||||||||
715 | - | |||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||
718 | QString QSslSocket::sslLibraryVersionString() | - | ||||||||||||||||||||||||
719 | { | - | ||||||||||||||||||||||||
720 | return executed 6 times by 1 test: QSslSocketPrivate::sslLibraryVersionString();return QSslSocketPrivate::sslLibraryVersionString(); Executed by:
executed 6 times by 1 test: return QSslSocketPrivate::sslLibraryVersionString(); Executed by:
| 6 | ||||||||||||||||||||||||
721 | } | - | ||||||||||||||||||||||||
722 | long QSslSocket::sslLibraryBuildVersionNumber() | - | ||||||||||||||||||||||||
723 | { | - | ||||||||||||||||||||||||
724 | return never executed: QSslSocketPrivate::sslLibraryBuildVersionNumber();return QSslSocketPrivate::sslLibraryBuildVersionNumber(); never executed: return QSslSocketPrivate::sslLibraryBuildVersionNumber(); | 0 | ||||||||||||||||||||||||
725 | } | - | ||||||||||||||||||||||||
726 | QString QSslSocket::sslLibraryBuildVersionString() | - | ||||||||||||||||||||||||
727 | { | - | ||||||||||||||||||||||||
728 | return never executed: QSslSocketPrivate::sslLibraryBuildVersionString();return QSslSocketPrivate::sslLibraryBuildVersionString(); never executed: return QSslSocketPrivate::sslLibraryBuildVersionString(); | 0 | ||||||||||||||||||||||||
729 | } | - | ||||||||||||||||||||||||
730 | void QSslSocket::startClientEncryption() | - | ||||||||||||||||||||||||
731 | { | - | ||||||||||||||||||||||||
732 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
733 | if (d->mode != UnencryptedMode
| 0-422 | ||||||||||||||||||||||||
734 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
735 | __FILE__ never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
736 | , never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
737 | 1785 never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
738 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
739 | ; never executed: QMessageLogger( __FILE__ , 1785 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") ; | 0 | ||||||||||||||||||||||||
740 | return; never executed: return; | 0 | ||||||||||||||||||||||||
741 | } | - | ||||||||||||||||||||||||
742 | if (state() != ConnectedState
| 6-416 | ||||||||||||||||||||||||
743 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
744 | __FILE__ executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
745 | , executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
746 | 1790 executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
747 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
748 | ; executed 6 times by 1 test: QMessageLogger( __FILE__ , 1790 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") ; Executed by:
| 6 | ||||||||||||||||||||||||
749 | return; executed 6 times by 1 test: return; Executed by:
| 6 | ||||||||||||||||||||||||
750 | } | - | ||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||
754 | d->mode = SslClientMode; | - | ||||||||||||||||||||||||
755 | modeChanged(d->mode); | - | ||||||||||||||||||||||||
756 | d->startClientEncryption(); | - | ||||||||||||||||||||||||
757 | } executed 416 times by 7 tests: end of block Executed by:
| 416 | ||||||||||||||||||||||||
758 | void QSslSocket::startServerEncryption() | - | ||||||||||||||||||||||||
759 | { | - | ||||||||||||||||||||||||
760 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
761 | if (d->mode != UnencryptedMode
| 0-63 | ||||||||||||||||||||||||
762 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1825, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startServerEncryption: cannot start handshake on non-plain connection"); | 0 | ||||||||||||||||||||||||
763 | return; never executed: return; | 0 | ||||||||||||||||||||||||
764 | } | - | ||||||||||||||||||||||||
765 | - | |||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | - | |||||||||||||||||||||||||
768 | d->mode = SslServerMode; | - | ||||||||||||||||||||||||
769 | modeChanged(d->mode); | - | ||||||||||||||||||||||||
770 | d->startServerEncryption(); | - | ||||||||||||||||||||||||
771 | } executed 63 times by 2 tests: end of block Executed by:
| 63 | ||||||||||||||||||||||||
772 | void QSslSocket::ignoreSslErrors() | - | ||||||||||||||||||||||||
773 | { | - | ||||||||||||||||||||||||
774 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
775 | d->ignoreAllSslErrors = true; | - | ||||||||||||||||||||||||
776 | } executed 164 times by 5 tests: end of block Executed by:
| 164 | ||||||||||||||||||||||||
777 | void QSslSocket::ignoreSslErrors(const QList<QSslError> &errors) | - | ||||||||||||||||||||||||
778 | { | - | ||||||||||||||||||||||||
779 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
780 | d->ignoreErrorsList = errors; | - | ||||||||||||||||||||||||
781 | } executed 187 times by 4 tests: end of block Executed by:
| 187 | ||||||||||||||||||||||||
782 | - | |||||||||||||||||||||||||
783 | - | |||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||
786 | void QSslSocket::connectToHost(const QString &hostName, quint16 port, OpenMode openMode, NetworkLayerProtocol protocol) | - | ||||||||||||||||||||||||
787 | { | - | ||||||||||||||||||||||||
788 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
789 | d->preferredNetworkLayerProtocol = protocol; | - | ||||||||||||||||||||||||
790 | if (!d->initialized
| 309-407 | ||||||||||||||||||||||||
791 | d->init(); executed 309 times by 3 tests: d->init(); Executed by:
| 309 | ||||||||||||||||||||||||
792 | d->initialized = false; | - | ||||||||||||||||||||||||
793 | - | |||||||||||||||||||||||||
794 | - | |||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | if (!d->plainSocket
| 128-588 | ||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||
802 | d->createPlainSocket(openMode); | - | ||||||||||||||||||||||||
803 | } executed 588 times by 8 tests: end of block Executed by:
| 588 | ||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||
805 | d->plainSocket->setProxy(proxy()); | - | ||||||||||||||||||||||||
806 | - | |||||||||||||||||||||||||
807 | QIODevice::open(openMode); | - | ||||||||||||||||||||||||
808 | d->plainSocket->connectToHost(hostName, port, openMode, d->preferredNetworkLayerProtocol); | - | ||||||||||||||||||||||||
809 | d->cachedSocketDescriptor = d->plainSocket->socketDescriptor(); | - | ||||||||||||||||||||||||
810 | } executed 716 times by 8 tests: end of block Executed by:
| 716 | ||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||
815 | void QSslSocket::disconnectFromHost() | - | ||||||||||||||||||||||||
816 | { | - | ||||||||||||||||||||||||
817 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||
821 | if (!d->plainSocket
| 0-161 | ||||||||||||||||||||||||
822 | return; never executed: return; | 0 | ||||||||||||||||||||||||
823 | if (d->state == UnconnectedState
| 0-161 | ||||||||||||||||||||||||
824 | return; never executed: return; | 0 | ||||||||||||||||||||||||
825 | if (d->mode == UnencryptedMode
| 9-110 | ||||||||||||||||||||||||
826 | d->plainSocket->disconnectFromHost(); | - | ||||||||||||||||||||||||
827 | return; executed 42 times by 1 test: return; Executed by:
| 42 | ||||||||||||||||||||||||
828 | } | - | ||||||||||||||||||||||||
829 | if (d->state <= ConnectingState
| 9-110 | ||||||||||||||||||||||||
830 | d->pendingClose = true; | - | ||||||||||||||||||||||||
831 | return; executed 9 times by 1 test: return; Executed by:
| 9 | ||||||||||||||||||||||||
832 | } | - | ||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||
834 | - | |||||||||||||||||||||||||
835 | if (d->state != ClosingState
| 48-62 | ||||||||||||||||||||||||
836 | d->state = ClosingState; | - | ||||||||||||||||||||||||
837 | stateChanged(d->state); | - | ||||||||||||||||||||||||
838 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||
840 | if (!d->writeBuffer.isEmpty()
| 10-100 | ||||||||||||||||||||||||
841 | d->pendingClose = true; | - | ||||||||||||||||||||||||
842 | return; executed 10 times by 1 test: return; Executed by:
| 10 | ||||||||||||||||||||||||
843 | } | - | ||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||
845 | if (d->mode == UnencryptedMode
| 0-100 | ||||||||||||||||||||||||
846 | d->plainSocket->disconnectFromHost(); | - | ||||||||||||||||||||||||
847 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
848 | d->disconnectFromHost(); | - | ||||||||||||||||||||||||
849 | } executed 100 times by 1 test: end of block Executed by:
| 100 | ||||||||||||||||||||||||
850 | } | - | ||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||
853 | - | |||||||||||||||||||||||||
854 | - | |||||||||||||||||||||||||
855 | qint64 QSslSocket::readData(char *data, qint64 maxlen) | - | ||||||||||||||||||||||||
856 | { | - | ||||||||||||||||||||||||
857 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
858 | qint64 readBytes = 0; | - | ||||||||||||||||||||||||
859 | - | |||||||||||||||||||||||||
860 | if (d->mode == UnencryptedMode
| 0-5635 | ||||||||||||||||||||||||
861 | readBytes = d->plainSocket->read(data, maxlen); | - | ||||||||||||||||||||||||
862 | - | |||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||
866 | } executed 5415 times by 3 tests: else {end of block Executed by:
| 5415 | ||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||
868 | if (d->plainSocket->bytesAvailable()
| 1-5634 | ||||||||||||||||||||||||
869 | QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection); executed 1 time by 1 test: QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection); Executed by:
| 1 | ||||||||||||||||||||||||
870 | } executed 5635 times by 5 tests: end of block Executed by:
| 5635 | ||||||||||||||||||||||||
871 | - | |||||||||||||||||||||||||
872 | return executed 11050 times by 6 tests: readBytes;return readBytes; Executed by:
executed 11050 times by 6 tests: return readBytes; Executed by:
| 11050 | ||||||||||||||||||||||||
873 | } | - | ||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||
875 | - | |||||||||||||||||||||||||
876 | - | |||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||
878 | qint64 QSslSocket::writeData(const char *data, qint64 len) | - | ||||||||||||||||||||||||
879 | { | - | ||||||||||||||||||||||||
880 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | if (d->mode == UnencryptedMode
| 7-5396 | ||||||||||||||||||||||||
885 | return executed 291 times by 3 tests: d->plainSocket->write(data, len);return d->plainSocket->write(data, len); Executed by:
executed 291 times by 3 tests: return d->plainSocket->write(data, len); Executed by:
| 291 | ||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||
887 | char *writePtr = d->writeBuffer.reserve(len); | - | ||||||||||||||||||||||||
888 | ::memcpy(writePtr, data, len); | - | ||||||||||||||||||||||||
889 | - | |||||||||||||||||||||||||
890 | - | |||||||||||||||||||||||||
891 | QMetaObject::invokeMethod(this, "_q_flushWriteBuffer", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
892 | - | |||||||||||||||||||||||||
893 | return executed 5403 times by 5 tests: len;return len; Executed by:
executed 5403 times by 5 tests: return len; Executed by:
| 5403 | ||||||||||||||||||||||||
894 | } | - | ||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||
899 | QSslSocketPrivate::QSslSocketPrivate() | - | ||||||||||||||||||||||||
900 | : initialized(false) | - | ||||||||||||||||||||||||
901 | , mode(QSslSocket::UnencryptedMode) | - | ||||||||||||||||||||||||
902 | , autoStartHandshake(false) | - | ||||||||||||||||||||||||
903 | , connectionEncrypted(false) | - | ||||||||||||||||||||||||
904 | , shutdown(false) | - | ||||||||||||||||||||||||
905 | , ignoreAllSslErrors(false) | - | ||||||||||||||||||||||||
906 | , readyReadEmittedPointer(0) | - | ||||||||||||||||||||||||
907 | , allowRootCertOnDemandLoading(true) | - | ||||||||||||||||||||||||
908 | , plainSocket(0) | - | ||||||||||||||||||||||||
909 | , paused(false) | - | ||||||||||||||||||||||||
910 | { | - | ||||||||||||||||||||||||
911 | QSslConfigurationPrivate::deepCopyDefaultConfiguration(&configuration); | - | ||||||||||||||||||||||||
912 | } executed 713 times by 8 tests: end of block Executed by:
| 713 | ||||||||||||||||||||||||
913 | - | |||||||||||||||||||||||||
914 | - | |||||||||||||||||||||||||
915 | - | |||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||
917 | QSslSocketPrivate::~QSslSocketPrivate() | - | ||||||||||||||||||||||||
918 | { | - | ||||||||||||||||||||||||
919 | } | - | ||||||||||||||||||||||||
920 | - | |||||||||||||||||||||||||
921 | - | |||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||
923 | - | |||||||||||||||||||||||||
924 | void QSslSocketPrivate::init() | - | ||||||||||||||||||||||||
925 | { | - | ||||||||||||||||||||||||
926 | mode = QSslSocket::UnencryptedMode; | - | ||||||||||||||||||||||||
927 | autoStartHandshake = false; | - | ||||||||||||||||||||||||
928 | connectionEncrypted = false; | - | ||||||||||||||||||||||||
929 | ignoreAllSslErrors = false; | - | ||||||||||||||||||||||||
930 | shutdown = false; | - | ||||||||||||||||||||||||
931 | pendingClose = false; | - | ||||||||||||||||||||||||
932 | - | |||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||
934 | - | |||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||
937 | buffer.clear(); | - | ||||||||||||||||||||||||
938 | writeBuffer.clear(); | - | ||||||||||||||||||||||||
939 | configuration.peerCertificate.clear(); | - | ||||||||||||||||||||||||
940 | configuration.peerCertificateChain.clear(); | - | ||||||||||||||||||||||||
941 | } executed 1444 times by 8 tests: end of block Executed by:
| 1444 | ||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||
943 | - | |||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||
945 | - | |||||||||||||||||||||||||
946 | QList<QSslCipher> QSslSocketPrivate::defaultCiphers() | - | ||||||||||||||||||||||||
947 | { | - | ||||||||||||||||||||||||
948 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
949 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
950 | return executed 94 times by 4 tests: globalData()->config->ciphers;return globalData()->config->ciphers; Executed by:
executed 94 times by 4 tests: return globalData()->config->ciphers; Executed by:
| 94 | ||||||||||||||||||||||||
951 | } | - | ||||||||||||||||||||||||
952 | - | |||||||||||||||||||||||||
953 | - | |||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||
956 | QList<QSslCipher> QSslSocketPrivate::supportedCiphers() | - | ||||||||||||||||||||||||
957 | { | - | ||||||||||||||||||||||||
958 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
959 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
960 | return executed 61 times by 1 test: globalData()->supportedCiphers;return globalData()->supportedCiphers; Executed by:
executed 61 times by 1 test: return globalData()->supportedCiphers; Executed by:
| 61 | ||||||||||||||||||||||||
961 | } | - | ||||||||||||||||||||||||
962 | - | |||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||
966 | void QSslSocketPrivate::setDefaultCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||||||||||||||
967 | { | - | ||||||||||||||||||||||||
968 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
969 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
970 | globalData()->config->ciphers = ciphers; | - | ||||||||||||||||||||||||
971 | } executed 20 times by 15 tests: end of block Executed by:
| 20 | ||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||
976 | void QSslSocketPrivate::setDefaultSupportedCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||||||||||||||
977 | { | - | ||||||||||||||||||||||||
978 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
979 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
980 | globalData()->supportedCiphers = ciphers; | - | ||||||||||||||||||||||||
981 | } executed 15 times by 15 tests: end of block Executed by:
| 15 | ||||||||||||||||||||||||
982 | - | |||||||||||||||||||||||||
983 | - | |||||||||||||||||||||||||
984 | - | |||||||||||||||||||||||||
985 | - | |||||||||||||||||||||||||
986 | QVector<QSslEllipticCurve> QSslSocketPrivate::supportedEllipticCurves() | - | ||||||||||||||||||||||||
987 | { | - | ||||||||||||||||||||||||
988 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
989 | const QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
990 | return executed 2 times by 1 test: globalData()->supportedEllipticCurves;return globalData()->supportedEllipticCurves; Executed by:
executed 2 times by 1 test: return globalData()->supportedEllipticCurves; Executed by:
| 2 | ||||||||||||||||||||||||
991 | } | - | ||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||
993 | - | |||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||
996 | void QSslSocketPrivate::setDefaultSupportedEllipticCurves(const QVector<QSslEllipticCurve> &curves) | - | ||||||||||||||||||||||||
997 | { | - | ||||||||||||||||||||||||
998 | const QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
999 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
1000 | globalData()->supportedEllipticCurves = curves; | - | ||||||||||||||||||||||||
1001 | } executed 15 times by 15 tests: end of block Executed by:
| 15 | ||||||||||||||||||||||||
1002 | - | |||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||
1004 | - | |||||||||||||||||||||||||
1005 | - | |||||||||||||||||||||||||
1006 | QList<QSslCertificate> QSslSocketPrivate::defaultCaCertificates() | - | ||||||||||||||||||||||||
1007 | { | - | ||||||||||||||||||||||||
1008 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1009 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1010 | return executed 42 times by 3 tests: globalData()->config->caCertificates;return globalData()->config->caCertificates; Executed by:
executed 42 times by 3 tests: return globalData()->config->caCertificates; Executed by:
| 42 | ||||||||||||||||||||||||
1011 | } | - | ||||||||||||||||||||||||
1012 | - | |||||||||||||||||||||||||
1013 | - | |||||||||||||||||||||||||
1014 | - | |||||||||||||||||||||||||
1015 | - | |||||||||||||||||||||||||
1016 | void QSslSocketPrivate::setDefaultCaCertificates(const QList<QSslCertificate> &certs) | - | ||||||||||||||||||||||||
1017 | { | - | ||||||||||||||||||||||||
1018 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1019 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1020 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
1021 | globalData()->config->caCertificates = certs; | - | ||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||
1023 | - | |||||||||||||||||||||||||
1024 | s_loadRootCertsOnDemand = false; | - | ||||||||||||||||||||||||
1025 | } executed 52 times by 3 tests: end of block Executed by:
| 52 | ||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||
1027 | - | |||||||||||||||||||||||||
1028 | - | |||||||||||||||||||||||||
1029 | - | |||||||||||||||||||||||||
1030 | bool QSslSocketPrivate::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat format, | - | ||||||||||||||||||||||||
1031 | QRegExp::PatternSyntax syntax) | - | ||||||||||||||||||||||||
1032 | { | - | ||||||||||||||||||||||||
1033 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1034 | QList<QSslCertificate> certs = QSslCertificate::fromPath(path, format, syntax); | - | ||||||||||||||||||||||||
1035 | if (certs.isEmpty()
| 0 | ||||||||||||||||||||||||
1036 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1037 | - | |||||||||||||||||||||||||
1038 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1039 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
1040 | globalData()->config->caCertificates += certs; | - | ||||||||||||||||||||||||
1041 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1042 | } | - | ||||||||||||||||||||||||
1043 | - | |||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||
1045 | - | |||||||||||||||||||||||||
1046 | - | |||||||||||||||||||||||||
1047 | void QSslSocketPrivate::addDefaultCaCertificate(const QSslCertificate &cert) | - | ||||||||||||||||||||||||
1048 | { | - | ||||||||||||||||||||||||
1049 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1050 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1051 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
1052 | globalData()->config->caCertificates += cert; | - | ||||||||||||||||||||||||
1053 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||
1054 | - | |||||||||||||||||||||||||
1055 | - | |||||||||||||||||||||||||
1056 | - | |||||||||||||||||||||||||
1057 | - | |||||||||||||||||||||||||
1058 | void QSslSocketPrivate::addDefaultCaCertificates(const QList<QSslCertificate> &certs) | - | ||||||||||||||||||||||||
1059 | { | - | ||||||||||||||||||||||||
1060 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1061 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1062 | globalData()->config.detach(); | - | ||||||||||||||||||||||||
1063 | globalData()->config->caCertificates += certs; | - | ||||||||||||||||||||||||
1064 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1065 | - | |||||||||||||||||||||||||
1066 | - | |||||||||||||||||||||||||
1067 | - | |||||||||||||||||||||||||
1068 | - | |||||||||||||||||||||||||
1069 | QSslConfiguration QSslConfigurationPrivate::defaultConfiguration() | - | ||||||||||||||||||||||||
1070 | { | - | ||||||||||||||||||||||||
1071 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1072 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1073 | return executed 1001 times by 11 tests: QSslConfiguration(globalData()->config.data());return QSslConfiguration(globalData()->config.data()); Executed by:
executed 1001 times by 11 tests: return QSslConfiguration(globalData()->config.data()); Executed by:
| 1001 | ||||||||||||||||||||||||
1074 | } | - | ||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||
1077 | - | |||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||
1079 | void QSslConfigurationPrivate::setDefaultConfiguration(const QSslConfiguration &configuration) | - | ||||||||||||||||||||||||
1080 | { | - | ||||||||||||||||||||||||
1081 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1082 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1083 | if (globalData()->config == configuration.d
| 0-16 | ||||||||||||||||||||||||
1084 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1085 | - | |||||||||||||||||||||||||
1086 | globalData()->config = const_cast<QSslConfigurationPrivate*>(configuration.d.constData()); | - | ||||||||||||||||||||||||
1087 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||
1089 | - | |||||||||||||||||||||||||
1090 | - | |||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||
1092 | void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPrivate *ptr) | - | ||||||||||||||||||||||||
1093 | { | - | ||||||||||||||||||||||||
1094 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||||||||||||||
1095 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||||||||||||||
1096 | const QSslConfigurationPrivate *global = globalData()->config.constData(); | - | ||||||||||||||||||||||||
1097 | - | |||||||||||||||||||||||||
1098 | if (!global
| 0-713 | ||||||||||||||||||||||||
1099 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1100 | - | |||||||||||||||||||||||||
1101 | ptr->ref.store(1); | - | ||||||||||||||||||||||||
1102 | ptr->peerCertificate = global->peerCertificate; | - | ||||||||||||||||||||||||
1103 | ptr->peerCertificateChain = global->peerCertificateChain; | - | ||||||||||||||||||||||||
1104 | ptr->localCertificateChain = global->localCertificateChain; | - | ||||||||||||||||||||||||
1105 | ptr->privateKey = global->privateKey; | - | ||||||||||||||||||||||||
1106 | ptr->sessionCipher = global->sessionCipher; | - | ||||||||||||||||||||||||
1107 | ptr->sessionProtocol = global->sessionProtocol; | - | ||||||||||||||||||||||||
1108 | ptr->ciphers = global->ciphers; | - | ||||||||||||||||||||||||
1109 | ptr->caCertificates = global->caCertificates; | - | ||||||||||||||||||||||||
1110 | ptr->protocol = global->protocol; | - | ||||||||||||||||||||||||
1111 | ptr->peerVerifyMode = global->peerVerifyMode; | - | ||||||||||||||||||||||||
1112 | ptr->peerVerifyDepth = global->peerVerifyDepth; | - | ||||||||||||||||||||||||
1113 | ptr->sslOptions = global->sslOptions; | - | ||||||||||||||||||||||||
1114 | ptr->ellipticCurves = global->ellipticCurves; | - | ||||||||||||||||||||||||
1115 | } executed 713 times by 8 tests: end of block Executed by:
| 713 | ||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||
1117 | - | |||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||
1120 | void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode) | - | ||||||||||||||||||||||||
1121 | { | - | ||||||||||||||||||||||||
1122 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1123 | q->setOpenMode(openMode); | - | ||||||||||||||||||||||||
1124 | q->setSocketState(QAbstractSocket::UnconnectedState); | - | ||||||||||||||||||||||||
1125 | q->setSocketError(QAbstractSocket::UnknownSocketError); | - | ||||||||||||||||||||||||
1126 | q->setLocalPort(0); | - | ||||||||||||||||||||||||
1127 | q->setLocalAddress(QHostAddress()); | - | ||||||||||||||||||||||||
1128 | q->setPeerPort(0); | - | ||||||||||||||||||||||||
1129 | q->setPeerAddress(QHostAddress()); | - | ||||||||||||||||||||||||
1130 | q->setPeerName(QString()); | - | ||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||
1132 | plainSocket = new QTcpSocket(q); | - | ||||||||||||||||||||||||
1133 | - | |||||||||||||||||||||||||
1134 | - | |||||||||||||||||||||||||
1135 | plainSocket->setProperty("_q_networksession", q->property("_q_networksession")); | - | ||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||
1137 | q->connect(plainSocket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "2248"), | - | ||||||||||||||||||||||||
1138 | q, qFlagLocation("1""_q_connectedSlot()" "\0" __FILE__ ":" "2249"), | - | ||||||||||||||||||||||||
1139 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1140 | q->connect(plainSocket, qFlagLocation("2""hostFound()" "\0" __FILE__ ":" "2251"), | - | ||||||||||||||||||||||||
1141 | q, qFlagLocation("1""_q_hostFoundSlot()" "\0" __FILE__ ":" "2252"), | - | ||||||||||||||||||||||||
1142 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1143 | q->connect(plainSocket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "2254"), | - | ||||||||||||||||||||||||
1144 | q, qFlagLocation("1""_q_disconnectedSlot()" "\0" __FILE__ ":" "2255"), | - | ||||||||||||||||||||||||
1145 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1146 | q->connect(plainSocket, qFlagLocation("2""stateChanged(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "2257"), | - | ||||||||||||||||||||||||
1147 | q, qFlagLocation("1""_q_stateChangedSlot(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "2258"), | - | ||||||||||||||||||||||||
1148 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1149 | q->connect(plainSocket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "2260"), | - | ||||||||||||||||||||||||
1150 | q, qFlagLocation("1""_q_errorSlot(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "2261"), | - | ||||||||||||||||||||||||
1151 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1152 | q->connect(plainSocket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "2263"), | - | ||||||||||||||||||||||||
1153 | q, qFlagLocation("1""_q_readyReadSlot()" "\0" __FILE__ ":" "2264"), | - | ||||||||||||||||||||||||
1154 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1155 | q->connect(plainSocket, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "2266"), | - | ||||||||||||||||||||||||
1156 | q, qFlagLocation("1""_q_bytesWrittenSlot(qint64)" "\0" __FILE__ ":" "2267"), | - | ||||||||||||||||||||||||
1157 | Qt::DirectConnection); | - | ||||||||||||||||||||||||
1158 | - | |||||||||||||||||||||||||
1159 | q->connect(plainSocket, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "2270"), | - | ||||||||||||||||||||||||
1160 | q, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "2271")); | - | ||||||||||||||||||||||||
1161 | - | |||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||
1163 | buffer.clear(); | - | ||||||||||||||||||||||||
1164 | writeBuffer.clear(); | - | ||||||||||||||||||||||||
1165 | connectionEncrypted = false; | - | ||||||||||||||||||||||||
1166 | configuration.peerCertificate.clear(); | - | ||||||||||||||||||||||||
1167 | configuration.peerCertificateChain.clear(); | - | ||||||||||||||||||||||||
1168 | mode = QSslSocket::UnencryptedMode; | - | ||||||||||||||||||||||||
1169 | q->setReadBufferSize(readBufferMaxSize); | - | ||||||||||||||||||||||||
1170 | } executed 670 times by 8 tests: end of block Executed by:
| 670 | ||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||
1172 | void QSslSocketPrivate::pauseSocketNotifiers(QSslSocket *socket) | - | ||||||||||||||||||||||||
1173 | { | - | ||||||||||||||||||||||||
1174 | if (!socket->d_func()->plainSocket
| 0-138 | ||||||||||||||||||||||||
1175 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1176 | QAbstractSocketPrivate::pauseSocketNotifiers(socket->d_func()->plainSocket); | - | ||||||||||||||||||||||||
1177 | } executed 138 times by 4 tests: end of block Executed by:
| 138 | ||||||||||||||||||||||||
1178 | - | |||||||||||||||||||||||||
1179 | void QSslSocketPrivate::resumeSocketNotifiers(QSslSocket *socket) | - | ||||||||||||||||||||||||
1180 | { | - | ||||||||||||||||||||||||
1181 | if (!socket->d_func()->plainSocket
| 0-118 | ||||||||||||||||||||||||
1182 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1183 | QAbstractSocketPrivate::resumeSocketNotifiers(socket->d_func()->plainSocket); | - | ||||||||||||||||||||||||
1184 | } executed 118 times by 3 tests: end of block Executed by:
| 118 | ||||||||||||||||||||||||
1185 | - | |||||||||||||||||||||||||
1186 | bool QSslSocketPrivate::isPaused() const | - | ||||||||||||||||||||||||
1187 | { | - | ||||||||||||||||||||||||
1188 | return never executed: paused;return paused; never executed: return paused; | 0 | ||||||||||||||||||||||||
1189 | } | - | ||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||
1191 | bool QSslSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode) | - | ||||||||||||||||||||||||
1192 | { | - | ||||||||||||||||||||||||
1193 | - | |||||||||||||||||||||||||
1194 | if (!initialized
| 0-15 | ||||||||||||||||||||||||
1195 | init(); executed 15 times by 1 test: init(); Executed by:
| 15 | ||||||||||||||||||||||||
1196 | initialized = false; | - | ||||||||||||||||||||||||
1197 | - | |||||||||||||||||||||||||
1198 | - | |||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||
1201 | if (!plainSocket
| 0-15 | ||||||||||||||||||||||||
1202 | - | |||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||
1205 | createPlainSocket(QIODevice::ReadWrite); | - | ||||||||||||||||||||||||
1206 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||
1207 | bool ret = plainSocket->bind(address, port, mode); | - | ||||||||||||||||||||||||
1208 | localPort = plainSocket->localPort(); | - | ||||||||||||||||||||||||
1209 | localAddress = plainSocket->localAddress(); | - | ||||||||||||||||||||||||
1210 | cachedSocketDescriptor = plainSocket->socketDescriptor(); | - | ||||||||||||||||||||||||
1211 | return executed 15 times by 1 test: ret;return ret; Executed by:
executed 15 times by 1 test: return ret; Executed by:
| 15 | ||||||||||||||||||||||||
1212 | } | - | ||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||
1216 | - | |||||||||||||||||||||||||
1217 | void QSslSocketPrivate::_q_connectedSlot() | - | ||||||||||||||||||||||||
1218 | { | - | ||||||||||||||||||||||||
1219 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1220 | q->setLocalPort(plainSocket->localPort()); | - | ||||||||||||||||||||||||
1221 | q->setLocalAddress(plainSocket->localAddress()); | - | ||||||||||||||||||||||||
1222 | q->setPeerPort(plainSocket->peerPort()); | - | ||||||||||||||||||||||||
1223 | q->setPeerAddress(plainSocket->peerAddress()); | - | ||||||||||||||||||||||||
1224 | q->setPeerName(plainSocket->peerName()); | - | ||||||||||||||||||||||||
1225 | cachedSocketDescriptor = plainSocket->socketDescriptor(); | - | ||||||||||||||||||||||||
1226 | if (autoStartHandshake
| 265-373 | ||||||||||||||||||||||||
1227 | q->startClientEncryption(); executed 373 times by 6 tests: q->startClientEncryption(); Executed by:
| 373 | ||||||||||||||||||||||||
1228 | - | |||||||||||||||||||||||||
1229 | q->connected(); | - | ||||||||||||||||||||||||
1230 | - | |||||||||||||||||||||||||
1231 | if (pendingClose
| 0-629 | ||||||||||||||||||||||||
1232 | pendingClose = false; | - | ||||||||||||||||||||||||
1233 | q->disconnectFromHost(); | - | ||||||||||||||||||||||||
1234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1235 | } executed 638 times by 8 tests: end of block Executed by:
| 638 | ||||||||||||||||||||||||
1236 | - | |||||||||||||||||||||||||
1237 | - | |||||||||||||||||||||||||
1238 | - | |||||||||||||||||||||||||
1239 | - | |||||||||||||||||||||||||
1240 | void QSslSocketPrivate::_q_hostFoundSlot() | - | ||||||||||||||||||||||||
1241 | { | - | ||||||||||||||||||||||||
1242 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1243 | - | |||||||||||||||||||||||||
1244 | - | |||||||||||||||||||||||||
1245 | - | |||||||||||||||||||||||||
1246 | - | |||||||||||||||||||||||||
1247 | q->hostFound(); | - | ||||||||||||||||||||||||
1248 | } executed 360 times by 8 tests: end of block Executed by:
| 360 | ||||||||||||||||||||||||
1249 | - | |||||||||||||||||||||||||
1250 | - | |||||||||||||||||||||||||
1251 | - | |||||||||||||||||||||||||
1252 | - | |||||||||||||||||||||||||
1253 | void QSslSocketPrivate::_q_disconnectedSlot() | - | ||||||||||||||||||||||||
1254 | { | - | ||||||||||||||||||||||||
1255 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||
1257 | - | |||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||
1260 | disconnected(); | - | ||||||||||||||||||||||||
1261 | q->disconnected(); | - | ||||||||||||||||||||||||
1262 | } executed 700 times by 9 tests: end of block Executed by:
| 700 | ||||||||||||||||||||||||
1263 | - | |||||||||||||||||||||||||
1264 | - | |||||||||||||||||||||||||
1265 | - | |||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||
1267 | void QSslSocketPrivate::_q_stateChangedSlot(QAbstractSocket::SocketState state) | - | ||||||||||||||||||||||||
1268 | { | - | ||||||||||||||||||||||||
1269 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1270 | - | |||||||||||||||||||||||||
1271 | - | |||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||
1273 | q->setSocketState(state); | - | ||||||||||||||||||||||||
1274 | q->stateChanged(state); | - | ||||||||||||||||||||||||
1275 | } executed 3304 times by 9 tests: end of block Executed by:
| 3304 | ||||||||||||||||||||||||
1276 | - | |||||||||||||||||||||||||
1277 | - | |||||||||||||||||||||||||
1278 | - | |||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||
1280 | void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error) | - | ||||||||||||||||||||||||
1281 | { | - | ||||||||||||||||||||||||
1282 | (void)error; | - | ||||||||||||||||||||||||
1283 | - | |||||||||||||||||||||||||
1284 | - | |||||||||||||||||||||||||
1285 | - | |||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||
1287 | - | |||||||||||||||||||||||||
1288 | - | |||||||||||||||||||||||||
1289 | - | |||||||||||||||||||||||||
1290 | if (plainSocket->bytesAvailable()
| 22-200 | ||||||||||||||||||||||||
1291 | qint64 tmpReadBufferMaxSize = readBufferMaxSize; | - | ||||||||||||||||||||||||
1292 | readBufferMaxSize = 0; | - | ||||||||||||||||||||||||
1293 | transmit(); | - | ||||||||||||||||||||||||
1294 | readBufferMaxSize = tmpReadBufferMaxSize; | - | ||||||||||||||||||||||||
1295 | } executed 22 times by 3 tests: end of block Executed by:
| 22 | ||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||
1297 | setErrorAndEmit(plainSocket->error(), plainSocket->errorString()); | - | ||||||||||||||||||||||||
1298 | } executed 222 times by 7 tests: end of block Executed by:
| 222 | ||||||||||||||||||||||||
1299 | - | |||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||
1301 | - | |||||||||||||||||||||||||
1302 | - | |||||||||||||||||||||||||
1303 | void QSslSocketPrivate::_q_readyReadSlot() | - | ||||||||||||||||||||||||
1304 | { | - | ||||||||||||||||||||||||
1305 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | - | |||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||
1309 | if (mode == QSslSocket::UnencryptedMode
| 2374-2902 | ||||||||||||||||||||||||
1310 | if (readyReadEmittedPointer
| 0-2374 | ||||||||||||||||||||||||
1311 | * never executed: readyReadEmittedPointer = true;*readyReadEmittedPointer = true; never executed: *readyReadEmittedPointer = true; | 0 | ||||||||||||||||||||||||
1312 | q->readyRead(); | - | ||||||||||||||||||||||||
1313 | return; executed 2374 times by 3 tests: return; Executed by:
| 2374 | ||||||||||||||||||||||||
1314 | } | - | ||||||||||||||||||||||||
1315 | - | |||||||||||||||||||||||||
1316 | transmit(); | - | ||||||||||||||||||||||||
1317 | } executed 2902 times by 7 tests: end of block Executed by:
| 2902 | ||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | - | |||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||
1322 | void QSslSocketPrivate::_q_bytesWrittenSlot(qint64 written) | - | ||||||||||||||||||||||||
1323 | { | - | ||||||||||||||||||||||||
1324 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1325 | - | |||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||
1327 | - | |||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||
1329 | if (mode == QSslSocket::UnencryptedMode
| 266-5177 | ||||||||||||||||||||||||
1330 | q->bytesWritten(written); executed 266 times by 3 tests: q->bytesWritten(written); Executed by:
| 266 | ||||||||||||||||||||||||
1331 | else | - | ||||||||||||||||||||||||
1332 | q->encryptedBytesWritten(written); executed 5177 times by 7 tests: q->encryptedBytesWritten(written); Executed by:
| 5177 | ||||||||||||||||||||||||
1333 | if (state == QAbstractSocket::ClosingState
| 0-5373 | ||||||||||||||||||||||||
1334 | q->disconnectFromHost(); executed 70 times by 2 tests: q->disconnectFromHost(); Executed by:
| 70 | ||||||||||||||||||||||||
1335 | } executed 5443 times by 8 tests: end of block Executed by:
| 5443 | ||||||||||||||||||||||||
1336 | - | |||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||
1339 | - | |||||||||||||||||||||||||
1340 | void QSslSocketPrivate::_q_flushWriteBuffer() | - | ||||||||||||||||||||||||
1341 | { | - | ||||||||||||||||||||||||
1342 | QSslSocket * const q = q_func(); | - | ||||||||||||||||||||||||
1343 | if (!writeBuffer.isEmpty()
| 1199-1815 | ||||||||||||||||||||||||
1344 | q->flush(); executed 1815 times by 3 tests: q->flush(); Executed by:
| 1815 | ||||||||||||||||||||||||
1345 | } executed 3014 times by 4 tests: end of block Executed by:
| 3014 | ||||||||||||||||||||||||
1346 | - | |||||||||||||||||||||||||
1347 | - | |||||||||||||||||||||||||
1348 | - | |||||||||||||||||||||||||
1349 | - | |||||||||||||||||||||||||
1350 | void QSslSocketPrivate::_q_flushReadBuffer() | - | ||||||||||||||||||||||||
1351 | { | - | ||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||
1353 | if (mode != QSslSocket::UnencryptedMode
| 0-1 | ||||||||||||||||||||||||
1354 | transmit(); executed 1 time by 1 test: transmit(); Executed by:
| 1 | ||||||||||||||||||||||||
1355 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
1356 | - | |||||||||||||||||||||||||
1357 | - | |||||||||||||||||||||||||
1358 | - | |||||||||||||||||||||||||
1359 | - | |||||||||||||||||||||||||
1360 | void QSslSocketPrivate::_q_resumeImplementation() | - | ||||||||||||||||||||||||
1361 | { | - | ||||||||||||||||||||||||
1362 | if (plainSocket
| 0-20 | ||||||||||||||||||||||||
1363 | plainSocket->resume(); executed 20 times by 1 test: plainSocket->resume(); Executed by:
| 20 | ||||||||||||||||||||||||
1364 | paused = false; | - | ||||||||||||||||||||||||
1365 | if (!connectionEncrypted
| 0-20 | ||||||||||||||||||||||||
1366 | if (verifyErrorsHaveBeenIgnored()
| 10 | ||||||||||||||||||||||||
1367 | continueHandshake(); | - | ||||||||||||||||||||||||
1368 | } executed 10 times by 1 test: else {end of block Executed by:
| 10 | ||||||||||||||||||||||||
1369 | setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, sslErrors.first().errorString()); | - | ||||||||||||||||||||||||
1370 | plainSocket->disconnectFromHost(); | - | ||||||||||||||||||||||||
1371 | return; executed 10 times by 1 test: return; Executed by:
| 10 | ||||||||||||||||||||||||
1372 | } | - | ||||||||||||||||||||||||
1373 | } | - | ||||||||||||||||||||||||
1374 | transmit(); | - | ||||||||||||||||||||||||
1375 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||
1376 | - | |||||||||||||||||||||||||
1377 | - | |||||||||||||||||||||||||
1378 | - | |||||||||||||||||||||||||
1379 | - | |||||||||||||||||||||||||
1380 | bool QSslSocketPrivate::verifyErrorsHaveBeenIgnored() | - | ||||||||||||||||||||||||
1381 | { | - | ||||||||||||||||||||||||
1382 | bool doEmitSslError; | - | ||||||||||||||||||||||||
1383 | if (!ignoreErrorsList.empty()
| 43-222 | ||||||||||||||||||||||||
1384 | - | |||||||||||||||||||||||||
1385 | - | |||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||
1387 | doEmitSslError = false; | - | ||||||||||||||||||||||||
1388 | for (int a = 0; a < sslErrors.count()
| 27-43 | ||||||||||||||||||||||||
1389 | if (!ignoreErrorsList.contains(sslErrors.at(a))
| 16-27 | ||||||||||||||||||||||||
1390 | doEmitSslError = true; | - | ||||||||||||||||||||||||
1391 | break; executed 16 times by 2 tests: break; Executed by:
| 16 | ||||||||||||||||||||||||
1392 | } | - | ||||||||||||||||||||||||
1393 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||||||||
1394 | } executed 43 times by 2 tests: else {end of block Executed by:
| 43 | ||||||||||||||||||||||||
1395 | - | |||||||||||||||||||||||||
1396 | - | |||||||||||||||||||||||||
1397 | - | |||||||||||||||||||||||||
1398 | doEmitSslError = !ignoreAllSslErrors; | - | ||||||||||||||||||||||||
1399 | } executed 222 times by 7 tests: end of block Executed by:
| 222 | ||||||||||||||||||||||||
1400 | return executed 265 times by 7 tests: !doEmitSslError;return !doEmitSslError; Executed by:
executed 265 times by 7 tests: return !doEmitSslError; Executed by:
| 265 | ||||||||||||||||||||||||
1401 | } | - | ||||||||||||||||||||||||
1402 | - | |||||||||||||||||||||||||
1403 | - | |||||||||||||||||||||||||
1404 | - | |||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||
1406 | qint64 QSslSocketPrivate::peek(char *data, qint64 maxSize) | - | ||||||||||||||||||||||||
1407 | { | - | ||||||||||||||||||||||||
1408 | if (mode == QSslSocket::UnencryptedMode
| 0-112 | ||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||
1410 | - | |||||||||||||||||||||||||
1411 | qint64 r = buffer.peek(data, maxSize); | - | ||||||||||||||||||||||||
1412 | if (r == maxSize
| 5-107 | ||||||||||||||||||||||||
1413 | return executed 107 times by 2 tests: r;return r; Executed by:
executed 107 times by 2 tests: return r; Executed by:
| 107 | ||||||||||||||||||||||||
1414 | data += r; | - | ||||||||||||||||||||||||
1415 | - | |||||||||||||||||||||||||
1416 | if (plainSocket
| 0-5 | ||||||||||||||||||||||||
1417 | qint64 r2 = plainSocket->peek(data, maxSize - r); | - | ||||||||||||||||||||||||
1418 | if (r2 < 0
| 0-5 | ||||||||||||||||||||||||
1419 | return never executed: (r > 0return (r > 0 ? r : r2);
never executed: return (r > 0 ? r : r2); | 0 | ||||||||||||||||||||||||
1420 | return executed 5 times by 2 tests: r + r2;return r + r2; Executed by:
executed 5 times by 2 tests: return r + r2; Executed by:
| 5 | ||||||||||||||||||||||||
1421 | } else { | - | ||||||||||||||||||||||||
1422 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1423 | } | - | ||||||||||||||||||||||||
1424 | } else { | - | ||||||||||||||||||||||||
1425 | - | |||||||||||||||||||||||||
1426 | return executed 95 times by 4 tests: QTcpSocketPrivate::peek(data, maxSize);return QTcpSocketPrivate::peek(data, maxSize); Executed by:
executed 95 times by 4 tests: return QTcpSocketPrivate::peek(data, maxSize); Executed by:
| 95 | ||||||||||||||||||||||||
1427 | } | - | ||||||||||||||||||||||||
1428 | } | - | ||||||||||||||||||||||||
1429 | - | |||||||||||||||||||||||||
1430 | - | |||||||||||||||||||||||||
1431 | - | |||||||||||||||||||||||||
1432 | - | |||||||||||||||||||||||||
1433 | QByteArray QSslSocketPrivate::peek(qint64 maxSize) | - | ||||||||||||||||||||||||
1434 | { | - | ||||||||||||||||||||||||
1435 | if (mode == QSslSocket::UnencryptedMode
| 0-10 | ||||||||||||||||||||||||
1436 | - | |||||||||||||||||||||||||
1437 | - | |||||||||||||||||||||||||
1438 | QByteArray ret; | - | ||||||||||||||||||||||||
1439 | ret.reserve(maxSize); | - | ||||||||||||||||||||||||
1440 | ret.resize(buffer.peek(ret.data(), maxSize)); | - | ||||||||||||||||||||||||
1441 | if (ret.length() == maxSize
| 1-9 | ||||||||||||||||||||||||
1442 | return executed 1 time by 1 test: ret;return ret; Executed by:
executed 1 time by 1 test: return ret; Executed by:
| 1 | ||||||||||||||||||||||||
1443 | - | |||||||||||||||||||||||||
1444 | if (plainSocket
| 4-5 | ||||||||||||||||||||||||
1445 | return executed 4 times by 1 test: ret + plainSocket->peek(maxSize - ret.length());return ret + plainSocket->peek(maxSize - ret.length()); Executed by:
executed 4 times by 1 test: return ret + plainSocket->peek(maxSize - ret.length()); Executed by:
| 4 | ||||||||||||||||||||||||
1446 | else | - | ||||||||||||||||||||||||
1447 | return executed 5 times by 1 test: QByteArray();return QByteArray(); Executed by:
executed 5 times by 1 test: return QByteArray(); Executed by:
| 5 | ||||||||||||||||||||||||
1448 | } else { | - | ||||||||||||||||||||||||
1449 | - | |||||||||||||||||||||||||
1450 | return executed 2 times by 1 test: QTcpSocketPrivate::peek(maxSize);return QTcpSocketPrivate::peek(maxSize); Executed by:
executed 2 times by 1 test: return QTcpSocketPrivate::peek(maxSize); Executed by:
| 2 | ||||||||||||||||||||||||
1451 | } | - | ||||||||||||||||||||||||
1452 | } | - | ||||||||||||||||||||||||
1453 | - | |||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||
1455 | - | |||||||||||||||||||||||||
1456 | - | |||||||||||||||||||||||||
1457 | bool QSslSocketPrivate::rootCertOnDemandLoadingSupported() | - | ||||||||||||||||||||||||
1458 | { | - | ||||||||||||||||||||||||
1459 | return executed 3 times by 1 test: s_loadRootCertsOnDemand;return s_loadRootCertsOnDemand; Executed by:
executed 3 times by 1 test: return s_loadRootCertsOnDemand; Executed by:
| 3 | ||||||||||||||||||||||||
1460 | } | - | ||||||||||||||||||||||||
1461 | - | |||||||||||||||||||||||||
1462 | - | |||||||||||||||||||||||||
1463 | - | |||||||||||||||||||||||||
1464 | - | |||||||||||||||||||||||||
1465 | QList<QByteArray> QSslSocketPrivate::unixRootCertDirectories() | - | ||||||||||||||||||||||||
1466 | { | - | ||||||||||||||||||||||||
1467 | return executed 132 times by 16 tests: QList<QByteArray>() << "/etc/ssl/certs/"return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1468 | << "/usr/lib/ssl/certs/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1469 | << "/usr/share/ssl/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1470 | << "/usr/local/ssl/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1471 | << "/var/ssl/certs/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1472 | << "/usr/local/ssl/certs/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1473 | << "/etc/openssl/certs/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1474 | << "/opt/openssl/certs/" executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1475 | << "/etc/ssl/"; executed 132 times by 16 tests: return QList<QByteArray>() << "/etc/ssl/certs/" << "/usr/lib/ssl/certs/" << "/usr/share/ssl/" << "/usr/local/ssl/" << "/var/ssl/certs/" << "/usr/local/ssl/certs/" << "/etc/openssl/certs/" << "/opt/openssl/certs/" << "/etc/ssl/"; Executed by:
| 132 | ||||||||||||||||||||||||
1476 | } | - | ||||||||||||||||||||||||
1477 | - | |||||||||||||||||||||||||
1478 | - | |||||||||||||||||||||||||
1479 | - | |||||||||||||||||||||||||
1480 | - | |||||||||||||||||||||||||
1481 | void QSslSocketPrivate::checkSettingSslContext(QSslSocket* socket, QSharedPointer<QSslContext> sslContext) | - | ||||||||||||||||||||||||
1482 | { | - | ||||||||||||||||||||||||
1483 | if (socket->d_func()->sslContextPointer.isNull()
| 0-25 | ||||||||||||||||||||||||
1484 | socket->d_func()->sslContextPointer = sslContext; executed 25 times by 1 test: socket->d_func()->sslContextPointer = sslContext; Executed by:
| 25 | ||||||||||||||||||||||||
1485 | } executed 25 times by 1 test: end of block Executed by:
| 25 | ||||||||||||||||||||||||
1486 | - | |||||||||||||||||||||||||
1487 | - | |||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||
1490 | QSharedPointer<QSslContext> QSslSocketPrivate::sslContext(QSslSocket *socket) | - | ||||||||||||||||||||||||
1491 | { | - | ||||||||||||||||||||||||
1492 | return executed 95 times by 3 tests: (return (socket) ? socket->d_func()->sslContextPointer : QSharedPointer<QSslContext>(); Executed by:
executed 95 times by 3 tests: return (socket) ? socket->d_func()->sslContextPointer : QSharedPointer<QSslContext>(); Executed by:
| 0-95 | ||||||||||||||||||||||||
1493 | } | - | ||||||||||||||||||||||||
1494 | - | |||||||||||||||||||||||||
1495 | bool QSslSocketPrivate::isMatchingHostname(const QSslCertificate &cert, const QString &peerName) | - | ||||||||||||||||||||||||
1496 | { | - | ||||||||||||||||||||||||
1497 | QStringList commonNameList = cert.subjectInfo(QSslCertificate::CommonName); | - | ||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||
1499 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(commonNameList)>::type> _container_((commonNameList)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &commonName = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
1500 | if (isMatchingHostname(commonName.toLower(), peerName.toLower())
| 61-322 | ||||||||||||||||||||||||
1501 | return executed 322 times by 8 tests: true;return true; Executed by:
executed 322 times by 8 tests: return true; Executed by:
| 322 | ||||||||||||||||||||||||
1502 | } | - | ||||||||||||||||||||||||
1503 | } executed 61 times by 3 tests: end of block Executed by:
| 61 | ||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||
1505 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cert.subjectAlternativeNames().values(QSsl::DnsEntry))>::type> _container_((cert.subjectAlternativeNames().values(QSsl::DnsEntry))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &altName = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
1506 | if (isMatchingHostname(altName.toLower(), peerName.toLower())
| 0 | ||||||||||||||||||||||||
1507 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1508 | } | - | ||||||||||||||||||||||||
1509 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1510 | - | |||||||||||||||||||||||||
1511 | return executed 61 times by 3 tests: false;return false; Executed by:
executed 61 times by 3 tests: return false; Executed by:
| 61 | ||||||||||||||||||||||||
1512 | } | - | ||||||||||||||||||||||||
1513 | - | |||||||||||||||||||||||||
1514 | bool QSslSocketPrivate::isMatchingHostname(const QString &cn, const QString &hostname) | - | ||||||||||||||||||||||||
1515 | { | - | ||||||||||||||||||||||||
1516 | int wildcard = cn.indexOf(QLatin1Char('*')); | - | ||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||
1519 | if (wildcard < 0
| 65-403 | ||||||||||||||||||||||||
1520 | return executed 403 times by 8 tests: cn == hostname;return cn == hostname; Executed by:
executed 403 times by 8 tests: return cn == hostname; Executed by:
| 403 | ||||||||||||||||||||||||
1521 | - | |||||||||||||||||||||||||
1522 | int firstCnDot = cn.indexOf(QLatin1Char('.')); | - | ||||||||||||||||||||||||
1523 | int secondCnDot = cn.indexOf(QLatin1Char('.'), firstCnDot+1); | - | ||||||||||||||||||||||||
1524 | - | |||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||
1526 | if ((-
| 10-45 | ||||||||||||||||||||||||
1527 | return executed 30 times by 1 test: false;return false; Executed by:
executed 30 times by 1 test: return false; Executed by:
| 30 | ||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||
1530 | if (wildcard+1 != firstCnDot
| 0-35 | ||||||||||||||||||||||||
1531 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1532 | - | |||||||||||||||||||||||||
1533 | - | |||||||||||||||||||||||||
1534 | if (cn.lastIndexOf(QLatin1Char('*')) != wildcard
| 5-30 | ||||||||||||||||||||||||
1535 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
1536 | - | |||||||||||||||||||||||||
1537 | - | |||||||||||||||||||||||||
1538 | if (wildcard
| 5-15 | ||||||||||||||||||||||||
1539 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
1540 | - | |||||||||||||||||||||||||
1541 | - | |||||||||||||||||||||||||
1542 | if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot)
| 5-20 | ||||||||||||||||||||||||
1543 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||
1545 | - | |||||||||||||||||||||||||
1546 | QHostAddress addr(hostname); | - | ||||||||||||||||||||||||
1547 | if (!addr.isNull()
| 5-15 | ||||||||||||||||||||||||
1548 | return executed 5 times by 1 test: false;return false; Executed by:
executed 5 times by 1 test: return false; Executed by:
| 5 | ||||||||||||||||||||||||
1549 | - | |||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||
1551 | return executed 15 times by 1 test: true;return true; Executed by:
executed 15 times by 1 test: return true; Executed by:
| 15 | ||||||||||||||||||||||||
1552 | } | - | ||||||||||||||||||||||||
1553 | - | |||||||||||||||||||||||||
1554 | - | |||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |