Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() | - |
16 | : socket(0) | - |
17 | , ssl(false) | - |
18 | , isInitialized(false) | - |
19 | , state(IdleState) | - |
20 | , reply(0) | - |
21 | , written(0) | - |
22 | , bytesTotal(0) | - |
23 | , resendCurrent(false) | - |
24 | , lastStatus(0) | - |
25 | , pendingEncrypt(false) | - |
26 | , reconnectAttempts(2) | - |
27 | , authMethod(QAuthenticatorPrivate::None) | - |
28 | , proxyAuthMethod(QAuthenticatorPrivate::None) | - |
29 | , authenticationCredentialsSent(false) | - |
30 | , proxyCredentialsSent(false) | - |
31 | | - |
32 | , ignoreAllSslErrors(false) | - |
33 | | - |
34 | , pipeliningSupported(PipeliningSupportUnknown) | - |
35 | , networkLayerPreference(QAbstractSocket::AnyIPProtocol) | - |
36 | , connection(0) | - |
37 | { | - |
38 | | - |
39 | | - |
40 | } executed: } Execution Count:3042 | 3042 |
41 | | - |
42 | void QHttpNetworkConnectionChannel::init() | - |
43 | { | - |
44 | | - |
45 | if (connection->d_func()->encrypt) evaluated: connection->d_func()->encrypt yes Evaluation Count:72 | yes Evaluation Count:459 |
| 72-459 |
46 | socket = new QSslSocket; executed: socket = new QSslSocket; Execution Count:72 | 72 |
47 | else | - |
48 | socket = new QTcpSocket; executed: socket = new QTcpSocket; Execution Count:459 | 459 |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | if (networkSession) evaluated: networkSession yes Evaluation Count:3 | yes Evaluation Count:528 |
| 3-528 |
55 | socket->setProperty("_q_networksession", QVariant::fromValue(networkSession)); executed: socket->setProperty("_q_networksession", QVariant::fromValue(networkSession)); Execution Count:3 | 3 |
56 | | - |
57 | | - |
58 | | - |
59 | socket->setProxy(QNetworkProxy::NoProxy); | - |
60 | | - |
61 | | - |
62 | QObject::connect(socket, "2""bytesWritten(qint64)", | - |
63 | this, "1""_q_bytesWritten(qint64)", | - |
64 | Qt::DirectConnection); | - |
65 | QObject::connect(socket, "2""connected()", | - |
66 | this, "1""_q_connected()", | - |
67 | Qt::DirectConnection); | - |
68 | QObject::connect(socket, "2""readyRead()", | - |
69 | this, "1""_q_readyRead()", | - |
70 | Qt::DirectConnection); | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | qRegisterMetaType<QAbstractSocket::SocketError>(); | - |
79 | QObject::connect(socket, "2""disconnected()", | - |
80 | this, "1""_q_disconnected()", | - |
81 | Qt::QueuedConnection); | - |
82 | QObject::connect(socket, "2""error(QAbstractSocket::SocketError)", | - |
83 | this, "1""_q_error(QAbstractSocket::SocketError)", | - |
84 | Qt::QueuedConnection); | - |
85 | | - |
86 | | - |
87 | | - |
88 | QObject::connect(socket, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
89 | this, "1""_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
90 | Qt::DirectConnection); | - |
91 | | - |
92 | | - |
93 | | - |
94 | QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); | - |
95 | if (sslSocket) { evaluated: sslSocket yes Evaluation Count:72 | yes Evaluation Count:459 |
| 72-459 |
96 | | - |
97 | QObject::connect(sslSocket, "2""encrypted()", | - |
98 | this, "1""_q_encrypted()", | - |
99 | Qt::DirectConnection); | - |
100 | QObject::connect(sslSocket, "2""sslErrors(QList<QSslError>)", | - |
101 | this, "1""_q_sslErrors(QList<QSslError>)", | - |
102 | Qt::DirectConnection); | - |
103 | QObject::connect(sslSocket, "2""encryptedBytesWritten(qint64)", | - |
104 | this, "1""_q_encryptedBytesWritten(qint64)", | - |
105 | Qt::DirectConnection); | - |
106 | | - |
107 | if (ignoreAllSslErrors) partially evaluated: ignoreAllSslErrors no Evaluation Count:0 | yes Evaluation Count:72 |
| 0-72 |
108 | sslSocket->ignoreSslErrors(); never executed: sslSocket->ignoreSslErrors(); | 0 |
109 | | - |
110 | if (!ignoreSslErrorsList.isEmpty()) partially evaluated: !ignoreSslErrorsList.isEmpty() no Evaluation Count:0 | yes Evaluation Count:72 |
| 0-72 |
111 | sslSocket->ignoreSslErrors(ignoreSslErrorsList); never executed: sslSocket->ignoreSslErrors(ignoreSslErrorsList); | 0 |
112 | | - |
113 | if (!sslConfiguration.isNull()) evaluated: !sslConfiguration.isNull() yes Evaluation Count:42 | yes Evaluation Count:30 |
| 30-42 |
114 | sslSocket->setSslConfiguration(sslConfiguration); executed: sslSocket->setSslConfiguration(sslConfiguration); Execution Count:42 | 42 |
115 | } executed: } Execution Count:72 | 72 |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | if (proxy.type() != QNetworkProxy::NoProxy) evaluated: proxy.type() != QNetworkProxy::NoProxy yes Evaluation Count:49 | yes Evaluation Count:482 |
| 49-482 |
121 | socket->setProxy(proxy); executed: socket->setProxy(proxy); Execution Count:49 | 49 |
122 | | - |
123 | isInitialized = true; | - |
124 | } executed: } Execution Count:531 | 531 |
125 | | - |
126 | | - |
127 | void QHttpNetworkConnectionChannel::close() | - |
128 | { | - |
129 | if (!socket) evaluated: !socket yes Evaluation Count:1 | yes Evaluation Count:332 |
| 1-332 |
130 | state = QHttpNetworkConnectionChannel::IdleState; executed: state = QHttpNetworkConnectionChannel::IdleState; Execution Count:1 | 1 |
131 | else if (socket->state() == QAbstractSocket::UnconnectedState) evaluated: socket->state() == QAbstractSocket::UnconnectedState yes Evaluation Count:132 | yes Evaluation Count:200 |
| 132-200 |
132 | state = QHttpNetworkConnectionChannel::IdleState; executed: state = QHttpNetworkConnectionChannel::IdleState; Execution Count:132 | 132 |
133 | else | - |
134 | state = QHttpNetworkConnectionChannel::ClosingState; executed: state = QHttpNetworkConnectionChannel::ClosingState; Execution Count:200 | 200 |
135 | | - |
136 | if (socket) evaluated: socket yes Evaluation Count:332 | yes Evaluation Count:1 |
| 1-332 |
137 | socket->close(); executed: socket->close(); Execution Count:332 | 332 |
138 | } executed: } Execution Count:333 | 333 |
139 | | - |
140 | | - |
141 | bool QHttpNetworkConnectionChannel::sendRequest() | - |
142 | { | - |
143 | if (!reply) { partially evaluated: !reply no Evaluation Count:0 | yes Evaluation Count:6812 |
| 0-6812 |
144 | | - |
145 | QMessageLogger("access/qhttpnetworkconnectionchannel.cpp", 195, __PRETTY_FUNCTION__).warning() << "QHttpNetworkConnectionChannel::sendRequest() called without QHttpNetworkReply"; | - |
146 | state = QHttpNetworkConnectionChannel::IdleState; | - |
147 | return false; never executed: return false; | 0 |
148 | } | - |
149 | | - |
150 | switch (state) { | - |
151 | case QHttpNetworkConnectionChannel::IdleState: { | - |
152 | if (!ensureConnection()) { evaluated: !ensureConnection() yes Evaluation Count:92 | yes Evaluation Count:849 |
| 92-849 |
153 | | - |
154 | | - |
155 | | - |
156 | return false; executed: return false; Execution Count:92 | 92 |
157 | } | - |
158 | written = 0; | - |
159 | bytesTotal = 0; | - |
160 | | - |
161 | QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); | - |
162 | replyPrivate->clear(); | - |
163 | replyPrivate->connection = connection; | - |
164 | replyPrivate->connectionChannel = this; | - |
165 | replyPrivate->autoDecompress = request.d->autoDecompress; | - |
166 | replyPrivate->pipeliningUsed = false; | - |
167 | | - |
168 | | - |
169 | | - |
170 | if (!request.url().userInfo().isEmpty() && request.withCredentials()) { evaluated: !request.url().userInfo().isEmpty() yes Evaluation Count:26 | yes Evaluation Count:823 |
partially evaluated: request.withCredentials() yes Evaluation Count:26 | no Evaluation Count:0 |
| 0-823 |
171 | QUrl url = request.url(); | - |
172 | QAuthenticator &auth = authenticator; | - |
173 | if (url.userName() != auth.user() evaluated: url.userName() != auth.user() yes Evaluation Count:16 | yes Evaluation Count:10 |
| 10-16 |
174 | || (!url.password().isEmpty() && url.password() != auth.password())) { partially evaluated: !url.password().isEmpty() yes Evaluation Count:10 | no Evaluation Count:0 |
evaluated: url.password() != auth.password() yes Evaluation Count:2 | yes Evaluation Count:8 |
| 0-10 |
175 | auth.setUser(url.userName()); | - |
176 | auth.setPassword(url.password()); | - |
177 | connection->d_func()->copyCredentials(connection->d_func()->indexOf(socket), &auth, false); | - |
178 | } executed: } Execution Count:18 | 18 |
179 | | - |
180 | | - |
181 | url.setUserInfo(QString()); | - |
182 | request.setUrl(url); | - |
183 | } executed: } Execution Count:26 | 26 |
184 | | - |
185 | | - |
186 | if (request.withCredentials()) evaluated: request.withCredentials() yes Evaluation Count:848 | yes Evaluation Count:1 |
| 1-848 |
187 | connection->d_func()->createAuthorization(socket, request); executed: connection->d_func()->createAuthorization(socket, request); Execution Count:848 | 848 |
188 | | - |
189 | QByteArray header = QHttpNetworkRequestPrivate::header(request, | - |
190 | (connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy)); | - |
191 | | - |
192 | | - |
193 | | - |
194 | socket->write(header); | - |
195 | | - |
196 | | - |
197 | QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); | - |
198 | if (uploadByteDevice) { evaluated: uploadByteDevice yes Evaluation Count:225 | yes Evaluation Count:624 |
| 225-624 |
199 | | - |
200 | QObject::connect(uploadByteDevice, "2""readyRead()",this, "1""_q_uploadDataReadyRead()"); | - |
201 | | - |
202 | bytesTotal = request.contentLength(); | - |
203 | | - |
204 | state = QHttpNetworkConnectionChannel::WritingState; | - |
205 | sendRequest(); | - |
206 | } else { executed: } Execution Count:225 | 225 |
207 | state = QHttpNetworkConnectionChannel::WaitingState; | - |
208 | sendRequest(); | - |
209 | } executed: } Execution Count:624 | 624 |
210 | | - |
211 | break; executed: break; Execution Count:849 | 849 |
212 | } | - |
213 | case QHttpNetworkConnectionChannel::WritingState: | - |
214 | { | - |
215 | | - |
216 | QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); | - |
217 | if (!uploadByteDevice || bytesTotal == written) { partially evaluated: !uploadByteDevice no Evaluation Count:0 | yes Evaluation Count:5023 |
evaluated: bytesTotal == written yes Evaluation Count:31 | yes Evaluation Count:4992 |
| 0-5023 |
218 | if (uploadByteDevice) partially evaluated: uploadByteDevice yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
219 | reply->dataSendProgress(written, bytesTotal); executed: reply->dataSendProgress(written, bytesTotal); Execution Count:31 | 31 |
220 | state = QHttpNetworkConnectionChannel::WaitingState; | - |
221 | sendRequest(); | - |
222 | break; executed: break; Execution Count:31 | 31 |
223 | } | - |
224 | | - |
225 | | - |
226 | const qint64 socketBufferFill = 32*1024; | - |
227 | const qint64 socketWriteMaxSize = 16*1024; | - |
228 | | - |
229 | | - |
230 | | - |
231 | QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); | - |
232 | | - |
233 | while ((socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0)) evaluated: sslSocket yes Evaluation Count:3758 | yes Evaluation Count:3633 |
| 1082-6309 |
234 | <= socketBufferFill && bytesTotal != written) evaluated: (socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0)) <= socketBufferFill yes Evaluation Count:6309 | yes Evaluation Count:1082 |
partially evaluated: bytesTotal != written yes Evaluation Count:6309 | no Evaluation Count:0 |
| 0-6309 |
235 | | - |
236 | | - |
237 | | - |
238 | | - |
239 | { | - |
240 | | - |
241 | qint64 currentReadSize = 0; | - |
242 | qint64 desiredReadSize = qMin(socketWriteMaxSize, bytesTotal - written); | - |
243 | const char *readPointer = uploadByteDevice->readPointer(desiredReadSize, currentReadSize); | - |
244 | | - |
245 | if (currentReadSize == -1) { partially evaluated: currentReadSize == -1 no Evaluation Count:0 | yes Evaluation Count:6309 |
| 0-6309 |
246 | | - |
247 | connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError); | - |
248 | return false; never executed: return false; | 0 |
249 | } else if (readPointer == 0 || currentReadSize == 0) { evaluated: readPointer == 0 yes Evaluation Count:3717 | yes Evaluation Count:2592 |
partially evaluated: currentReadSize == 0 no Evaluation Count:0 | yes Evaluation Count:2592 |
| 0-3717 |
250 | | - |
251 | break; executed: break; Execution Count:3717 | 3717 |
252 | } else { | - |
253 | qint64 currentWriteSize = socket->write(readPointer, currentReadSize); | - |
254 | if (currentWriteSize == -1 || currentWriteSize != currentReadSize) { partially evaluated: currentWriteSize == -1 no Evaluation Count:0 | yes Evaluation Count:2592 |
partially evaluated: currentWriteSize != currentReadSize no Evaluation Count:0 | yes Evaluation Count:2592 |
| 0-2592 |
255 | | - |
256 | connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError); | - |
257 | return false; never executed: return false; | 0 |
258 | } else { | - |
259 | written += currentWriteSize; | - |
260 | uploadByteDevice->advanceReadPointer(currentWriteSize); | - |
261 | | - |
262 | reply->dataSendProgress(written, bytesTotal); | - |
263 | | - |
264 | if (written == bytesTotal) { evaluated: written == bytesTotal yes Evaluation Count:193 | yes Evaluation Count:2399 |
| 193-2399 |
265 | | - |
266 | state = QHttpNetworkConnectionChannel::WaitingState; | - |
267 | sendRequest(); | - |
268 | break; executed: break; Execution Count:193 | 193 |
269 | } | - |
270 | } executed: } Execution Count:2399 | 2399 |
271 | } | - |
272 | } | - |
273 | break; executed: break; Execution Count:4992 | 4992 |
274 | } | - |
275 | | - |
276 | case QHttpNetworkConnectionChannel::WaitingState: | - |
277 | { | - |
278 | QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); | - |
279 | if (uploadByteDevice) { evaluated: uploadByteDevice yes Evaluation Count:224 | yes Evaluation Count:624 |
| 224-624 |
280 | QObject::disconnect(uploadByteDevice, "2""readyRead()", this, "1""_q_uploadDataReadyRead()"); | - |
281 | } executed: } Execution Count:224 | 224 |
282 | if (socket->bytesAvailable()) evaluated: socket->bytesAvailable() yes Evaluation Count:7 | yes Evaluation Count:841 |
| 7-841 |
283 | QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); Execution Count:7 | 7 |
284 | break; executed: break; Execution Count:848 | 848 |
285 | } | - |
286 | case QHttpNetworkConnectionChannel::ReadingState: | - |
287 | | - |
288 | | - |
289 | default: | - |
290 | break; | 0 |
291 | } | - |
292 | return true; executed: return true; Execution Count:6720 | 6720 |
293 | } | - |
294 | | - |
295 | | - |
296 | void QHttpNetworkConnectionChannel::_q_receiveReply() | - |
297 | { | - |
298 | qt_noop(); | - |
299 | | - |
300 | if (!reply) { partially evaluated: !reply no Evaluation Count:0 | yes Evaluation Count:10173 |
| 0-10173 |
301 | if (socket->bytesAvailable() > 0) never evaluated: socket->bytesAvailable() > 0 | 0 |
302 | QMessageLogger("access/qhttpnetworkconnectionchannel.cpp", 360, __PRETTY_FUNCTION__).warning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply," | 0 |
303 | << socket->bytesAvailable() << "bytes on socket."; never executed: QMessageLogger("access/qhttpnetworkconnectionchannel.cpp", 360, __PRETTY_FUNCTION__).warning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply," << socket->bytesAvailable() << "bytes on socket."; | 0 |
304 | close(); | - |
305 | return; | 0 |
306 | } | - |
307 | | - |
308 | | - |
309 | | - |
310 | | - |
311 | if (!qobject_cast<QHttpNetworkConnection*>(connection)) { partially evaluated: !qobject_cast<QHttpNetworkConnection*>(connection) no Evaluation Count:0 | yes Evaluation Count:10173 |
| 0-10173 |
312 | return; | 0 |
313 | } | - |
314 | | - |
315 | QAbstractSocket::SocketState socketState = socket->state(); | - |
316 | | - |
317 | | - |
318 | if (socketState == QAbstractSocket::UnconnectedState) { evaluated: socketState == QAbstractSocket::UnconnectedState yes Evaluation Count:18 | yes Evaluation Count:10155 |
| 18-10155 |
319 | if (socket->bytesAvailable() <= 0) { evaluated: socket->bytesAvailable() <= 0 yes Evaluation Count:17 | yes Evaluation Count:1 |
| 1-17 |
320 | if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { evaluated: reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState yes Evaluation Count:10 | yes Evaluation Count:7 |
| 7-10 |
321 | | - |
322 | reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; | - |
323 | allDone(); | - |
324 | return; executed: return; Execution Count:10 | 10 |
325 | } else { | - |
326 | handleUnexpectedEOF(); | - |
327 | return; executed: return; Execution Count:7 | 7 |
328 | } | - |
329 | } else { | - |
330 | | - |
331 | } executed: } Execution Count:1 | 1 |
332 | } | - |
333 | | - |
334 | | - |
335 | qint64 bytes = 0; | - |
336 | qint64 lastBytes = bytes; | - |
337 | do { | - |
338 | lastBytes = bytes; | - |
339 | | - |
340 | QHttpNetworkReplyPrivate::ReplyState state = reply->d_func()->state; | - |
341 | switch (state) { | - |
342 | case QHttpNetworkReplyPrivate::NothingDoneState: { | - |
343 | state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; | - |
344 | | - |
345 | } | - |
346 | case QHttpNetworkReplyPrivate::ReadingStatusState: { | - |
347 | qint64 statusBytes = reply->d_func()->readStatus(socket); | - |
348 | if (statusBytes == -1) { evaluated: statusBytes == -1 yes Evaluation Count:52 | yes Evaluation Count:844 |
| 52-844 |
349 | | - |
350 | handleUnexpectedEOF(); | - |
351 | return; executed: return; Execution Count:52 | 52 |
352 | } | - |
353 | bytes += statusBytes; | - |
354 | lastStatus = reply->d_func()->statusCode; | - |
355 | break; executed: break; Execution Count:844 | 844 |
356 | } | - |
357 | case QHttpNetworkReplyPrivate::ReadingHeaderState: { | - |
358 | QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); | - |
359 | qint64 headerBytes = replyPrivate->readHeader(socket); | - |
360 | if (headerBytes == -1) { evaluated: headerBytes == -1 yes Evaluation Count:5 | yes Evaluation Count:867 |
| 5-867 |
361 | | - |
362 | handleUnexpectedEOF(); | - |
363 | return; executed: return; Execution Count:5 | 5 |
364 | } | - |
365 | bytes += headerBytes; | - |
366 | | - |
367 | if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) { evaluated: replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState yes Evaluation Count:796 | yes Evaluation Count:71 |
| 71-796 |
368 | if (replyPrivate->isCompressed() && replyPrivate->autoDecompress) { evaluated: replyPrivate->isCompressed() yes Evaluation Count:10 | yes Evaluation Count:786 |
partially evaluated: replyPrivate->autoDecompress yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-786 |
369 | | - |
370 | replyPrivate->removeAutoDecompressHeader(); | - |
371 | } else { executed: } Execution Count:10 | 10 |
372 | replyPrivate->autoDecompress = false; | - |
373 | } executed: } Execution Count:786 | 786 |
374 | if (replyPrivate->statusCode == 100) { evaluated: replyPrivate->statusCode == 100 yes Evaluation Count:7 | yes Evaluation Count:789 |
| 7-789 |
375 | replyPrivate->clearHttpLayerInformation(); | - |
376 | replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; | - |
377 | break; executed: break; Execution Count:7 | 7 |
378 | } | - |
379 | if (replyPrivate->shouldEmitSignals()) evaluated: replyPrivate->shouldEmitSignals() yes Evaluation Count:604 | yes Evaluation Count:185 |
| 185-604 |
380 | reply->headerChanged(); executed: reply->headerChanged(); Execution Count:604 | 604 |
381 | | - |
382 | | - |
383 | | - |
384 | | - |
385 | if (!replyPrivate->expectContent()) { evaluated: !replyPrivate->expectContent() yes Evaluation Count:75 | yes Evaluation Count:714 |
| 75-714 |
386 | replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState; | - |
387 | allDone(); | - |
388 | break; executed: break; Execution Count:75 | 75 |
389 | } | - |
390 | } executed: } Execution Count:714 | 714 |
391 | break; executed: break; Execution Count:785 | 785 |
392 | } | - |
393 | case QHttpNetworkReplyPrivate::ReadingDataState: { | - |
394 | QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); | - |
395 | if (socket->state() == QAbstractSocket::ConnectedState && evaluated: socket->state() == QAbstractSocket::ConnectedState yes Evaluation Count:18886 | yes Evaluation Count:1 |
| 1-18886 |
396 | replyPrivate->downstreamLimited && !replyPrivate->responseData.isEmpty() && replyPrivate->shouldEmitSignals()) { evaluated: replyPrivate->downstreamLimited yes Evaluation Count:4380 | yes Evaluation Count:14506 |
evaluated: !replyPrivate->responseData.isEmpty() yes Evaluation Count:2068 | yes Evaluation Count:2312 |
partially evaluated: replyPrivate->shouldEmitSignals() yes Evaluation Count:2068 | no Evaluation Count:0 |
| 0-14506 |
397 | | - |
398 | | - |
399 | | - |
400 | | - |
401 | | - |
402 | | - |
403 | | - |
404 | return; executed: return; Execution Count:2068 | 2068 |
405 | } | - |
406 | | - |
407 | if (replyPrivate->userProvidedDownloadBuffer) { evaluated: replyPrivate->userProvidedDownloadBuffer yes Evaluation Count:5138 | yes Evaluation Count:11681 |
| 5138-11681 |
408 | | - |
409 | | - |
410 | | - |
411 | | - |
412 | qint64 haveRead = replyPrivate->readBodyVeryFast(socket, replyPrivate->userProvidedDownloadBuffer + replyPrivate->totalProgress); | - |
413 | if (haveRead > 0) { evaluated: haveRead > 0 yes Evaluation Count:3163 | yes Evaluation Count:1975 |
| 1975-3163 |
414 | bytes += haveRead; | - |
415 | replyPrivate->totalProgress += haveRead; | - |
416 | | - |
417 | reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - |
418 | } else if (haveRead == 0) { evaluated: haveRead == 0 yes Evaluation Count:1973 | yes Evaluation Count:2 |
executed: } Execution Count:3163 | 2-3163 |
419 | | - |
420 | } else if (haveRead < 0) { partially evaluated: haveRead < 0 yes Evaluation Count:2 | no Evaluation Count:0 |
executed: } Execution Count:1973 | 0-1973 |
421 | connection->d_func()->emitReplyError(socket, reply, QNetworkReply::RemoteHostClosedError); | - |
422 | break; executed: break; Execution Count:2 | 2 |
423 | } | - |
424 | } else if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress evaluated: !replyPrivate->isChunked() yes Evaluation Count:11308 | yes Evaluation Count:373 |
evaluated: !replyPrivate->autoDecompress yes Evaluation Count:11253 | yes Evaluation Count:55 |
| 55-11308 |
425 | && replyPrivate->bodyLength > 0) { evaluated: replyPrivate->bodyLength > 0 yes Evaluation Count:11240 | yes Evaluation Count:13 |
| 13-11240 |
426 | | - |
427 | | - |
428 | qint64 haveRead = replyPrivate->readBodyFast(socket, &replyPrivate->responseData); | - |
429 | bytes += haveRead; | - |
430 | replyPrivate->totalProgress += haveRead; | - |
431 | if (replyPrivate->shouldEmitSignals()) { evaluated: replyPrivate->shouldEmitSignals() yes Evaluation Count:11010 | yes Evaluation Count:230 |
| 230-11010 |
432 | reply->readyRead(); | - |
433 | reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - |
434 | } executed: } Execution Count:11010 | 11010 |
435 | } executed: } Execution Count:11240 | 11240 |
436 | else | - |
437 | { | - |
438 | | - |
439 | | - |
440 | qint64 haveRead = replyPrivate->readBody(socket, &replyPrivate->responseData); | - |
441 | if (haveRead > 0) { evaluated: haveRead > 0 yes Evaluation Count:276 | yes Evaluation Count:165 |
| 165-276 |
442 | bytes += haveRead; | - |
443 | replyPrivate->totalProgress += haveRead; | - |
444 | if (replyPrivate->shouldEmitSignals()) { evaluated: replyPrivate->shouldEmitSignals() yes Evaluation Count:272 | yes Evaluation Count:4 |
| 4-272 |
445 | reply->readyRead(); | - |
446 | reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - |
447 | } executed: } Execution Count:272 | 272 |
448 | } else if (haveRead == -1) { evaluated: haveRead == -1 yes Evaluation Count:1 | yes Evaluation Count:164 |
executed: } Execution Count:276 | 1-276 |
449 | | - |
450 | connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolFailure); | - |
451 | break; executed: break; Execution Count:1 | 1 |
452 | } | - |
453 | } | - |
454 | | - |
455 | if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) evaluated: replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState yes Evaluation Count:16117 | yes Evaluation Count:699 |
| 699-16117 |
456 | break; executed: break; Execution Count:16117 | 16117 |
457 | | - |
458 | | - |
459 | } | - |
460 | case QHttpNetworkReplyPrivate::AllDoneState: code before this statement executed: case QHttpNetworkReplyPrivate::AllDoneState: Execution Count:699 | 699 |
461 | allDone(); | - |
462 | break; executed: break; Execution Count:849 | 849 |
463 | default: | - |
464 | break; | 0 |
465 | } | - |
466 | } while (bytes != lastBytes && reply); evaluated: bytes != lastBytes yes Evaluation Count:11263 | yes Evaluation Count:7417 |
evaluated: reply yes Evaluation Count:10649 | yes Evaluation Count:614 |
executed: } Execution Count:18680 | 614-18680 |
467 | } executed: } Execution Count:8031 | 8031 |
468 | | - |
469 | | - |
470 | void QHttpNetworkConnectionChannel::handleUnexpectedEOF() | - |
471 | { | - |
472 | qt_noop(); | - |
473 | if (reconnectAttempts <= 0) { evaluated: reconnectAttempts <= 0 yes Evaluation Count:19 | yes Evaluation Count:45 |
| 19-45 |
474 | | - |
475 | requeueCurrentlyPipelinedRequests(); | - |
476 | close(); | - |
477 | reply->d_func()->errorString = connection->d_func()->errorDetail(QNetworkReply::RemoteHostClosedError, socket); | - |
478 | reply->finishedWithError(QNetworkReply::RemoteHostClosedError, reply->d_func()->errorString); | - |
479 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
480 | } else { executed: } Execution Count:19 | 19 |
481 | reconnectAttempts--; | - |
482 | reply->d_func()->clear(); | - |
483 | reply->d_func()->connection = connection; | - |
484 | reply->d_func()->connectionChannel = this; | - |
485 | closeAndResendCurrentRequest(); | - |
486 | } executed: } Execution Count:45 | 45 |
487 | } | - |
488 | | - |
489 | bool QHttpNetworkConnectionChannel::ensureConnection() | - |
490 | { | - |
491 | if (!isInitialized) evaluated: !isInitialized yes Evaluation Count:531 | yes Evaluation Count:972 |
| 531-972 |
492 | init(); executed: init(); Execution Count:531 | 531 |
493 | | - |
494 | QAbstractSocket::SocketState socketState = socket->state(); | - |
495 | | - |
496 | | - |
497 | if (socketState == QAbstractSocket::ClosingState) { partially evaluated: socketState == QAbstractSocket::ClosingState no Evaluation Count:0 | yes Evaluation Count:1503 |
| 0-1503 |
498 | if (reply) | 0 |
499 | resendCurrent = true; never executed: resendCurrent = true; | 0 |
500 | return false; never executed: return false; | 0 |
501 | } | - |
502 | | - |
503 | | - |
504 | if (socketState == QAbstractSocket::HostLookupState || partially evaluated: socketState == QAbstractSocket::HostLookupState no Evaluation Count:0 | yes Evaluation Count:1503 |
| 0-1503 |
505 | socketState == QAbstractSocket::ConnectingState) { partially evaluated: socketState == QAbstractSocket::ConnectingState no Evaluation Count:0 | yes Evaluation Count:1503 |
| 0-1503 |
506 | return false; never executed: return false; | 0 |
507 | } | - |
508 | | - |
509 | | - |
510 | | - |
511 | if (socketState != QAbstractSocket::ConnectedState) { evaluated: socketState != QAbstractSocket::ConnectedState yes Evaluation Count:654 | yes Evaluation Count:849 |
| 654-849 |
512 | | - |
513 | state = QHttpNetworkConnectionChannel::ConnectingState; | - |
514 | pendingEncrypt = ssl; | - |
515 | | - |
516 | | - |
517 | pipeliningSupported = PipeliningSupportUnknown; | - |
518 | authenticationCredentialsSent = false; | - |
519 | proxyCredentialsSent = false; | - |
520 | authenticator.detach(); | - |
521 | QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(authenticator); | - |
522 | priv->hasFailed = false; | - |
523 | proxyAuthenticator.detach(); | - |
524 | priv = QAuthenticatorPrivate::getPrivate(proxyAuthenticator); | - |
525 | priv->hasFailed = false; | - |
526 | | - |
527 | | - |
528 | | - |
529 | | - |
530 | | - |
531 | | - |
532 | | - |
533 | priv = QAuthenticatorPrivate::getPrivate(authenticator); | - |
534 | if (priv && priv->phase == QAuthenticatorPrivate::Done) partially evaluated: priv yes Evaluation Count:654 | no Evaluation Count:0 |
partially evaluated: priv->phase == QAuthenticatorPrivate::Done no Evaluation Count:0 | yes Evaluation Count:654 |
| 0-654 |
535 | priv->phase = QAuthenticatorPrivate::Start; never executed: priv->phase = QAuthenticatorPrivate::Start; | 0 |
536 | priv = QAuthenticatorPrivate::getPrivate(proxyAuthenticator); | - |
537 | if (priv && priv->phase == QAuthenticatorPrivate::Done) partially evaluated: priv yes Evaluation Count:654 | no Evaluation Count:0 |
partially evaluated: priv->phase == QAuthenticatorPrivate::Done no Evaluation Count:0 | yes Evaluation Count:654 |
| 0-654 |
538 | priv->phase = QAuthenticatorPrivate::Start; never executed: priv->phase = QAuthenticatorPrivate::Start; | 0 |
539 | | - |
540 | QString connectHost = connection->d_func()->hostName; | - |
541 | qint16 connectPort = connection->d_func()->port; | - |
542 | | - |
543 | | - |
544 | | - |
545 | if (connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy && !ssl) { evaluated: connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy yes Evaluation Count:100 | yes Evaluation Count:554 |
partially evaluated: !ssl yes Evaluation Count:100 | no Evaluation Count:0 |
| 0-554 |
546 | connectHost = connection->d_func()->networkProxy.hostName(); | - |
547 | connectPort = connection->d_func()->networkProxy.port(); | - |
548 | } executed: } Execution Count:100 | 100 |
549 | if (socket->proxy().type() == QNetworkProxy::HttpProxy) { evaluated: socket->proxy().type() == QNetworkProxy::HttpProxy yes Evaluation Count:17 | yes Evaluation Count:637 |
| 17-637 |
550 | | - |
551 | QByteArray value; | - |
552 | | - |
553 | if (request.url().isEmpty()) evaluated: request.url().isEmpty() yes Evaluation Count:15 | yes Evaluation Count:2 |
| 2-15 |
554 | value = connection->d_func()->predictNextRequest().headerField("user-agent"); executed: value = connection->d_func()->predictNextRequest().headerField("user-agent"); Execution Count:15 | 15 |
555 | else | - |
556 | value = request.headerField("user-agent"); executed: value = request.headerField("user-agent"); Execution Count:2 | 2 |
557 | if (!value.isEmpty()) { evaluated: !value.isEmpty() yes Evaluation Count:5 | yes Evaluation Count:12 |
| 5-12 |
558 | QNetworkProxy proxy(socket->proxy()); | - |
559 | proxy.setRawHeader("User-Agent", value); | - |
560 | socket->setProxy(proxy); | - |
561 | } executed: } Execution Count:5 | 5 |
562 | } executed: } Execution Count:17 | 17 |
563 | | - |
564 | if (ssl) { evaluated: ssl yes Evaluation Count:87 | yes Evaluation Count:567 |
| 87-567 |
565 | | - |
566 | QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); | - |
567 | sslSocket->connectToHostEncrypted(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference); | - |
568 | if (ignoreAllSslErrors) evaluated: ignoreAllSslErrors yes Evaluation Count:8 | yes Evaluation Count:79 |
| 8-79 |
569 | sslSocket->ignoreSslErrors(); executed: sslSocket->ignoreSslErrors(); Execution Count:8 | 8 |
570 | sslSocket->ignoreSslErrors(ignoreSslErrorsList); | - |
571 | | - |
572 | | - |
573 | | - |
574 | | - |
575 | socket->setReadBufferSize(64*1024); | - |
576 | | - |
577 | | - |
578 | | - |
579 | | - |
580 | | - |
581 | | - |
582 | } else { executed: } Execution Count:87 | 87 |
583 | | - |
584 | | - |
585 | if (connection->d_func()->networkProxy.type() == QNetworkProxy::NoProxy evaluated: connection->d_func()->networkProxy.type() == QNetworkProxy::NoProxy yes Evaluation Count:467 | yes Evaluation Count:100 |
| 100-467 |
586 | && connection->cacheProxy().type() == QNetworkProxy::NoProxy partially evaluated: connection->cacheProxy().type() == QNetworkProxy::NoProxy yes Evaluation Count:467 | no Evaluation Count:0 |
| 0-467 |
587 | && connection->transparentProxy().type() == QNetworkProxy::NoProxy) { evaluated: connection->transparentProxy().type() == QNetworkProxy::NoProxy yes Evaluation Count:425 | yes Evaluation Count:42 |
| 42-425 |
588 | | - |
589 | socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite | QIODevice::Unbuffered, networkLayerPreference); | - |
590 | | - |
591 | socket->setReadBufferSize(1*1024); | - |
592 | | - |
593 | } else { executed: } Execution Count:425 | 425 |
594 | socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference); | - |
595 | | - |
596 | | - |
597 | | - |
598 | | - |
599 | socket->setReadBufferSize(64*1024); | - |
600 | } executed: } Execution Count:142 | 142 |
601 | | - |
602 | } | - |
603 | return false; executed: return false; Execution Count:654 | 654 |
604 | } | - |
605 | return true; executed: return true; Execution Count:849 | 849 |
606 | } | - |
607 | | - |
608 | void QHttpNetworkConnectionChannel::allDone() | - |
609 | { | - |
610 | qt_noop(); | - |
611 | | - |
612 | if (!reply) { partially evaluated: !reply no Evaluation Count:0 | yes Evaluation Count:934 |
| 0-934 |
613 | QMessageLogger("access/qhttpnetworkconnectionchannel.cpp", 671, __PRETTY_FUNCTION__).warning() << "QHttpNetworkConnectionChannel::allDone() called without reply. Please report at http://bugreports.qt-project.org/"; | - |
614 | return; | 0 |
615 | } | - |
616 | | - |
617 | | - |
618 | bool emitFinished = reply->d_func()->shouldEmitSignals(); | - |
619 | bool connectionCloseEnabled = reply->d_func()->isConnectionCloseEnabled(); | - |
620 | detectPipeliningSupport(); | - |
621 | | - |
622 | handleStatus(); | - |
623 | | - |
624 | | - |
625 | | - |
626 | | - |
627 | | - |
628 | if (reply && emitFinished) evaluated: reply yes Evaluation Count:933 | yes Evaluation Count:1 |
evaluated: emitFinished yes Evaluation Count:599 | yes Evaluation Count:334 |
| 1-933 |
629 | QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); Execution Count:599 | 599 |
630 | | - |
631 | | - |
632 | | - |
633 | | - |
634 | reconnectAttempts = 2; | - |
635 | | - |
636 | | - |
637 | if (state != QHttpNetworkConnectionChannel::ClosingState) evaluated: state != QHttpNetworkConnectionChannel::ClosingState yes Evaluation Count:853 | yes Evaluation Count:81 |
| 81-853 |
638 | state = QHttpNetworkConnectionChannel::IdleState; executed: state = QHttpNetworkConnectionChannel::IdleState; Execution Count:853 | 853 |
639 | | - |
640 | | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | if (!resendCurrent) { evaluated: !resendCurrent yes Evaluation Count:632 | yes Evaluation Count:302 |
| 302-632 |
646 | request = QHttpNetworkRequest(); | - |
647 | reply = 0; | - |
648 | } executed: } Execution Count:632 | 632 |
649 | | - |
650 | | - |
651 | if (!alreadyPipelinedRequests.isEmpty()) { evaluated: !alreadyPipelinedRequests.isEmpty() yes Evaluation Count:10 | yes Evaluation Count:924 |
| 10-924 |
652 | if (resendCurrent || connectionCloseEnabled || socket->state() != QAbstractSocket::ConnectedState) { partially evaluated: resendCurrent no Evaluation Count:0 | yes Evaluation Count:10 |
partially evaluated: connectionCloseEnabled no Evaluation Count:0 | yes Evaluation Count:10 |
partially evaluated: socket->state() != QAbstractSocket::ConnectedState no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
653 | | - |
654 | requeueCurrentlyPipelinedRequests(); | - |
655 | close(); | - |
656 | } else { | 0 |
657 | | - |
658 | HttpMessagePair messagePair = alreadyPipelinedRequests.takeFirst(); | - |
659 | | - |
660 | request = messagePair.first; | - |
661 | reply = messagePair.second; | - |
662 | state = QHttpNetworkConnectionChannel::ReadingState; | - |
663 | resendCurrent = false; | - |
664 | | - |
665 | written = 0; | - |
666 | bytesTotal = 0; | - |
667 | | - |
668 | | - |
669 | connection->d_func()->fillPipeline(socket); | - |
670 | | - |
671 | | - |
672 | | - |
673 | | - |
674 | } executed: } Execution Count:10 | 10 |
675 | } else if (alreadyPipelinedRequests.isEmpty() && socket->bytesAvailable() > 0) { partially evaluated: alreadyPipelinedRequests.isEmpty() yes Evaluation Count:924 | no Evaluation Count:0 |
partially evaluated: socket->bytesAvailable() > 0 no Evaluation Count:0 | yes Evaluation Count:924 |
| 0-924 |
676 | | - |
677 | close(); | - |
678 | | - |
679 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
680 | } else if (alreadyPipelinedRequests.isEmpty()) { partially evaluated: alreadyPipelinedRequests.isEmpty() yes Evaluation Count:924 | no Evaluation Count:0 |
| 0-924 |
681 | if (connectionCloseEnabled) evaluated: connectionCloseEnabled yes Evaluation Count:189 | yes Evaluation Count:735 |
| 189-735 |
682 | if (socket->state() != QAbstractSocket::UnconnectedState) evaluated: socket->state() != QAbstractSocket::UnconnectedState yes Evaluation Count:127 | yes Evaluation Count:62 |
| 62-127 |
683 | close(); executed: close(); Execution Count:127 | 127 |
684 | if (qobject_cast<QHttpNetworkConnection*>(connection)) partially evaluated: qobject_cast<QHttpNetworkConnection*>(connection) yes Evaluation Count:924 | no Evaluation Count:0 |
| 0-924 |
685 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); Execution Count:924 | 924 |
686 | } executed: } Execution Count:924 | 924 |
687 | } | - |
688 | | - |
689 | void QHttpNetworkConnectionChannel::detectPipeliningSupport() | - |
690 | { | - |
691 | qt_noop(); | - |
692 | | - |
693 | QByteArray serverHeaderField; | - |
694 | if ( | - |
695 | | - |
696 | (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1) partially evaluated: reply->d_func()->majorVersion == 1 yes Evaluation Count:934 | no Evaluation Count:0 |
evaluated: reply->d_func()->minorVersion == 1 yes Evaluation Count:685 | yes Evaluation Count:249 |
| 0-934 |
697 | | - |
698 | && (!reply->d_func()->isConnectionCloseEnabled()) evaluated: (!reply->d_func()->isConnectionCloseEnabled()) yes Evaluation Count:683 | yes Evaluation Count:2 |
| 2-683 |
699 | | - |
700 | && (socket->state() == QAbstractSocket::ConnectedState) evaluated: (socket->state() == QAbstractSocket::ConnectedState) yes Evaluation Count:679 | yes Evaluation Count:4 |
| 4-679 |
701 | | - |
702 | | - |
703 | && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) partially evaluated: (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) yes Evaluation Count:679 | no Evaluation Count:0 |
| 0-679 |
704 | && (!serverHeaderField.contains("Microsoft-IIS/5.")) partially evaluated: (!serverHeaderField.contains("Microsoft-IIS/5.")) yes Evaluation Count:679 | no Evaluation Count:0 |
| 0-679 |
705 | && (!serverHeaderField.contains("Netscape-Enterprise/3.")) partially evaluated: (!serverHeaderField.contains("Netscape-Enterprise/3.")) yes Evaluation Count:679 | no Evaluation Count:0 |
| 0-679 |
706 | | - |
707 | && (!serverHeaderField.contains("WebLogic")) partially evaluated: (!serverHeaderField.contains("WebLogic")) yes Evaluation Count:679 | no Evaluation Count:0 |
| 0-679 |
708 | && (!serverHeaderField.startsWith("Rocket")) partially evaluated: (!serverHeaderField.startsWith("Rocket")) yes Evaluation Count:679 | no Evaluation Count:0 |
| 0-679 |
709 | ) { | - |
710 | pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; | - |
711 | } else { executed: } Execution Count:679 | 679 |
712 | pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown; | - |
713 | } executed: } Execution Count:255 | 255 |
714 | } | - |
715 | | - |
716 | | - |
717 | void QHttpNetworkConnectionChannel::requeueCurrentlyPipelinedRequests() | - |
718 | { | - |
719 | for (int i = 0; i < alreadyPipelinedRequests.length(); i++) partially evaluated: i < alreadyPipelinedRequests.length() no Evaluation Count:0 | yes Evaluation Count:98 |
| 0-98 |
720 | connection->d_func()->requeueRequest(alreadyPipelinedRequests.at(i)); never executed: connection->d_func()->requeueRequest(alreadyPipelinedRequests.at(i)); | 0 |
721 | alreadyPipelinedRequests.clear(); | - |
722 | | - |
723 | | - |
724 | | - |
725 | | - |
726 | if (qobject_cast<QHttpNetworkConnection*>(connection)) partially evaluated: qobject_cast<QHttpNetworkConnection*>(connection) yes Evaluation Count:98 | no Evaluation Count:0 |
| 0-98 |
727 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); Execution Count:98 | 98 |
728 | } executed: } Execution Count:98 | 98 |
729 | | - |
730 | void QHttpNetworkConnectionChannel::handleStatus() | - |
731 | { | - |
732 | qt_noop(); | - |
733 | qt_noop(); | - |
734 | | - |
735 | int statusCode = reply->statusCode(); | - |
736 | bool resend = false; | - |
737 | | - |
738 | switch (statusCode) { | - |
739 | case 401: | - |
740 | case 407: | - |
741 | if (connection->d_func()->handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { evaluated: connection->d_func()->handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend) yes Evaluation Count:332 | yes Evaluation Count:3 |
| 3-332 |
742 | if (resend) { evaluated: resend yes Evaluation Count:301 | yes Evaluation Count:31 |
| 31-301 |
743 | if (!resetUploadData()) evaluated: !resetUploadData() yes Evaluation Count:1 | yes Evaluation Count:300 |
| 1-300 |
744 | break; executed: break; Execution Count:1 | 1 |
745 | | - |
746 | reply->d_func()->eraseData(); | - |
747 | | - |
748 | if (alreadyPipelinedRequests.isEmpty()) { partially evaluated: alreadyPipelinedRequests.isEmpty() yes Evaluation Count:300 | no Evaluation Count:0 |
| 0-300 |
749 | | - |
750 | resendCurrent = true; | - |
751 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
752 | } else { executed: } Execution Count:300 | 300 |
753 | | - |
754 | closeAndResendCurrentRequest(); | - |
755 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
756 | } | 0 |
757 | } else { | - |
758 | | - |
759 | close(); | - |
760 | } executed: } Execution Count:31 | 31 |
761 | } else { | - |
762 | reply->headerChanged(); | - |
763 | reply->readyRead(); | - |
764 | QNetworkReply::NetworkError errorCode = (statusCode == 407) evaluated: (statusCode == 407) yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
765 | ? QNetworkReply::ProxyAuthenticationRequiredError | - |
766 | : QNetworkReply::AuthenticationRequiredError; | - |
767 | reply->d_func()->errorString = connection->d_func()->errorDetail(errorCode, socket); | - |
768 | reply->finishedWithError(errorCode, reply->d_func()->errorString); | - |
769 | } executed: } Execution Count:3 | 3 |
770 | break; executed: break; Execution Count:334 | 334 |
771 | default: | - |
772 | if (qobject_cast<QHttpNetworkConnection*>(connection)) partially evaluated: qobject_cast<QHttpNetworkConnection*>(connection) yes Evaluation Count:599 | no Evaluation Count:0 |
| 0-599 |
773 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); Execution Count:599 | 599 |
774 | } executed: } Execution Count:599 | 599 |
775 | } executed: } Execution Count:934 | 934 |
776 | | - |
777 | bool QHttpNetworkConnectionChannel::resetUploadData() | - |
778 | { | - |
779 | if (!reply) { partially evaluated: !reply no Evaluation Count:0 | yes Evaluation Count:494 |
| 0-494 |
780 | | - |
781 | return false; never executed: return false; | 0 |
782 | } | - |
783 | QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); | - |
784 | if (!uploadByteDevice) evaluated: !uploadByteDevice yes Evaluation Count:357 | yes Evaluation Count:137 |
| 137-357 |
785 | return true; executed: return true; Execution Count:357 | 357 |
786 | | - |
787 | if (uploadByteDevice->reset()) { evaluated: uploadByteDevice->reset() yes Evaluation Count:136 | yes Evaluation Count:1 |
| 1-136 |
788 | written = 0; | - |
789 | return true; executed: return true; Execution Count:136 | 136 |
790 | } else { | - |
791 | connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ContentReSendError); | - |
792 | return false; executed: return false; Execution Count:1 | 1 |
793 | } | - |
794 | } | - |
795 | | - |
796 | | - |
797 | | - |
798 | void QHttpNetworkConnectionChannel::setProxy(const QNetworkProxy &networkProxy) | - |
799 | { | - |
800 | if (socket) partially evaluated: socket no Evaluation Count:0 | yes Evaluation Count:3042 |
| 0-3042 |
801 | socket->setProxy(networkProxy); never executed: socket->setProxy(networkProxy); | 0 |
802 | | - |
803 | proxy = networkProxy; | - |
804 | } executed: } Execution Count:3042 | 3042 |
805 | | - |
806 | | - |
807 | | - |
808 | | - |
809 | | - |
810 | void QHttpNetworkConnectionChannel::ignoreSslErrors() | - |
811 | { | - |
812 | if (socket) evaluated: socket yes Evaluation Count:21 | yes Evaluation Count:105 |
| 21-105 |
813 | static_cast<QSslSocket *>(socket)->ignoreSslErrors(); executed: static_cast<QSslSocket *>(socket)->ignoreSslErrors(); Execution Count:21 | 21 |
814 | | - |
815 | ignoreAllSslErrors = true; | - |
816 | } executed: } Execution Count:126 | 126 |
817 | | - |
818 | | - |
819 | void QHttpNetworkConnectionChannel::ignoreSslErrors(const QList<QSslError> &errors) | - |
820 | { | - |
821 | if (socket) evaluated: socket yes Evaluation Count:6 | yes Evaluation Count:30 |
| 6-30 |
822 | static_cast<QSslSocket *>(socket)->ignoreSslErrors(errors); executed: static_cast<QSslSocket *>(socket)->ignoreSslErrors(errors); Execution Count:6 | 6 |
823 | | - |
824 | ignoreSslErrorsList = errors; | - |
825 | } executed: } Execution Count:36 | 36 |
826 | | - |
827 | void QHttpNetworkConnectionChannel::setSslConfiguration(const QSslConfiguration &config) | - |
828 | { | - |
829 | if (socket) partially evaluated: socket no Evaluation Count:0 | yes Evaluation Count:258 |
| 0-258 |
830 | static_cast<QSslSocket *>(socket)->setSslConfiguration(config); never executed: static_cast<QSslSocket *>(socket)->setSslConfiguration(config); | 0 |
831 | | - |
832 | sslConfiguration = config; | - |
833 | } executed: } Execution Count:258 | 258 |
834 | | - |
835 | | - |
836 | | - |
837 | void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair) | - |
838 | { | - |
839 | | - |
840 | | - |
841 | QHttpNetworkRequest &request = pair.first; | - |
842 | QHttpNetworkReply *reply = pair.second; | - |
843 | reply->d_func()->clear(); | - |
844 | reply->d_func()->connection = connection; | - |
845 | reply->d_func()->connectionChannel = this; | - |
846 | reply->d_func()->autoDecompress = request.d->autoDecompress; | - |
847 | reply->d_func()->pipeliningUsed = true; | - |
848 | | - |
849 | | - |
850 | pipeline.append(QHttpNetworkRequestPrivate::header(request, | - |
851 | (connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy))); | - |
852 | | - |
853 | | - |
854 | | - |
855 | | - |
856 | alreadyPipelinedRequests.append(pair); | - |
857 | | - |
858 | | - |
859 | } executed: } Execution Count:10 | 10 |
860 | | - |
861 | void QHttpNetworkConnectionChannel::pipelineFlush() | - |
862 | { | - |
863 | if (pipeline.isEmpty()) partially evaluated: pipeline.isEmpty() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
864 | return; | 0 |
865 | | - |
866 | | - |
867 | | - |
868 | | - |
869 | | - |
870 | | - |
871 | socket->write(pipeline); | - |
872 | pipeline.clear(); | - |
873 | } executed: } Execution Count:4 | 4 |
874 | | - |
875 | | - |
876 | void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() | - |
877 | { | - |
878 | requeueCurrentlyPipelinedRequests(); | - |
879 | close(); | - |
880 | if (reply) evaluated: reply yes Evaluation Count:54 | yes Evaluation Count:4 |
| 4-54 |
881 | resendCurrent = true; executed: resendCurrent = true; Execution Count:54 | 54 |
882 | if (qobject_cast<QHttpNetworkConnection*>(connection)) partially evaluated: qobject_cast<QHttpNetworkConnection*>(connection) yes Evaluation Count:58 | no Evaluation Count:0 |
| 0-58 |
883 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); Execution Count:58 | 58 |
884 | } executed: } Execution Count:58 | 58 |
885 | | - |
886 | bool QHttpNetworkConnectionChannel::isSocketBusy() const | - |
887 | { | - |
888 | return (state & QHttpNetworkConnectionChannel::BusyState); executed: return (state & QHttpNetworkConnectionChannel::BusyState); Execution Count:276 | 276 |
889 | } | - |
890 | | - |
891 | bool QHttpNetworkConnectionChannel::isSocketWriting() const | - |
892 | { | - |
893 | return (state & QHttpNetworkConnectionChannel::WritingState); executed: return (state & QHttpNetworkConnectionChannel::WritingState); Execution Count:3470 | 3470 |
894 | } | - |
895 | | - |
896 | bool QHttpNetworkConnectionChannel::isSocketWaiting() const | - |
897 | { | - |
898 | return (state & QHttpNetworkConnectionChannel::WaitingState); executed: return (state & QHttpNetworkConnectionChannel::WaitingState); Execution Count:10173 | 10173 |
899 | } | - |
900 | | - |
901 | bool QHttpNetworkConnectionChannel::isSocketReading() const | - |
902 | { | - |
903 | return (state & QHttpNetworkConnectionChannel::ReadingState); executed: return (state & QHttpNetworkConnectionChannel::ReadingState); Execution Count:9344 | 9344 |
904 | } | - |
905 | | - |
906 | | - |
907 | void QHttpNetworkConnectionChannel::_q_readyRead() | - |
908 | { | - |
909 | if (socket->state() == QAbstractSocket::ConnectedState && socket->bytesAvailable() == 0) { evaluated: socket->state() == QAbstractSocket::ConnectedState yes Evaluation Count:10198 | yes Evaluation Count:1 |
evaluated: socket->bytesAvailable() == 0 yes Evaluation Count:591 | yes Evaluation Count:9607 |
| 1-10198 |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | char c; | - |
915 | qint64 ret = socket->peek(&c, 1); | - |
916 | if (ret < 0) { evaluated: ret < 0 yes Evaluation Count:43 | yes Evaluation Count:548 |
| 43-548 |
917 | _q_error(socket->error()); | - |
918 | | - |
919 | if (reply) evaluated: reply yes Evaluation Count:17 | yes Evaluation Count:26 |
| 17-26 |
920 | _q_receiveReply(); executed: _q_receiveReply(); Execution Count:17 | 17 |
921 | return; executed: return; Execution Count:43 | 43 |
922 | } | - |
923 | } executed: } Execution Count:548 | 548 |
924 | | - |
925 | if (isSocketWaiting() || isSocketReading()) { evaluated: isSocketWaiting() yes Evaluation Count:829 | yes Evaluation Count:9327 |
evaluated: isSocketReading() yes Evaluation Count:9319 | yes Evaluation Count:8 |
| 8-9327 |
926 | state = QHttpNetworkConnectionChannel::ReadingState; | - |
927 | if (reply) partially evaluated: reply yes Evaluation Count:10148 | no Evaluation Count:0 |
| 0-10148 |
928 | _q_receiveReply(); executed: _q_receiveReply(); Execution Count:10148 | 10148 |
929 | } executed: } Execution Count:10148 | 10148 |
930 | } executed: } Execution Count:10156 | 10156 |
931 | | - |
932 | void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) | - |
933 | { | - |
934 | (void)bytes;; | - |
935 | | - |
936 | if (isSocketWriting()) evaluated: isSocketWriting() yes Evaluation Count:2091 | yes Evaluation Count:297 |
| 297-2091 |
937 | sendRequest(); executed: sendRequest(); Execution Count:2091 | 2091 |
938 | | - |
939 | } executed: } Execution Count:2388 | 2388 |
940 | | - |
941 | void QHttpNetworkConnectionChannel::_q_disconnected() | - |
942 | { | - |
943 | if (state == QHttpNetworkConnectionChannel::ClosingState) { evaluated: state == QHttpNetworkConnectionChannel::ClosingState yes Evaluation Count:195 | yes Evaluation Count:17 |
| 17-195 |
944 | state = QHttpNetworkConnectionChannel::IdleState; | - |
945 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
946 | return; executed: return; Execution Count:195 | 195 |
947 | } | - |
948 | | - |
949 | | - |
950 | if (isSocketWaiting() || isSocketReading()) { partially evaluated: isSocketWaiting() no Evaluation Count:0 | yes Evaluation Count:17 |
partially evaluated: isSocketReading() no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
951 | if (reply) { | 0 |
952 | state = QHttpNetworkConnectionChannel::ReadingState; | - |
953 | _q_receiveReply(); | - |
954 | } | 0 |
955 | } else if (state == QHttpNetworkConnectionChannel::IdleState && resendCurrent) { partially evaluated: state == QHttpNetworkConnectionChannel::IdleState yes Evaluation Count:17 | no Evaluation Count:0 |
partially evaluated: resendCurrent no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
956 | | - |
957 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
958 | } | 0 |
959 | state = QHttpNetworkConnectionChannel::IdleState; | - |
960 | | - |
961 | requeueCurrentlyPipelinedRequests(); | - |
962 | close(); | - |
963 | } executed: } Execution Count:17 | 17 |
964 | | - |
965 | | - |
966 | void QHttpNetworkConnectionChannel::_q_connected() | - |
967 | { | - |
968 | | - |
969 | if (connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::InProgress) { evaluated: connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::InProgress yes Evaluation Count:1 | yes Evaluation Count:643 |
| 1-643 |
970 | if (connection->d_func()->delayedConnectionTimer.isActive()) partially evaluated: connection->d_func()->delayedConnectionTimer.isActive() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
971 | connection->d_func()->delayedConnectionTimer.stop(); executed: connection->d_func()->delayedConnectionTimer.stop(); Execution Count:1 | 1 |
972 | if (networkLayerPreference == QAbstractSocket::IPv4Protocol) partially evaluated: networkLayerPreference == QAbstractSocket::IPv4Protocol yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
973 | connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4; executed: connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4; Execution Count:1 | 1 |
974 | else if (networkLayerPreference == QAbstractSocket::IPv6Protocol) never evaluated: networkLayerPreference == QAbstractSocket::IPv6Protocol | 0 |
975 | connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6; never executed: connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6; | 0 |
976 | else { | - |
977 | if (socket->peerAddress().protocol() == QAbstractSocket::IPv4Protocol) never evaluated: socket->peerAddress().protocol() == QAbstractSocket::IPv4Protocol | 0 |
978 | connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4; never executed: connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4; | 0 |
979 | else | - |
980 | connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6; never executed: connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6; | 0 |
981 | } | - |
982 | connection->d_func()->networkLayerDetected(networkLayerPreference); | - |
983 | } else { executed: } Execution Count:1 | 1 |
984 | if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) && (networkLayerPreference != QAbstractSocket::IPv4Protocol)) evaluated: (connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) yes Evaluation Count:642 | yes Evaluation Count:1 |
partially evaluated: (networkLayerPreference != QAbstractSocket::IPv4Protocol) no Evaluation Count:0 | yes Evaluation Count:642 |
| 0-642 |
985 | || ((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6) && (networkLayerPreference != QAbstractSocket::IPv6Protocol))) { evaluated: (connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6) yes Evaluation Count:1 | yes Evaluation Count:642 |
partially evaluated: (networkLayerPreference != QAbstractSocket::IPv6Protocol) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-642 |
986 | close(); | - |
987 | | - |
988 | QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); | - |
989 | return; | 0 |
990 | } | - |
991 | | - |
992 | } executed: } Execution Count:643 | 643 |
993 | socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); | - |
994 | | - |
995 | pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown; | - |
996 | | - |
997 | | - |
998 | | - |
999 | if (!pendingEncrypt) { evaluated: !pendingEncrypt yes Evaluation Count:561 | yes Evaluation Count:83 |
| 83-561 |
1000 | state = QHttpNetworkConnectionChannel::IdleState; | - |
1001 | if (!reply) evaluated: !reply yes Evaluation Count:452 | yes Evaluation Count:109 |
| 109-452 |
1002 | connection->d_func()->dequeueRequest(socket); executed: connection->d_func()->dequeueRequest(socket); Execution Count:452 | 452 |
1003 | if (reply) evaluated: reply yes Evaluation Count:560 | yes Evaluation Count:1 |
| 1-560 |
1004 | sendRequest(); executed: sendRequest(); Execution Count:560 | 560 |
1005 | } executed: } Execution Count:561 | 561 |
1006 | } executed: } Execution Count:644 | 644 |
1007 | | - |
1008 | | - |
1009 | void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socketError) | - |
1010 | { | - |
1011 | if (!socket) partially evaluated: !socket no Evaluation Count:0 | yes Evaluation Count:68 |
| 0-68 |
1012 | return; | 0 |
1013 | QNetworkReply::NetworkError errorCode = QNetworkReply::UnknownNetworkError; | - |
1014 | | - |
1015 | switch (socketError) { | - |
1016 | case QAbstractSocket::HostNotFoundError: | - |
1017 | errorCode = QNetworkReply::HostNotFoundError; | - |
1018 | break; executed: break; Execution Count:2 | 2 |
1019 | case QAbstractSocket::ConnectionRefusedError: | - |
1020 | errorCode = QNetworkReply::ConnectionRefusedError; | - |
1021 | break; | 0 |
1022 | case QAbstractSocket::RemoteHostClosedError: | - |
1023 | | - |
1024 | | - |
1025 | if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) { evaluated: state != QHttpNetworkConnectionChannel::IdleState yes Evaluation Count:27 | yes Evaluation Count:23 |
evaluated: state != QHttpNetworkConnectionChannel::ReadingState yes Evaluation Count:17 | yes Evaluation Count:10 |
| 10-27 |
1026 | if (reconnectAttempts-- > 0) { evaluated: reconnectAttempts-- > 0 yes Evaluation Count:13 | yes Evaluation Count:4 |
| 4-13 |
1027 | closeAndResendCurrentRequest(); | - |
1028 | return; executed: return; Execution Count:13 | 13 |
1029 | } else { | - |
1030 | errorCode = QNetworkReply::RemoteHostClosedError; | - |
1031 | } executed: } Execution Count:4 | 4 |
1032 | } else if (state == QHttpNetworkConnectionChannel::ReadingState) { evaluated: state == QHttpNetworkConnectionChannel::ReadingState yes Evaluation Count:10 | yes Evaluation Count:23 |
| 10-23 |
1033 | if (!reply->d_func()->expectContent()) { partially evaluated: !reply->d_func()->expectContent() no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1034 | | - |
1035 | return; | 0 |
1036 | } | - |
1037 | if (reply->contentLength() == -1 && !reply->d_func()->isChunked()) { evaluated: reply->contentLength() == -1 yes Evaluation Count:9 | yes Evaluation Count:1 |
evaluated: !reply->d_func()->isChunked() yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-9 |
1038 | | - |
1039 | | - |
1040 | return; executed: return; Execution Count:8 | 8 |
1041 | } | - |
1042 | | - |
1043 | | - |
1044 | if (socket->bytesAvailable()) { evaluated: socket->bytesAvailable() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1045 | | - |
1046 | | - |
1047 | | - |
1048 | reply->setReadBufferSize(0); | - |
1049 | _q_receiveReply(); | - |
1050 | | - |
1051 | if (ssl) { partially evaluated: ssl yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1052 | | - |
1053 | | - |
1054 | | - |
1055 | QSslSocket *sslSocket = static_cast<QSslSocket*>(socket); | - |
1056 | qint64 beforeFlush = sslSocket->encryptedBytesAvailable(); | - |
1057 | while (sslSocket->encryptedBytesAvailable()) { partially evaluated: sslSocket->encryptedBytesAvailable() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1058 | sslSocket->flush(); | - |
1059 | _q_receiveReply(); | - |
1060 | qint64 afterFlush = sslSocket->encryptedBytesAvailable(); | - |
1061 | if (afterFlush == beforeFlush) never evaluated: afterFlush == beforeFlush | 0 |
1062 | break; | 0 |
1063 | beforeFlush = afterFlush; | - |
1064 | } | 0 |
1065 | } executed: } Execution Count:1 | 1 |
1066 | | - |
1067 | } executed: } Execution Count:1 | 1 |
1068 | | - |
1069 | errorCode = QNetworkReply::RemoteHostClosedError; | - |
1070 | } else { executed: } Execution Count:2 | 2 |
1071 | errorCode = QNetworkReply::RemoteHostClosedError; | - |
1072 | } executed: } Execution Count:23 | 23 |
1073 | break; executed: break; Execution Count:29 | 29 |
1074 | case QAbstractSocket::SocketTimeoutError: | - |
1075 | | - |
1076 | if (state == QHttpNetworkConnectionChannel::WritingState && (reconnectAttempts-- > 0)) { never evaluated: state == QHttpNetworkConnectionChannel::WritingState never evaluated: (reconnectAttempts-- > 0) | 0 |
1077 | closeAndResendCurrentRequest(); | - |
1078 | return; | 0 |
1079 | } | - |
1080 | errorCode = QNetworkReply::TimeoutError; | - |
1081 | break; | 0 |
1082 | case QAbstractSocket::ProxyAuthenticationRequiredError: | - |
1083 | errorCode = QNetworkReply::ProxyAuthenticationRequiredError; | - |
1084 | break; executed: break; Execution Count:4 | 4 |
1085 | case QAbstractSocket::SslHandshakeFailedError: | - |
1086 | errorCode = QNetworkReply::SslHandshakeFailedError; | - |
1087 | break; executed: break; Execution Count:10 | 10 |
1088 | default: | - |
1089 | | - |
1090 | errorCode = QNetworkReply::UnknownNetworkError; | - |
1091 | break; executed: break; Execution Count:2 | 2 |
1092 | } | - |
1093 | QPointer<QHttpNetworkConnection> that = connection; | - |
1094 | QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); | - |
1095 | | - |
1096 | | - |
1097 | | - |
1098 | if (!connection->d_func()->shouldEmitChannelError(socket)) partially evaluated: !connection->d_func()->shouldEmitChannelError(socket) no Evaluation Count:0 | yes Evaluation Count:47 |
| 0-47 |
1099 | return; | 0 |
1100 | | - |
1101 | | - |
1102 | if (!reply) evaluated: !reply yes Evaluation Count:29 | yes Evaluation Count:18 |
| 18-29 |
1103 | connection->d_func()->dequeueRequest(socket); executed: connection->d_func()->dequeueRequest(socket); Execution Count:29 | 29 |
1104 | if (reply) { evaluated: reply yes Evaluation Count:23 | yes Evaluation Count:24 |
| 23-24 |
1105 | reply->d_func()->errorString = errorString; | - |
1106 | reply->finishedWithError(errorCode, errorString); | - |
1107 | reply = 0; | - |
1108 | } executed: } Execution Count:23 | 23 |
1109 | | - |
1110 | QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection); | - |
1111 | | - |
1112 | if (that) partially evaluated: that yes Evaluation Count:47 | no Evaluation Count:0 |
| 0-47 |
1113 | close(); executed: close(); Execution Count:47 | 47 |
1114 | } executed: } Execution Count:47 | 47 |
1115 | | - |
1116 | | - |
1117 | void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth) | - |
1118 | { | - |
1119 | | - |
1120 | if (!reply) evaluated: !reply yes Evaluation Count:31 | yes Evaluation Count:2 |
| 2-31 |
1121 | connection->d_func()->dequeueRequest(socket); executed: connection->d_func()->dequeueRequest(socket); Execution Count:31 | 31 |
1122 | if (reply) partially evaluated: reply yes Evaluation Count:33 | no Evaluation Count:0 |
| 0-33 |
1123 | connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); executed: connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); Execution Count:33 | 33 |
1124 | } executed: } Execution Count:33 | 33 |
1125 | | - |
1126 | | - |
1127 | void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead() | - |
1128 | { | - |
1129 | sendRequest(); | - |
1130 | } executed: } Execution Count:1876 | 1876 |
1131 | | - |
1132 | | - |
1133 | void QHttpNetworkConnectionChannel::_q_encrypted() | - |
1134 | { | - |
1135 | if (!socket) partially evaluated: !socket no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
1136 | return; | 0 |
1137 | state = QHttpNetworkConnectionChannel::IdleState; | - |
1138 | pendingEncrypt = false; | - |
1139 | if (!reply) evaluated: !reply yes Evaluation Count:42 | yes Evaluation Count:25 |
| 25-42 |
1140 | connection->d_func()->dequeueRequest(socket); executed: connection->d_func()->dequeueRequest(socket); Execution Count:42 | 42 |
1141 | if (reply) partially evaluated: reply yes Evaluation Count:67 | no Evaluation Count:0 |
| 0-67 |
1142 | sendRequest(); executed: sendRequest(); Execution Count:67 | 67 |
1143 | } executed: } Execution Count:67 | 67 |
1144 | | - |
1145 | void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) | - |
1146 | { | - |
1147 | if (!socket) partially evaluated: !socket no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-34 |
1148 | return; | 0 |
1149 | | - |
1150 | | - |
1151 | | - |
1152 | connection->d_func()->pauseConnection(); | - |
1153 | if (pendingEncrypt && !reply) partially evaluated: pendingEncrypt yes Evaluation Count:34 | no Evaluation Count:0 |
evaluated: !reply yes Evaluation Count:27 | yes Evaluation Count:7 |
| 0-34 |
1154 | connection->d_func()->dequeueRequest(socket); executed: connection->d_func()->dequeueRequest(socket); Execution Count:27 | 27 |
1155 | if (reply) partially evaluated: reply yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
1156 | reply->sslErrors(errors); executed: reply->sslErrors(errors); Execution Count:34 | 34 |
1157 | connection->d_func()->resumeConnection(); | - |
1158 | } executed: } Execution Count:34 | 34 |
1159 | | - |
1160 | void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes) | - |
1161 | { | - |
1162 | (void)bytes;; | - |
1163 | | - |
1164 | if (isSocketWriting()) evaluated: isSocketWriting() yes Evaluation Count:831 | yes Evaluation Count:251 |
| 251-831 |
1165 | sendRequest(); executed: sendRequest(); Execution Count:831 | 831 |
1166 | | - |
1167 | } executed: } Execution Count:1082 | 1082 |
1168 | | - |
1169 | | - |
1170 | | - |
1171 | void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c) | - |
1172 | { | - |
1173 | | - |
1174 | | - |
1175 | connection = c; | - |
1176 | } executed: } Execution Count:3042 | 3042 |
1177 | | - |
1178 | | - |
1179 | | - |
1180 | | - |
| | |