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