qnetworkreplyimpl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkreplyimpl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate()-
6 : backend(0), outgoingData(0),-
7 copyDevice(0),-
8 cacheEnabled(false), cacheSaveDevice(0),-
9 notificationHandlingPaused(false),-
10 bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), preMigrationDownloaded(-1),-
11 httpStatusCode(0),-
12 state(Idle)-
13 , downloadBufferReadPosition(0)-
14 , downloadBufferCurrentSize(0)-
15 , downloadBufferMaximumSize(0)-
16 , downloadBuffer(0)-
17{-
18 if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool() == true
request.attrib...Bool() == trueDescription
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-122
19 emitAllUploadProgressSignals = true;
never executed: emitAllUploadProgressSignals = true;
0
20}
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
21-
22void QNetworkReplyImplPrivate::_q_startOperation()-
23{-
24-
25 if (state == Working
state == WorkingDescription
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
|| state == Finished
state == FinishedDescription
TRUEnever evaluated
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-124
26 QMessageLogger(__FILE__, 76, __PRETTY_FUNCTION__).debug() << "QNetworkReplyImpl::_q_startOperation was called more than once" << url;-
27 return;
never executed: return;
0
28 }-
29 state = Working;-
30-
31-
32-
33-
34 if (!backend
!backendDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
4-120
35 error(QNetworkReplyImpl::ProtocolUnknownError,-
36 QCoreApplication::translate("QNetworkReply", "Protocol \"%1\" is unknown").arg(url.scheme()));-
37 finished();-
38 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
4
39 }-
40-
41-
42 QNetworkReplyImpl * const q = q_func();-
43-
44 QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());-
45 QVariant isBackground = backend->request().attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false));-
46 if (isBackground.toBool()
isBackground.toBool()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 115 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
&& session
sessionDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
&& session->usagePolicies().testFlag(QNetworkSession::NoBackgroundTrafficPolicy)
session->usage...TrafficPolicy)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-115
47 error(QNetworkReply::BackgroundRequestNotAllowedError,-
48 QCoreApplication::translate("QNetworkReply", "Background request not allowed."));-
49 finished();-
50 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
51 }-
52-
53-
54 if (!backend->start()
!backend->start()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
3-116
55-
56-
57-
58-
59 state = WaitingForSession;-
60-
61 if (session
sessionDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-3
62 QObject::connect(session.data(), qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "112"),-
63 q, qFlagLocation("1""_q_networkSessionFailed()" "\0" __FILE__ ":" "113"));-
64-
65 if (!session->isOpen()
!session->isOpen()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-3
66 session->setSessionProperty(([]() -> QString { enum { Size = sizeof(u"" "ConnectInBackground")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ConnectInBackground" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 3 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QNetworkReply
qstring_literal_temp;
executed 3 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QNetworkReply
}()), isBackground);
3
67 session->open();-
68 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
3
69 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
else {
3
70 QMessageLogger(__FILE__, 120, __PRETTY_FUNCTION__).warning("Backend is waiting for QNetworkSession to connect, but there is none!");-
71 state = Working;-
72 error(QNetworkReplyImpl::NetworkSessionFailedError,-
73 QCoreApplication::translate("QNetworkReply", "Network session error."));-
74 finished();-
75 }
never executed: end of block
0
76-
77-
78-
79-
80-
81-
82-
83 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
3
84 } else {-
85-
86 if (session
sessionDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-116
87 QObject::connect(session.data(), qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "137"),-
88 q, qFlagLocation("1""_q_networkSessionStateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "138"), Qt::QueuedConnection);-
89 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
90-
91 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
92-
93-
94 if (session
sessionDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-116
95-
96 QObject::connect(session.data(), qFlagLocation("2""usagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "146"),-
97 q, qFlagLocation("1""_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "147"));-
98 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
99-
100-
101-
102 downloadProgressSignalChoke.start();-
103 uploadProgressSignalChoke.invalidate();-
104-
105 if (backend
backendDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
&& backend->isSynchronous()
backend->isSynchronous()Description
TRUEnever evaluated
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-116
106 state = Finished;-
107 q_func()->setFinished(true);-
108 }
never executed: end of block
else {
0
109 if (state != Finished
state != FinishedDescription
TRUEevaluated 99 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
17-99
110 if (operation == QNetworkAccessManager::GetOperation
operation == Q...::GetOperationDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
40-59
111 pendingNotifications.append(NotifyDownstreamReadyWrite);
executed 40 times by 1 test: pendingNotifications.append(NotifyDownstreamReadyWrite);
Executed by:
  • tst_QNetworkReply
40
112-
113 handleNotifications();-
114 }
executed 99 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
99
115 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
116}-
117-
118void QNetworkReplyImplPrivate::_q_copyReadyRead()-
119{-
120 QNetworkReplyImpl * const q = q_func();-
121 if (state != Working
state != WorkingDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
122 return;
never executed: return;
0
123 if (!copyDevice
!copyDeviceDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
|| !q->isOpen()
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
124 return;
never executed: return;
0
125-
126-
127-
128-
129-
130 for(;;) {-
131 qint64 bytesToRead = nextDownstreamBlockSize();-
132 if (bytesToRead == 0
bytesToRead == 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
133-
134 break;
never executed: break;
0
135-
136 bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable());-
137 qint64 bytesActuallyRead = copyDevice->read(buffer.reserve(bytesToRead), bytesToRead);-
138 if (bytesActuallyRead == -1
bytesActuallyRead == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-9
139 buffer.chop(bytesToRead);-
140 backendNotify(NotifyCopyFinished);-
141 break;
never executed: break;
0
142 }-
143 buffer.chop(bytesToRead - bytesActuallyRead);-
144-
145 if (!copyDevice->isSequential()
!copyDevice->isSequential()Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
&& copyDevice->atEnd()
copyDevice->atEnd()Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-9
146 backendNotify(NotifyCopyFinished);-
147 bytesDownloaded += bytesActuallyRead;-
148 break;
executed 9 times by 2 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
149 }-
150-
151 bytesDownloaded += bytesActuallyRead;-
152 }
never executed: end of block
0
153-
154 if (bytesDownloaded == lastBytesDownloaded
bytesDownloade...ytesDownloadedDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-9
155-
156 return;
never executed: return;
0
157 }-
158-
159 lastBytesDownloaded = bytesDownloaded;-
160 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
161 if (preMigrationDownloaded != static_cast<long long>(-1LL)
preMigrationDo...ng long>(-1LL)Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
162 totalSize = totalSize.toLongLong() + preMigrationDownloaded;
never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded;
0
163 pauseNotificationHandling();-
164-
165-
166 q->readyRead();-
167 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
downloadProgre...SignalIntervalDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-9
168 downloadProgressSignalChoke.restart();-
169 q->downloadProgress(bytesDownloaded,-
170 totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong());-
171 }
never executed: end of block
0
172 resumeNotificationHandling();-
173}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
174-
175void QNetworkReplyImplPrivate::_q_copyReadChannelFinished()-
176{-
177 _q_copyReadyRead();-
178}
never executed: end of block
0
179-
180void QNetworkReplyImplPrivate::_q_bufferOutgoingDataFinished()-
181{-
182 QNetworkReplyImpl * const q = q_func();-
183-
184-
185-
186 if (state != Buffering
state != BufferingDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
187 return;
never executed: return;
0
188-
189-
190 QObject::disconnect(outgoingData, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "240"), q, qFlagLocation("1""_q_bufferOutgoingData()" "\0" __FILE__ ":" "240"));-
191 QObject::disconnect(outgoingData, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "241"), q, qFlagLocation("1""_q_bufferOutgoingDataFinished()" "\0" __FILE__ ":" "241"));-
192-
193-
194 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
195}
never executed: end of block
0
196-
197void QNetworkReplyImplPrivate::_q_bufferOutgoingData()-
198{-
199 QNetworkReplyImpl * const q = q_func();-
200-
201 if (!outgoingDataBuffer
!outgoingDataBufferDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
202-
203 outgoingDataBuffer = QSharedPointer<QRingBuffer>::create();-
204-
205 QObject::connect(outgoingData, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "255"), q, qFlagLocation("1""_q_bufferOutgoingData()" "\0" __FILE__ ":" "255"));-
206 QObject::connect(outgoingData, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "256"), q, qFlagLocation("1""_q_bufferOutgoingDataFinished()" "\0" __FILE__ ":" "256"));-
207 }
never executed: end of block
0
208-
209 qint64 bytesBuffered = 0;-
210 qint64 bytesToBuffer = 0;-
211-
212-
213 for(;;) {-
214 bytesToBuffer = outgoingData->bytesAvailable();-
215-
216 if (bytesToBuffer <= 0
bytesToBuffer <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
217 bytesToBuffer = 2*1024;
never executed: bytesToBuffer = 2*1024;
0
218-
219 char *dst = outgoingDataBuffer->reserve(bytesToBuffer);-
220 bytesBuffered = outgoingData->read(dst, bytesToBuffer);-
221-
222 if (bytesBuffered == -1
bytesBuffered == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
223-
224 outgoingDataBuffer->chop(bytesToBuffer);-
225-
226 _q_bufferOutgoingDataFinished();-
227 break;
never executed: break;
0
228 } else if (bytesBuffered == 0
bytesBuffered == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
229-
230 outgoingDataBuffer->chop(bytesToBuffer);-
231-
232 break;
never executed: break;
0
233 } else {-
234-
235 outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered);-
236 }
never executed: end of block
0
237 }-
238}
never executed: end of block
0
239-
240-
241void QNetworkReplyImplPrivate::_q_networkSessionConnected()-
242{-
243 QNetworkReplyImpl * const q = q_func();-
244-
245 if (manager.isNull()
manager.isNull()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-3
246 return;
never executed: return;
0
247-
248 QSharedPointer<QNetworkSession> session = manager->d_func()->getNetworkSession();-
249 if (!session
!sessionDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-3
250 return;
never executed: return;
0
251-
252 if (session->state() != QNetworkSession::Connected
session->state...ion::ConnectedDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-3
253 return;
never executed: return;
0
254-
255 switch (state) {-
256 case
never executed: case QNetworkReplyPrivate::Buffering:
QNetworkReplyPrivate::Buffering:
never executed: case QNetworkReplyPrivate::Buffering:
0
257 case
never executed: case QNetworkReplyPrivate::Working:
QNetworkReplyPrivate::Working:
never executed: case QNetworkReplyPrivate::Working:
0
258 case
never executed: case QNetworkReplyPrivate::Reconnecting:
QNetworkReplyPrivate::Reconnecting:
never executed: case QNetworkReplyPrivate::Reconnecting:
0
259-
260 migrateBackend();-
261 break;
never executed: break;
0
262 case
executed 3 times by 1 test: case QNetworkReplyPrivate::WaitingForSession:
Executed by:
  • tst_QNetworkReply
QNetworkReplyPrivate::WaitingForSession:
executed 3 times by 1 test: case QNetworkReplyPrivate::WaitingForSession:
Executed by:
  • tst_QNetworkReply
3
263-
264 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
265 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
3
266 default
never executed: default:
:
never executed: default:
0
267 ;-
268 }
never executed: end of block
0
269}-
270-
271void QNetworkReplyImplPrivate::_q_networkSessionStateChanged(QNetworkSession::State sessionState)-
272{-
273 if (sessionState == QNetworkSession::Disconnected
sessionState =...::DisconnectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
274 && state != Idle
state != IdleDescription
TRUEnever evaluated
FALSEnever evaluated
&& state != Reconnecting
state != ReconnectingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 error(QNetworkReplyImpl::NetworkSessionFailedError,-
276 QCoreApplication::translate("QNetworkReply", "Network session error."));-
277 finished();-
278 }
never executed: end of block
0
279}
never executed: end of block
0
280-
281void QNetworkReplyImplPrivate::_q_networkSessionFailed()-
282{-
283-
284 if (state == WaitingForSession
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEnever evaluated
|| state == Working
state == WorkingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
285 state = Working;-
286 QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());-
287 QString errorStr;-
288 if (session
sessionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
289 errorStr = session->errorString();
never executed: errorStr = session->errorString();
0
290 else-
291 errorStr = QCoreApplication::translate("QNetworkReply", "Network session error.");
never executed: errorStr = QCoreApplication::translate("QNetworkReply", "Network session error.");
0
292 error(QNetworkReplyImpl::NetworkSessionFailedError, errorStr);-
293 finished();-
294 }
never executed: end of block
0
295}
never executed: end of block
0
296-
297void QNetworkReplyImplPrivate::_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies newPolicies)-
298{-
299 if (backend->request().attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()
backend->reque...bute).toBool()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
2-3
300 if (newPolicies & QNetworkSession::NoBackgroundTrafficPolicy
newPolicies & ...dTrafficPolicyDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
1
301-
302 if (state == WaitingForSession
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
|| state == Working
state == WorkingDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-1
303 state = Working;-
304 error(QNetworkReply::BackgroundRequestNotAllowedError,-
305 QCoreApplication::translate("QNetworkReply", "Background request not allowed."));-
306 finished();-
307 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
308-
309 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
310 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
311}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
5
312-
313-
314void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req,-
315 QIODevice *data)-
316{-
317 QNetworkReplyImpl * const q = q_func();-
318-
319 outgoingData = data;-
320 request = req;-
321 url = request.url();-
322 operation = op;-
323-
324 q->QIODevice::open(QIODevice::ReadOnly);-
325-
326-
327 QVariant synchronousHttpAttribute = req.attribute(-
328 static_cast<QNetworkRequest::Attribute>(QNetworkRequest::SynchronousRequestAttribute));-
329-
330-
331 if (synchronousHttpAttribute.toBool()
synchronousHtt...ibute.toBool()Description
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
&& outgoingData
outgoingDataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-122
332 outgoingDataBuffer = QSharedPointer<QRingBuffer>::create();-
333 qint64 previousDataSize = 0;-
334 do {-
335 previousDataSize = outgoingDataBuffer->size();-
336 outgoingDataBuffer->append(outgoingData->readAll());-
337 }
never executed: end of block
while (outgoingDataBuffer->size() != previousDataSize
outgoingDataBu...eviousDataSizeDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
338 }
never executed: end of block
0
339-
340 if (backend
backendDescription
TRUEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
4-118
341 backend->setSynchronous(synchronousHttpAttribute.toBool());
executed 118 times by 3 tests: backend->setSynchronous(synchronousHttpAttribute.toBool());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
118
342-
343-
344 if (outgoingData
outgoingDataDescription
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
&& backend
backendDescription
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
&& !backend->isSynchronous()
!backend->isSynchronous()Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-63
345-
346-
347 if (!backend->needsResetableUploadData()
!backend->need...leUploadData()Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
|| !outgoingData->isSequential()
!outgoingData->isSequential()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-59
348-
349-
350-
351 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
352 }
executed 59 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
else {
59
353 bool bufferingDisallowed =-
354 req.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute,-
355 false).toBool();-
356-
357 if (bufferingDisallowed
bufferingDisallowedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
358-
359-
360 if (req.header(QNetworkRequest::ContentLengthHeader).isValid()
req.header(QNe...der).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
361 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
362 }
never executed: end of block
else {
0
363 state = Buffering;-
364 QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection);-
365 }
never executed: end of block
0
366 } else {-
367-
368 state = Buffering;-
369 QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection);-
370 }
never executed: end of block
0
371 }-
372 } else {-
373-
374-
375 if (backend
backendDescription
TRUEevaluated 59 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& backend->isSynchronous()
backend->isSynchronous()Description
TRUEnever evaluated
FALSEevaluated 59 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-59
376 _q_startOperation();
never executed: _q_startOperation();
0
377 else-
378 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
executed 63 times by 3 tests: QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
63
379 }-
380}-
381-
382void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification)-
383{-
384 QNetworkReplyImpl * const q = q_func();-
385 if (!pendingNotifications.contains(notification)
!pendingNotifi...(notification)Description
TRUEevaluated 463 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 173 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
173-463
386 pendingNotifications.enqueue(notification);
executed 463 times by 2 tests: pendingNotifications.enqueue(notification);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
463
387-
388 if (pendingNotifications.size() == 1
pendingNotific...ns.size() == 1Description
TRUEevaluated 636 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
)
0-636
389 QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
executed 636 times by 2 tests: QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
636
390}
executed 636 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
636
391-
392void QNetworkReplyImplPrivate::handleNotifications()-
393{-
394 if (notificationHandlingPaused
notificationHandlingPausedDescription
TRUEnever evaluated
FALSEevaluated 817 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-817
395 return;
never executed: return;
0
396-
397 NotificationQueue current = pendingNotifications;-
398 pendingNotifications.clear();-
399-
400 if (state != Working
state != WorkingDescription
TRUEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 800 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
17-800
401 return;
executed 17 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
17
402-
403 while (state == Working
state == WorkingDescription
TRUEevaluated 1285 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& !current.isEmpty()
!current.isEmpty()Description
TRUEevaluated 489 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 796 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
4-1285
404 InternalNotifications notification = current.dequeue();-
405 switch (notification) {-
406 case
executed 489 times by 1 test: case NotifyDownstreamReadyWrite:
Executed by:
  • tst_QNetworkReply
NotifyDownstreamReadyWrite:
executed 489 times by 1 test: case NotifyDownstreamReadyWrite:
Executed by:
  • tst_QNetworkReply
489
407 if (copyDevice
copyDeviceDescription
TRUEnever evaluated
FALSEevaluated 489 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-489
408 _q_copyReadyRead();
never executed: _q_copyReadyRead();
0
409 else-
410 backend->downstreamReadyWrite();
executed 489 times by 1 test: backend->downstreamReadyWrite();
Executed by:
  • tst_QNetworkReply
489
411 break;
executed 489 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
489
412-
413 case
never executed: case NotifyCloseDownstreamChannel:
NotifyCloseDownstreamChannel:
never executed: case NotifyCloseDownstreamChannel:
0
414 backend->closeDownstreamChannel();-
415 break;
never executed: break;
0
416-
417 case
never executed: case NotifyCopyFinished:
NotifyCopyFinished:
never executed: case NotifyCopyFinished:
{
0
418 QIODevice *dev = copyDevice;-
419 copyDevice = 0;-
420 backend->copyFinished(dev);-
421 break;
never executed: break;
0
422 }-
423 }-
424 }
executed 489 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
489
425}
executed 800 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
800
426-
427-
428-
429void QNetworkReplyImplPrivate::pauseNotificationHandling()-
430{-
431 notificationHandlingPaused = true;-
432}
executed 1506 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
1506
433-
434-
435void QNetworkReplyImplPrivate::resumeNotificationHandling()-
436{-
437 QNetworkReplyImpl * const q = q_func();-
438 notificationHandlingPaused = false;-
439 if (pendingNotifications.size() >= 1
pendingNotific...ns.size() >= 1Description
TRUEevaluated 181 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 1325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
181-1325
440 QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
executed 181 times by 2 tests: QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
181
441}
executed 1506 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
1506
442-
443QAbstractNetworkCache *QNetworkReplyImplPrivate::networkCache() const-
444{-
445 if (!backend
!backendDescription
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-30
446 return
never executed: return 0;
0;
never executed: return 0;
0
447 return
executed 30 times by 1 test: return backend->networkCache();
Executed by:
  • tst_QNetworkReply
backend->networkCache();
executed 30 times by 1 test: return backend->networkCache();
Executed by:
  • tst_QNetworkReply
30
448}-
449-
450void QNetworkReplyImplPrivate::createCache()-
451{-
452-
453 if (!networkCache()
!networkCache()Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-30
454 || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
!request.attri...true).toBool()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
455 return;
executed 30 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
30
456 cacheEnabled = true;-
457}
never executed: end of block
0
458-
459bool QNetworkReplyImplPrivate::isCachingEnabled() const-
460{-
461 return
executed 122 times by 3 tests: return (cacheEnabled && networkCache() != 0);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
(cacheEnabled && networkCache() != 0);
executed 122 times by 3 tests: return (cacheEnabled && networkCache() != 0);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
462}-
463-
464void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)-
465{-
466 if (!enable
!enableDescription
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& !cacheEnabled
!cacheEnabledDescription
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
)
0-30
467 return;
executed 13 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
13
468 if (enable
enableDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
&& cacheEnabled
cacheEnabledDescription
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-30
469 return;
never executed: return;
0
470-
471 if (enable
enableDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-30
472 if (__builtin_expect(!!(bytesDownloaded), false)
__builtin_expe...oaded), false)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-30
473-
474 QMessageLogger(__FILE__, 524, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");-
475 return;
never executed: return;
0
476 }-
477-
478 createCache();-
479 }
executed 30 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
else {
30
480-
481-
482 QMessageLogger(__FILE__, 532, __PRETTY_FUNCTION__).debug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false) -- "-
483 "backend %s probably needs to be fixed",-
484 backend->metaObject()->className());-
485 networkCache()->remove(url);-
486 cacheSaveDevice = 0;-
487 cacheEnabled = false;-
488 }
never executed: end of block
0
489}-
490-
491void QNetworkReplyImplPrivate::completeCacheSave()-
492{-
493 if (cacheEnabled
cacheEnabledDescription
TRUEnever evaluated
FALSEevaluated 119 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
&& errorCode != QNetworkReplyImpl::NoError
errorCode != Q...yImpl::NoErrorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-119
494 networkCache()->remove(url);-
495 }
never executed: end of block
else if (cacheEnabled
cacheEnabledDescription
TRUEnever evaluated
FALSEevaluated 119 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
&& cacheSaveDevice
cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-119
496 networkCache()->insert(cacheSaveDevice);-
497 }
never executed: end of block
0
498 cacheSaveDevice = 0;-
499 cacheEnabled = false;-
500}
executed 119 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
119
501-
502void QNetworkReplyImplPrivate::emitUploadProgress(qint64 bytesSent, qint64 bytesTotal)-
503{-
504 QNetworkReplyImpl * const q = q_func();-
505 bytesUploaded = bytesSent;-
506-
507 if (!emitAllUploadProgressSignals
!emitAllUploadProgressSignalsDescription
TRUEevaluated 1053 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-1053
508-
509 if (uploadProgressSignalChoke.isValid()
uploadProgress...hoke.isValid()Description
TRUEevaluated 1000 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 53 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
53-1000
510 if (bytesSent != bytesTotal
bytesSent != bytesTotalDescription
TRUEevaluated 410 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 590 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& uploadProgressSignalChoke.elapsed() < progressSignalInterval
uploadProgress...SignalIntervalDescription
TRUEevaluated 410 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-590
511 return;
executed 410 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
410
512 }-
513 uploadProgressSignalChoke.restart();-
514 }
executed 590 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
else {
590
515 uploadProgressSignalChoke.start();-
516 }
executed 53 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
53
517 }-
518-
519 pauseNotificationHandling();-
520 q->uploadProgress(bytesSent, bytesTotal);-
521 resumeNotificationHandling();-
522}
executed 643 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
643
523-
524-
525qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const-
526{-
527 enum { DesiredBufferSize = 32 * 1024 };-
528 if (readBufferMaxSize == 0
readBufferMaxSize == 0Description
TRUEevaluated 529 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
6-529
529 return
executed 529 times by 2 tests: return DesiredBufferSize;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
DesiredBufferSize;
executed 529 times by 2 tests: return DesiredBufferSize;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
529
530-
531 return
executed 6 times by 1 test: return qMax<qint64>(0, readBufferMaxSize - buffer.size());
Executed by:
  • tst_QNetworkReply
qMax<qint64>(0, readBufferMaxSize - buffer.size());
executed 6 times by 1 test: return qMax<qint64>(0, readBufferMaxSize - buffer.size());
Executed by:
  • tst_QNetworkReply
6
532}-
533-
534void QNetworkReplyImplPrivate::initCacheSaveDevice()-
535{-
536 QNetworkReplyImpl * const q = q_func();-
537-
538-
539-
540 if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206
q->attribute(Q...toInt() == 206Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
541 cacheEnabled = false;-
542 return;
never executed: return;
0
543 }-
544-
545-
546 QNetworkCacheMetaData metaData;-
547 metaData.setUrl(url);-
548 metaData = backend->fetchCacheMetaData(metaData);-
549-
550-
551 QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute);-
552 if (redirectionTarget.isValid()
redirectionTarget.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
553 QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes();-
554 attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);-
555 metaData.setAttributes(attributes);-
556 }
never executed: end of block
0
557-
558 cacheSaveDevice = networkCache()->prepare(metaData);-
559-
560 if (!cacheSaveDevice
!cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
|| (cacheSaveDevice
cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !cacheSaveDevice->isOpen()
!cacheSaveDevice->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
561 if (__builtin_expect(!!(cacheSaveDevice && !cacheSaveDevice->isOpen()), false)
__builtin_expe...pen()), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
562 QMessageLogger(__FILE__, 612, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- "
never executed: QMessageLogger(__FILE__, 612, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", networkCache()->metaObject()->className());
0
563 "class %s probably needs to be fixed",
never executed: QMessageLogger(__FILE__, 612, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", networkCache()->metaObject()->className());
0
564 networkCache()->metaObject()->className());
never executed: QMessageLogger(__FILE__, 612, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", networkCache()->metaObject()->className());
0
565-
566 networkCache()->remove(url);-
567 cacheSaveDevice = 0;-
568 cacheEnabled = false;-
569 }
never executed: end of block
0
570}
never executed: end of block
0
571-
572-
573-
574void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data)-
575{-
576 QNetworkReplyImpl * const q = q_func();-
577 if (!q->isOpen()
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-488
578 return;
never executed: return;
0
579-
580 if (cacheEnabled
cacheEnabledDescription
TRUEnever evaluated
FALSEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& !cacheSaveDevice
!cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-488
581 initCacheSaveDevice();-
582 }
never executed: end of block
0
583-
584 qint64 bytesWritten = 0;-
585 for (int i = 0; i < data.bufferCount()
i < data.bufferCount()Description
TRUEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
; i++) {
488
586 QByteArray const &item = data[i];-
587-
588 if (cacheSaveDevice
cacheSaveDeviceDescription
TRUEnever evaluated
FALSEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-488
589 cacheSaveDevice->write(item.constData(), item.size());
never executed: cacheSaveDevice->write(item.constData(), item.size());
0
590 buffer.append(item);-
591-
592 bytesWritten += item.size();-
593 }
executed 488 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
488
594 data.clear();-
595-
596 bytesDownloaded += bytesWritten;-
597 lastBytesDownloaded = bytesDownloaded;-
598-
599 appendDownstreamDataSignalEmissions();-
600}
executed 488 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
488
601-
602void QNetworkReplyImplPrivate::appendDownstreamDataSignalEmissions()-
603{-
604 QNetworkReplyImpl * const q = q_func();-
605-
606 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
607 if (preMigrationDownloaded != static_cast<long long>(-1LL)
preMigrationDo...ng long>(-1LL)Description
TRUEnever evaluated
FALSEevaluated 488 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-488
608 totalSize = totalSize.toLongLong() + preMigrationDownloaded;
never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded;
0
609 pauseNotificationHandling();-
610-
611-
612 q->readyRead();-
613-
614-
615 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
downloadProgre...SignalIntervalDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 486 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
2-486
616 downloadProgressSignalChoke.restart();-
617 q->downloadProgress(bytesDownloaded,-
618 totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong());-
619 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
620-
621 resumeNotificationHandling();-
622-
623 if (nextDownstreamBlockSize() > 0
nextDownstreamBlockSize() > 0Description
TRUEevaluated 482 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
6-482
624 backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
executed 482 times by 1 test: backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
Executed by:
  • tst_QNetworkReply
482
625}
executed 488 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
488
626-
627-
628void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data)-
629{-
630 QNetworkReplyImpl * const q = q_func();-
631 if (!q->isOpen()
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
632 return;
never executed: return;
0
633-
634-
635 if (__builtin_expect(!!(copyDevice), false)
__builtin_expe...evice), false)Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-9
636 QMessageLogger(__FILE__, 686, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: copy from QIODevice already in progress -- "-
637 "backend probly needs to be fixed");-
638 return;
never executed: return;
0
639 }-
640-
641 copyDevice = data;-
642 q->connect(copyDevice, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "692"), qFlagLocation("1""_q_copyReadyRead()" "\0" __FILE__ ":" "692"));-
643 q->connect(copyDevice, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "693"), qFlagLocation("1""_q_copyReadChannelFinished()" "\0" __FILE__ ":" "693"));-
644-
645-
646 _q_copyReadyRead();-
647}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
648-
649void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data)-
650{-
651 (void)data;-
652-
653-
654-
655-
656 QMessageLogger(__FILE__, 706, __PRETTY_FUNCTION__).fatal("QNetworkReplyImplPrivate::appendDownstreamData not implemented");-
657}
never executed: end of block
0
658-
659static void downloadBufferDeleter(char *ptr)-
660{-
661 delete[] ptr;-
662}
never executed: end of block
0
663-
664char* QNetworkReplyImplPrivate::getDownloadBuffer(qint64 size)-
665{-
666 QNetworkReplyImpl * const q = q_func();-
667-
668 if (!downloadBuffer
!downloadBufferDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
669-
670-
671 QVariant bufferAllocationPolicy = request.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute);-
672 if (bufferAllocationPolicy.isValid()
bufferAllocati...licy.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& bufferAllocationPolicy.toLongLong() >= size
bufferAllocati...Long() >= sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
673 downloadBufferCurrentSize = 0;-
674 downloadBufferMaximumSize = size;-
675 downloadBuffer = new char[downloadBufferMaximumSize];-
676 downloadBufferPointer = QSharedPointer<char>(downloadBuffer, downloadBufferDeleter);-
677-
678 q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer));-
679 }
never executed: end of block
0
680 }
never executed: end of block
0
681-
682 return
never executed: return downloadBuffer;
downloadBuffer;
never executed: return downloadBuffer;
0
683}-
684-
685void QNetworkReplyImplPrivate::setDownloadBuffer(QSharedPointer<char> sp, qint64 size)-
686{-
687 QNetworkReplyImpl * const q = q_func();-
688-
689 downloadBufferPointer = sp;-
690 downloadBuffer = downloadBufferPointer.data();-
691 downloadBufferCurrentSize = 0;-
692 downloadBufferMaximumSize = size;-
693 q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer));-
694}
never executed: end of block
0
695-
696-
697void QNetworkReplyImplPrivate::appendDownstreamDataDownloadBuffer(qint64 bytesReceived, qint64 bytesTotal)-
698{-
699 QNetworkReplyImpl * const q = q_func();-
700 if (!q->isOpen()
!q->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
701 return;
never executed: return;
0
702-
703 if (cacheEnabled
cacheEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
&& !cacheSaveDevice
!cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
704 initCacheSaveDevice();
never executed: initCacheSaveDevice();
0
705-
706 if (cacheSaveDevice
cacheSaveDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& bytesReceived == bytesTotal
bytesReceived == bytesTotalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
707-
708-
709-
710-
711-
712 cacheSaveDevice->write(downloadBuffer, bytesTotal);-
713 }
never executed: end of block
0
714-
715 bytesDownloaded = bytesReceived;-
716 lastBytesDownloaded = bytesReceived;-
717-
718 downloadBufferCurrentSize = bytesReceived;-
719-
720-
721-
722-
723 if (bytesDownloaded > 0
bytesDownloaded > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
724 q->readyRead();
never executed: q->readyRead();
0
725 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
downloadProgre...SignalIntervalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
726 downloadProgressSignalChoke.restart();-
727 q->downloadProgress(bytesDownloaded, bytesTotal);-
728 }
never executed: end of block
0
729}
never executed: end of block
0
730-
731void QNetworkReplyImplPrivate::finished()-
732{-
733 QNetworkReplyImpl * const q = q_func();-
734-
735 if (state == Finished
state == FinishedDescription
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
|| state == Aborted
state == AbortedDescription
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
|| state == WaitingForSession
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-122
736 return;
never executed: return;
0
737-
738 pauseNotificationHandling();-
739 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
740 if (preMigrationDownloaded != static_cast<long long>(-1LL)
preMigrationDo...ng long>(-1LL)Description
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-122
741 totalSize = totalSize.toLongLong() + preMigrationDownloaded;
never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded;
0
742-
743 if (!manager.isNull()
!manager.isNull()Description
TRUEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-122
744-
745 QSharedPointer<QNetworkSession> session (manager->d_func()->getNetworkSession());-
746 if (session
sessionDescription
TRUEevaluated 121 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkAccessManager
&& session->state() == QNetworkSession::Roaming
session->state...ssion::RoamingDescription
TRUEnever evaluated
FALSEevaluated 121 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
&&
0-121
747 state == Working
state == WorkingDescription
TRUEnever evaluated
FALSEnever evaluated
&& errorCode != QNetworkReply::OperationCanceledError
errorCode != Q...nCanceledErrorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
748-
749 if (!totalSize.isNull()
!totalSize.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
750 if (bytesDownloaded != totalSize
bytesDownloaded != totalSizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
751 if (migrateBackend()
migrateBackend()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
752-
753 if (state == Reconnecting
state == ReconnectingDescription
TRUEnever evaluated
FALSEnever evaluated
|| state == WaitingForSession
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
754 resumeNotificationHandling();-
755 return;
never executed: return;
0
756 }-
757 }
never executed: end of block
else {
0
758 error(QNetworkReply::TemporaryNetworkFailureError,-
759 QNetworkReply::tr("Temporary network failure."));-
760 }
never executed: end of block
0
761 }-
762 }
never executed: end of block
0
763 }
never executed: end of block
0
764-
765 }
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
766 resumeNotificationHandling();-
767-
768 state = Finished;-
769 q->setFinished(true);-
770-
771 pendingNotifications.clear();-
772-
773 pauseNotificationHandling();-
774 if (totalSize.isNull()
totalSize.isNull()Description
TRUEevaluated 88 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QNetworkReply
|| totalSize == -1
totalSize == -1Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-88
775 q->downloadProgress(bytesDownloaded, bytesDownloaded);-
776 }
executed 88 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
else {
88
777 q->downloadProgress(bytesDownloaded, totalSize.toLongLong());-
778 }
executed 34 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
34
779-
780 if (bytesUploaded == -1
bytesUploaded == -1Description
TRUEevaluated 69 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEevaluated 53 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& (outgoingData
outgoingDataDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
|| outgoingDataBuffer
outgoingDataBufferDescription
TRUEnever evaluated
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
))
0-69
781 q->uploadProgress(0, 0);
executed 6 times by 1 test: q->uploadProgress(0, 0);
Executed by:
  • tst_QNetworkReply
6
782 resumeNotificationHandling();-
783-
784-
785 if (totalSize.isNull()
totalSize.isNull()Description
TRUEevaluated 88 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QNetworkReply
|| totalSize == -1
totalSize == -1Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QNetworkReply
|| bytesDownloaded == totalSize
bytesDownloaded == totalSizeDescription
TRUEevaluated 31 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-88
786 completeCacheSave();
executed 119 times by 3 tests: completeCacheSave();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
119
787-
788-
789-
790-
791 pauseNotificationHandling();-
792 q->readChannelFinished();-
793 q->finished();-
794 resumeNotificationHandling();-
795}
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
796-
797void QNetworkReplyImplPrivate::error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage)-
798{-
799 QNetworkReplyImpl * const q = q_func();-
800-
801 if (errorCode != QNetworkReply::NoError
errorCode != Q...Reply::NoErrorDescription
TRUEnever evaluated
FALSEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
) {
0-25
802 QMessageLogger(__FILE__, 852, __PRETTY_FUNCTION__).warning( "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");-
803 return;
never executed: return;
0
804 }-
805-
806 errorCode = code;-
807 q->setErrorString(errorMessage);-
808-
809-
810-
811-
812 q->error(code);-
813}
executed 25 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
25
814-
815void QNetworkReplyImplPrivate::metaDataChanged()-
816{-
817 QNetworkReplyImpl * const q = q_func();-
818-
819-
820 if (!manager.isNull()
!manager.isNull()Description
TRUEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-54
821 const auto it = cookedHeaders.constFind(QNetworkRequest::SetCookieHeader);-
822 if (it != cookedHeaders.cend()
it != cookedHeaders.cend()Description
TRUEnever evaluated
FALSEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-54
823 && request.attribute(QNetworkRequest::CookieSaveControlAttribute,
request.attrib...est::AutomaticDescription
TRUEnever evaluated
FALSEnever evaluated
0
824 QNetworkRequest::Automatic).toInt() == QNetworkRequest::Automatic
request.attrib...est::AutomaticDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
825 QNetworkCookieJar *jar = manager->cookieJar();-
826 if (jar
jarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
827 QList<QNetworkCookie> cookies =-
828 qvariant_cast<QList<QNetworkCookie> >(it.value());-
829 jar->setCookiesFromUrl(cookies, url);-
830 }
never executed: end of block
0
831 }
never executed: end of block
0
832 }
executed 54 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
54
833-
834 q->metaDataChanged();-
835}
executed 54 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
54
836-
837void QNetworkReplyImplPrivate::redirectionRequested(const QUrl &target)-
838{-
839 attributes.insert(QNetworkRequest::RedirectionTargetAttribute, target);-
840}
never executed: end of block
0
841-
842void QNetworkReplyImplPrivate::encrypted()-
843{-
844-
845 QNetworkReplyImpl * const q = q_func();-
846 q->encrypted();-
847-
848}
never executed: end of block
0
849-
850void QNetworkReplyImplPrivate::sslErrors(const QList<QSslError> &errors)-
851{-
852-
853 QNetworkReplyImpl * const q = q_func();-
854 q->sslErrors(errors);-
855-
856-
857-
858}
never executed: end of block
0
859-
860QNetworkReplyImpl::QNetworkReplyImpl(QObject *parent)-
861 : QNetworkReply(*new QNetworkReplyImplPrivate, parent)-
862{-
863}
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
864-
865QNetworkReplyImpl::~QNetworkReplyImpl()-
866{-
867 QNetworkReplyImplPrivate * const d = d_func();-
868-
869-
870-
871-
872 if (d->isCachingEnabled()
d->isCachingEnabled()Description
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-122
873 d->networkCache()->remove(url());
never executed: d->networkCache()->remove(url());
0
874}
executed 122 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
122
875-
876void QNetworkReplyImpl::abort()-
877{-
878 QNetworkReplyImplPrivate * const d = d_func();-
879 if (d->state == QNetworkReplyPrivate::Finished
d->state == QN...vate::FinishedDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->state == QNetworkReplyPrivate::Aborted
d->state == QN...ivate::AbortedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
880 return;
never executed: return;
0
881-
882-
883 if (d->outgoingData
d->outgoingDataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
884 disconnect(d->outgoingData, 0, this, 0);
never executed: disconnect(d->outgoingData, 0, this, 0);
0
885 if (d->copyDevice
d->copyDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
886 disconnect(d->copyDevice, 0, this, 0);
never executed: disconnect(d->copyDevice, 0, this, 0);
0
887-
888 QNetworkReply::close();-
889-
890-
891 d->error(OperationCanceledError, tr("Operation canceled"));-
892 if (d->state == QNetworkReplyPrivate::WaitingForSession
d->state == QN...tingForSessionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
893 d->state = QNetworkReplyPrivate::Working;
never executed: d->state = QNetworkReplyPrivate::Working;
0
894 d->finished();-
895 d->state = QNetworkReplyPrivate::Aborted;-
896-
897-
898 if (d->backend
d->backendDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
899 d->backend->deleteLater();-
900 d->backend = 0;-
901 }
never executed: end of block
0
902}
never executed: end of block
0
903-
904void QNetworkReplyImpl::close()-
905{-
906 QNetworkReplyImplPrivate * const d = d_func();-
907 if (d->state == QNetworkReplyPrivate::Aborted
d->state == QN...ivate::AbortedDescription
TRUEnever evaluated
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
||
0-15
908 d->state == QNetworkReplyPrivate::Finished
d->state == QN...vate::FinishedDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
2-13
909 return;
executed 13 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
13
910-
911-
912 if (d->backend
d->backendDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
FALSEnever evaluated
)
0-2
913 d->backend->closeDownstreamChannel();
executed 2 times by 2 tests: d->backend->closeDownstreamChannel();
Executed by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
2
914 if (d->copyDevice
d->copyDeviceDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
)
0-2
915 disconnect(d->copyDevice, 0, this, 0);
never executed: disconnect(d->copyDevice, 0, this, 0);
0
916-
917 QNetworkReply::close();-
918-
919-
920 d->error(OperationCanceledError, tr("Operation canceled"));-
921 d->finished();-
922}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
2
923-
924-
925-
926-
927-
928-
929qint64 QNetworkReplyImpl::bytesAvailable() const-
930{-
931-
932 const QNetworkReplyImplPrivate * const d = d_func();-
933 if (d->downloadBuffer
d->downloadBufferDescription
TRUEnever evaluated
FALSEevaluated 286 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-286
934 qint64 maxAvail = d->downloadBufferCurrentSize - d->downloadBufferReadPosition;-
935 return
never executed: return QNetworkReply::bytesAvailable() + maxAvail;
QNetworkReply::bytesAvailable() + maxAvail;
never executed: return QNetworkReply::bytesAvailable() + maxAvail;
0
936 }-
937-
938 return
executed 286 times by 1 test: return QNetworkReply::bytesAvailable();
Executed by:
  • tst_QNetworkReply
QNetworkReply::bytesAvailable();
executed 286 times by 1 test: return QNetworkReply::bytesAvailable();
Executed by:
  • tst_QNetworkReply
286
939}-
940-
941void QNetworkReplyImpl::setReadBufferSize(qint64 size)-
942{-
943 QNetworkReplyImplPrivate * const d = d_func();-
944 if (size > d->readBufferMaxSize
size > d->readBufferMaxSizeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&&
2
945 size > d->buffer.size()
size > d->buffer.size()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
)
0-2
946 d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
executed 2 times by 1 test: d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
Executed by:
  • tst_QNetworkReply
2
947-
948 QNetworkReply::setReadBufferSize(size);-
949-
950 if (d->backend
d->backendDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
)
0-4
951 d->backend->setDownstreamLimited(d->readBufferMaxSize > 0);
executed 4 times by 1 test: d->backend->setDownstreamLimited(d->readBufferMaxSize > 0);
Executed by:
  • tst_QNetworkReply
4
952}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
4
953-
954-
955void QNetworkReplyImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const-
956{-
957 const QNetworkReplyImplPrivate * const d = d_func();-
958 if (d->backend
d->backendDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
959 d->backend->fetchSslConfiguration(configuration);
never executed: d->backend->fetchSslConfiguration(configuration);
0
960}
never executed: end of block
0
961-
962void QNetworkReplyImpl::setSslConfigurationImplementation(const QSslConfiguration &config)-
963{-
964 QNetworkReplyImplPrivate * const d = d_func();-
965 if (d->backend
d->backendDescription
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
&& !config.isNull()
!config.isNull()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
)
0-104
966 d->backend->setSslConfiguration(config);
executed 104 times by 1 test: d->backend->setSslConfiguration(config);
Executed by:
  • tst_QNetworkReply
104
967}
executed 108 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
108
968-
969void QNetworkReplyImpl::ignoreSslErrors()-
970{-
971 QNetworkReplyImplPrivate * const d = d_func();-
972 if (d->backend
d->backendDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
973 d->backend->ignoreSslErrors();
never executed: d->backend->ignoreSslErrors();
0
974}
never executed: end of block
0
975-
976void QNetworkReplyImpl::ignoreSslErrorsImplementation(const QList<QSslError> &errors)-
977{-
978 QNetworkReplyImplPrivate * const d = d_func();-
979 if (d->backend
d->backendDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
980 d->backend->ignoreSslErrors(errors);
never executed: d->backend->ignoreSslErrors(errors);
0
981}
never executed: end of block
0
982-
983-
984-
985-
986-
987qint64 QNetworkReplyImpl::readData(char *data, qint64 maxlen)-
988{-
989 QNetworkReplyImplPrivate * const d = d_func();-
990-
991-
992 if (d->downloadBuffer
d->downloadBufferDescription
TRUEnever evaluated
FALSEevaluated 252 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-252
993 qint64 maxAvail = qMin<qint64>(d->downloadBufferCurrentSize - d->downloadBufferReadPosition, maxlen);-
994 if (maxAvail == 0
maxAvail == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
995 return
never executed: return d->state == QNetworkReplyPrivate::Finished ? -1 : 0;
d->state == QNetworkReplyPrivate::Finished ? -1 : 0;
never executed: return d->state == QNetworkReplyPrivate::Finished ? -1 : 0;
0
996-
997 memcpy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail);-
998 d->downloadBufferReadPosition += maxAvail;-
999 return
never executed: return maxAvail;
maxAvail;
never executed: return maxAvail;
0
1000 }-
1001-
1002-
1003-
1004 if (d->state == QNetworkReplyPrivate::Finished
d->state == QN...vate::FinishedDescription
TRUEevaluated 109 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 143 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
109-143
1005 return
executed 109 times by 2 tests: return -1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
-1;
executed 109 times by 2 tests: return -1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
109
1006-
1007 d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);-
1008 return
executed 143 times by 1 test: return 0;
Executed by:
  • tst_QNetworkReply
0;
executed 143 times by 1 test: return 0;
Executed by:
  • tst_QNetworkReply
143
1009}-
1010-
1011-
1012-
1013-
1014bool QNetworkReplyImpl::event(QEvent *e)-
1015{-
1016 if (e->type() == QEvent::NetworkReplyUpdated
e->type() == Q...rkReplyUpdatedDescription
TRUEevaluated 718 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 273 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
) {
273-718
1017 d_func()->handleNotifications();-
1018 return
executed 718 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
true;
executed 718 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
718
1019 }-
1020-
1021 return
executed 273 times by 3 tests: return QObject::event(e);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
QObject::event(e);
executed 273 times by 3 tests: return QObject::event(e);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
273
1022}-
1023-
1024-
1025-
1026-
1027-
1028bool QNetworkReplyImplPrivate::migrateBackend()-
1029{-
1030 QNetworkReplyImpl * const q = q_func();-
1031-
1032-
1033 if (state == Finished
state == FinishedDescription
TRUEnever evaluated
FALSEnever evaluated
|| state == Aborted
state == AbortedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1034 return
never executed: return true;
true;
never executed: return true;
0
1035-
1036-
1037 if (outgoingData
outgoingDataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1038 return
never executed: return false;
false;
never executed: return false;
0
1039-
1040-
1041 if (copyDevice
copyDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1042 return
never executed: return true;
true;
never executed: return true;
0
1043-
1044-
1045 if (backend
backendDescription
TRUEnever evaluated
FALSEnever evaluated
&& !backend->canResume()
!backend->canResume()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1046 return
never executed: return false;
false;
never executed: return false;
0
1047-
1048 state = QNetworkReplyPrivate::Reconnecting;-
1049-
1050 cookedHeaders.clear();-
1051 rawHeaders.clear();-
1052-
1053 preMigrationDownloaded = bytesDownloaded;-
1054-
1055 delete backend;-
1056 backend = manager->d_func()->findBackend(operation, request);-
1057-
1058 if (backend
backendDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1059 backend->setParent(q);-
1060 backend->reply = this;-
1061 backend->setResumeOffset(bytesDownloaded);-
1062 }
never executed: end of block
0
1063-
1064 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
1065-
1066 return
never executed: return true;
true;
never executed: return true;
0
1067}-
1068-
1069-
1070QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent,-
1071 const QNetworkRequest &req,-
1072 QNetworkAccessManager::Operation op)-
1073: QNetworkReply(parent)-
1074{-
1075 setRequest(req);-
1076 setUrl(req.url());-
1077 setOperation(op);-
1078-
1079 qRegisterMetaType<QNetworkReply::NetworkError>();-
1080-
1081 QString msg = QCoreApplication::translate("QNetworkAccessManager",-
1082 "Network access is disabled.");-
1083 setError(UnknownNetworkError, msg);-
1084-
1085 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,-
1086 QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", UnknownNetworkError));-
1087 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);-
1088}
never executed: end of block
0
1089-
1090QDisabledNetworkReply::~QDisabledNetworkReply()-
1091{-
1092}-
1093-
1094-
1095-
1096-
Switch to Source codePreprocessed file

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