qnetworkreplyhttpimpl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkreplyhttpimpl.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40//#define QNETWORKACCESSHTTPBACKEND_DEBUG-
41-
42#include "qnetworkreplyhttpimpl_p.h"-
43#include "qnetworkaccessmanager_p.h"-
44#include "qnetworkaccesscache_p.h"-
45#include "qabstractnetworkcache.h"-
46#include "qnetworkrequest.h"-
47#include "qnetworkreply.h"-
48#include "qnetworkrequest_p.h"-
49#include "qnetworkcookie.h"-
50#include "qnetworkcookie_p.h"-
51#include "QtCore/qdatetime.h"-
52#include "QtCore/qelapsedtimer.h"-
53#include "QtNetwork/qsslconfiguration.h"-
54#include "qhttpthreaddelegate_p.h"-
55#include "qthread.h"-
56#include "QtCore/qcoreapplication.h"-
57-
58#include <QtCore/private/qthread_p.h>-
59-
60#include "qnetworkcookiejar.h"-
61-
62#ifndef QT_NO_HTTP-
63-
64#include <string.h> // for strchr-
65-
66QT_BEGIN_NAMESPACE-
67-
68class QNetworkProxy;-
69-
70static inline bool isSeparator(char c)-
71{-
72 static const char separators[] = "()<>@,;:\\\"/[]?={}";-
73 return isLWS(c) || strchr(separators, c) != 0;
executed 157 times by 2 tests: return isLWS(c) || strchr(separators, c) != 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
157
74}-
75-
76// ### merge with nextField in cookiejar.cpp-
77static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &header)-
78{-
79 // The HTTP header is of the form:-
80 // header = #1(directives)-
81 // directives = token | value-directive-
82 // value-directive = token "=" (token | quoted-string)-
83 QHash<QByteArray, QByteArray> result;-
84-
85 int pos = 0;-
86 while (true) {-
87 // skip spaces-
88 pos = nextNonWhitespace(header, pos);-
89 if (pos == header.length())
pos == header.length()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
22-69
90 return result; // end of parsing
executed 22 times by 2 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
22
91-
92 // pos points to a non-whitespace-
93 int comma = header.indexOf(',', pos);-
94 int equal = header.indexOf('=', pos);-
95 if (comma == pos || equal == pos)
comma == posDescription
TRUEnever evaluated
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
equal == posDescription
TRUEnever evaluated
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-69
96 // huh? Broken header.-
97 return result;
never executed: return result;
0
98-
99 // The key name is delimited by either a comma, an equal sign or the end-
100 // of the header, whichever comes first-
101 int end = comma;-
102 if (end == -1)
end == -1Description
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
19-50
103 end = header.length();
executed 50 times by 2 tests: end = header.length();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
50
104 if (equal != -1 && end > equal)
equal != -1Description
TRUEevaluated 47 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
end > equalDescription
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
4-47
105 end = equal; // equal sign comes before comma/end
executed 43 times by 2 tests: end = equal;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
43
106 QByteArray key = QByteArray(header.constData() + pos, end - pos).trimmed().toLower();-
107 pos = end + 1;-
108-
109 if (uint(equal) < uint(comma)) {
uint(equal) < uint(comma)Description
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
26-43
110 // case: token "=" (token | quoted-string)-
111 // skip spaces-
112 pos = nextNonWhitespace(header, pos);-
113 if (pos == header.length())
pos == header.length()Description
TRUEnever evaluated
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-43
114 // huh? Broken header-
115 return result;
never executed: return result;
0
116-
117 QByteArray value;-
118 value.reserve(header.length() - pos);-
119 if (header.at(pos) == '"') {
header.at(pos) == '"'Description
TRUEnever evaluated
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-43
120 // case: quoted-string-
121 // quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )-
122 // qdtext = <any TEXT except <">>-
123 // quoted-pair = "\" CHAR-
124 ++pos;-
125 while (pos < header.length()) {
pos < header.length()Description
TRUEnever evaluated
FALSEnever evaluated
0
126 char c = header.at(pos);-
127 if (c == '"') {
c == '"'Description
TRUEnever evaluated
FALSEnever evaluated
0
128 // end of quoted text-
129 break;
never executed: break;
0
130 } else if (c == '\\') {
c == '\\'Description
TRUEnever evaluated
FALSEnever evaluated
0
131 ++pos;-
132 if (pos >= header.length())
pos >= header.length()Description
TRUEnever evaluated
FALSEnever evaluated
0
133 // broken header-
134 return result;
never executed: return result;
0
135 c = header.at(pos);-
136 }
never executed: end of block
0
137-
138 value += c;-
139 ++pos;-
140 }
never executed: end of block
0
141 } else {
never executed: end of block
0
142 // case: token-
143 while (pos < header.length()) {
pos < header.length()Description
TRUEevaluated 157 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
28-157
144 char c = header.at(pos);-
145 if (isSeparator(c))
isSeparator(c)Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 142 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
15-142
146 break;
executed 15 times by 2 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
15
147 value += c;-
148 ++pos;-
149 }
executed 142 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
142
150 }
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
43
151-
152 result.insert(key, value);-
153-
154 // find the comma now:-
155 comma = header.indexOf(',', pos);-
156 if (comma == -1)
comma == -1Description
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
15-28
157 return result; // end of parsing
executed 28 times by 2 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
28
158 pos = comma + 1;-
159 } else {
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
15
160 // case: token-
161 // key is already set-
162 result.insert(key, QByteArray());-
163 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
26
164 }-
165}
never executed: end of block
0
166-
167QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager,-
168 const QNetworkRequest& request,-
169 QNetworkAccessManager::Operation& operation,-
170 QIODevice* outgoingData)-
171 : QNetworkReply(*new QNetworkReplyHttpImplPrivate, manager)-
172{-
173 Q_D(QNetworkReplyHttpImpl);-
174 d->manager = manager;-
175 d->managerPrivate = manager->d_func();-
176 d->request = request;-
177 d->originalRequest = request;-
178 d->operation = operation;-
179 d->outgoingData = outgoingData;-
180 d->url = request.url();-
181#ifndef QT_NO_SSL-
182 d->sslConfiguration = request.sslConfiguration();-
183#endif-
184-
185 // FIXME Later maybe set to Unbuffered, especially if it is zerocopy or from cache?-
186 QIODevice::open(QIODevice::ReadOnly);-
187-
188-
189 // Internal code that does a HTTP reply for the synchronous Ajax-
190 // in Qt WebKit.-
191 QVariant synchronousHttpAttribute = request.attribute(-
192 static_cast<QNetworkRequest::Attribute>(QNetworkRequest::SynchronousRequestAttribute));-
193 if (synchronousHttpAttribute.isValid()) {
synchronousHtt...bute.isValid()Description
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 811 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
76-811
194 d->synchronous = synchronousHttpAttribute.toBool();-
195 if (d->synchronous && outgoingData) {
d->synchronousDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
outgoingDataDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-76
196 // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer.-
197 // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway.-
198 d->outgoingDataBuffer = QSharedPointer<QRingBuffer>::create();-
199 qint64 previousDataSize = 0;-
200 do {-
201 previousDataSize = d->outgoingDataBuffer->size();-
202 d->outgoingDataBuffer->append(d->outgoingData->readAll());-
203 } while (d->outgoingDataBuffer->size() != previousDataSize);
executed 77 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
d->outgoingDat...eviousDataSizeDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QNetworkReply
36-77
204 d->_q_startOperation();-
205 return;
executed 41 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
41
206 }-
207 }
executed 35 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
35
208-
209-
210 if (outgoingData) {
outgoingDataDescription
TRUEevaluated 155 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 691 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
155-691
211 // there is data to be uploaded, e.g. HTTP POST.-
212-
213 if (!d->outgoingData->isSequential()) {
!d->outgoingDa...isSequential()Description
TRUEevaluated 96 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
59-96
214 // fixed size non-sequential (random-access)-
215 // just start the operation-
216 QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection);-
217 // FIXME make direct call?-
218 } else {
executed 96 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
96
219 bool bufferingDisallowed =-
220 request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute,-
221 false).toBool();-
222-
223 if (bufferingDisallowed) {
bufferingDisallowedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_QNetworkReply
1-58
224 // if a valid content-length header for the request was supplied, we can disable buffering-
225 // if not, we will buffer anyway-
226 if (request.header(QNetworkRequest::ContentLengthHeader).isValid()) {
request.header...der).isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-1
227 QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection);-
228 // FIXME make direct call?-
229 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
230 d->state = d->Buffering;-
231 QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection);-
232 }
never executed: end of block
0
233 } else {-
234 // _q_startOperation will be called when the buffering has finished.-
235 d->state = d->Buffering;-
236 QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection);-
237 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
58
238 }-
239 } else {-
240 // No outgoing data (POST, ..)-
241 d->_q_startOperation();-
242 }
executed 691 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
691
243}-
244-
245QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl()-
246{-
247 // This will do nothing if the request was already finished or aborted-
248 emit abortHttpRequest();-
249}
executed 886 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
886
250-
251void QNetworkReplyHttpImpl::close()-
252{-
253 Q_D(QNetworkReplyHttpImpl);-
254-
255 if (d->state == QNetworkReplyPrivate::Aborted ||
d->state == QN...ivate::AbortedDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1
256 d->state == QNetworkReplyPrivate::Finished)
d->state == QN...vate::FinishedDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1
257 return;
never executed: return;
0
258-
259 // According to the documentation close only stops the download-
260 // by closing we can ignore the download part and continue uploading.-
261 QNetworkReply::close();-
262-
263 // call finished which will emit signals-
264 // FIXME shouldn't this be emitted Queued?-
265 d->error(OperationCanceledError, tr("Operation canceled"));-
266 d->finished();-
267}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
268-
269void QNetworkReplyHttpImpl::abort()-
270{-
271 Q_D(QNetworkReplyHttpImpl);-
272 // FIXME-
273 if (d->state == QNetworkReplyPrivate::Finished || d->state == QNetworkReplyPrivate::Aborted)
d->state == QN...vate::FinishedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
d->state == QN...ivate::AbortedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-2
274 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
275-
276 QNetworkReply::close();-
277-
278 if (d->state != QNetworkReplyPrivate::Finished) {
d->state != QN...vate::FinishedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-2
279 // call finished which will emit signals-
280 // FIXME shouldn't this be emitted Queued?-
281 d->error(OperationCanceledError, tr("Operation canceled"));-
282-
283 // If state is WaitingForSession, calling finished has no effect-
284 if (d->state == QNetworkReplyPrivate::WaitingForSession)
d->state == QN...tingForSessionDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-2
285 d->state = QNetworkReplyPrivate::Working;
never executed: d->state = QNetworkReplyPrivate::Working;
0
286 d->finished();-
287 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
288-
289 d->state = QNetworkReplyPrivate::Aborted;-
290-
291 emit abortHttpRequest();-
292}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
293-
294qint64 QNetworkReplyHttpImpl::bytesAvailable() const-
295{-
296 Q_D(const QNetworkReplyHttpImpl);-
297-
298 // if we load from cache device-
299 if (d->cacheLoadDevice) {
d->cacheLoadDeviceDescription
TRUEnever evaluated
FALSEevaluated 2143 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-2143
300 return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable();
never executed: return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable();
0
301 }-
302-
303 // zerocopy buffer-
304 if (d->downloadZerocopyBuffer) {
d->downloadZerocopyBufferDescription
TRUEevaluated 1190 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 953 times by 1 test
Evaluated by:
  • tst_QNetworkReply
953-1190
305 return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition;
executed 1190 times by 1 test: return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition;
Executed by:
  • tst_QNetworkReply
1190
306 }-
307-
308 // normal buffer-
309 return QNetworkReply::bytesAvailable();
executed 953 times by 1 test: return QNetworkReply::bytesAvailable();
Executed by:
  • tst_QNetworkReply
953
310}-
311-
312bool QNetworkReplyHttpImpl::isSequential () const-
313{-
314 // FIXME In the cache of a cached load or the zero-copy buffer we could actually be non-sequential.-
315 // FIXME however this requires us to implement stuff like seek() too.-
316 return true;
executed 578 times by 3 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
578
317}-
318-
319qint64 QNetworkReplyHttpImpl::size() const-
320{-
321 // FIXME At some point, this could return a proper value, e.g. if we're non-sequential.-
322 return QNetworkReply::size();
executed 67 times by 1 test: return QNetworkReply::size();
Executed by:
  • tst_QNetworkReply
67
323}-
324-
325qint64 QNetworkReplyHttpImpl::readData(char* data, qint64 maxlen)-
326{-
327 Q_D(QNetworkReplyHttpImpl);-
328-
329 // cacheload device-
330 if (d->cacheLoadDevice) {
d->cacheLoadDeviceDescription
TRUEnever evaluated
FALSEevaluated 1342 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
0-1342
331 // FIXME bytesdownloaded, position etc?-
332-
333 qint64 ret = d->cacheLoadDevice->read(data, maxlen);-
334 return ret;
never executed: return ret;
0
335 }-
336-
337 // zerocopy buffer-
338 if (d->downloadZerocopyBuffer) {
d->downloadZerocopyBufferDescription
TRUEevaluated 576 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 766 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
576-766
339 // FIXME bytesdownloaded, position etc?-
340-
341 qint64 howMuch = qMin(maxlen, (d->downloadBufferCurrentSize - d->downloadBufferReadPosition));-
342 memcpy(data, d->downloadZerocopyBuffer + d->downloadBufferReadPosition, howMuch);-
343 d->downloadBufferReadPosition += howMuch;-
344 return howMuch;
executed 576 times by 2 tests: return howMuch;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
576
345-
346 }-
347-
348 // normal buffer-
349 if (d->state == d->Finished || d->state == d->Aborted)
d->state == d->FinishedDescription
TRUEevaluated 568 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_QNetworkReply
d->state == d->AbortedDescription
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-568
350 return -1;
executed 568 times by 3 tests: return -1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
568
351-
352 qint64 wasBuffered = d->bytesBuffered;-
353 d->bytesBuffered = 0;-
354 if (readBufferSize())
readBufferSize()Description
TRUEevaluated 198 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-198
355 emit readBufferFreed(wasBuffered);
executed 198 times by 1 test: readBufferFreed(wasBuffered);
Executed by:
  • tst_QNetworkReply
198
356 return 0;
executed 198 times by 1 test: return 0;
Executed by:
  • tst_QNetworkReply
198
357}-
358-
359void QNetworkReplyHttpImpl::setReadBufferSize(qint64 size)-
360{-
361 QNetworkReply::setReadBufferSize(size);-
362 emit readBufferSizeChanged(size);-
363 return;
executed 18 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
18
364}-
365-
366bool QNetworkReplyHttpImpl::canReadLine () const-
367{-
368 Q_D(const QNetworkReplyHttpImpl);-
369-
370 if (QNetworkReply::canReadLine())
QNetworkReply::canReadLine()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
1-5
371 return true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QNetworkReply
1
372-
373 if (d->cacheLoadDevice)
d->cacheLoadDeviceDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-5
374 return d->cacheLoadDevice->canReadLine();
never executed: return d->cacheLoadDevice->canReadLine();
0
375-
376 if (d->downloadZerocopyBuffer)
d->downloadZerocopyBufferDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-5
377 return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition);
executed 5 times by 1 test: return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition);
Executed by:
  • tst_QNetworkReply
5
378-
379 return false;
never executed: return false;
0
380}-
381-
382#ifndef QT_NO_SSL-
383void QNetworkReplyHttpImpl::ignoreSslErrors()-
384{-
385 Q_D(QNetworkReplyHttpImpl);-
386-
387 d->pendingIgnoreAllSslErrors = true;-
388}
executed 143 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
143
389-
390void QNetworkReplyHttpImpl::ignoreSslErrorsImplementation(const QList<QSslError> &errors)-
391{-
392 Q_D(QNetworkReplyHttpImpl);-
393-
394 // the pending list is set if QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)-
395 // is called before QNetworkAccessManager::get() (or post(), etc.)-
396 d->pendingIgnoreSslErrorsList = errors;-
397}
executed 10 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
10
398-
399void QNetworkReplyHttpImpl::setSslConfigurationImplementation(const QSslConfiguration &newconfig)-
400{-
401 // Setting a SSL configuration on a reply is not supported. The user needs to set-
402 // her/his QSslConfiguration on the QNetworkRequest.-
403 Q_UNUSED(newconfig);-
404}
never executed: end of block
0
405-
406void QNetworkReplyHttpImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const-
407{-
408 Q_D(const QNetworkReplyHttpImpl);-
409 configuration = d->sslConfiguration;-
410}
executed 211 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
211
411#endif-
412-
413QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate()-
414 : QNetworkReplyPrivate()-
415 , manager(0)-
416 , managerPrivate(0)-
417 , synchronous(false)-
418 , state(Idle)-
419 , statusCode(0)-
420 , uploadByteDevicePosition(false)-
421 , uploadDeviceChoking(false)-
422 , outgoingData(0)-
423 , bytesUploaded(-1)-
424 , cacheLoadDevice(0)-
425 , loadingFromCache(false)-
426 , cacheSaveDevice(0)-
427 , cacheEnabled(false)-
428 , resumeOffset(0)-
429 , preMigrationDownloaded(-1)-
430 , bytesDownloaded(0)-
431 , bytesBuffered(0)-
432 , downloadBufferReadPosition(0)-
433 , downloadBufferCurrentSize(0)-
434 , downloadZerocopyBuffer(0)-
435 , pendingDownloadDataEmissions(QSharedPointer<QAtomicInt>::create())-
436 , pendingDownloadProgressEmissions(QSharedPointer<QAtomicInt>::create())-
437 #ifndef QT_NO_SSL-
438 , pendingIgnoreAllSslErrors(false)-
439 #endif-
440-
441{-
442}
executed 887 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
887
443-
444QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate()-
445{-
446}-
447-
448/*-
449 For a given httpRequest-
450 1) If AlwaysNetwork, return-
451 2) If we have a cache entry for this url populate headers so the server can return 304-
452 3) Calculate if response_is_fresh and if so send the cache and set loadedFromCache to true-
453 */-
454bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &httpRequest)-
455{-
456 QNetworkRequest::CacheLoadControl CacheLoadControlAttribute =-
457 (QNetworkRequest::CacheLoadControl)request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt();-
458 if (CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork) {
CacheLoadContr...:AlwaysNetworkDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 668 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
12-668
459 // If the request does not already specify preferred cache-control-
460 // force reload from the network and tell any caching proxy servers to reload too-
461 if (!request.rawHeaderList().contains("Cache-Control")) {
!request.rawHe...ache-Control")Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-12
462 httpRequest.setHeaderField("Cache-Control", "no-cache");-
463 httpRequest.setHeaderField("Pragma", "no-cache");-
464 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
12
465 return false;
executed 12 times by 2 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
12
466 }-
467-
468 // The disk cache API does not currently support partial content retrieval.-
469 // That is why we don't use the disk cache for any such requests.-
470 if (request.hasRawHeader("Range"))
request.hasRawHeader("Range")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 666 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
2-666
471 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
2
472-
473 QAbstractNetworkCache *nc = managerPrivate->networkCache;-
474 if (!nc)
!ncDescription
TRUEevaluated 579 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 87 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
87-579
475 return false; // no local cache
executed 579 times by 6 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
579
476-
477 QNetworkCacheMetaData metaData = nc->metaData(httpRequest.url());-
478 if (!metaData.isValid())
!metaData.isValid()Description
TRUEevaluated 50 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 37 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
37-50
479 return false; // not in cache
executed 50 times by 3 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
50
480-
481 if (!metaData.saveToDisk())
!metaData.saveToDisk()Description
TRUEnever evaluated
FALSEevaluated 37 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-37
482 return false;
never executed: return false;
0
483-
484 QNetworkHeadersPrivate cacheHeaders;-
485 QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;-
486 cacheHeaders.setAllRawHeaders(metaData.rawHeaders());-
487-
488 it = cacheHeaders.findRawHeader("etag");-
489 if (it != cacheHeaders.rawHeaders.constEnd())
it != cacheHea...ers.constEnd()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 33 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
4-33
490 httpRequest.setHeaderField("If-None-Match", it->second);
executed 4 times by 1 test: httpRequest.setHeaderField("If-None-Match", it->second);
Executed by:
  • tst_QAbstractNetworkCache
4
491-
492 QDateTime lastModified = metaData.lastModified();-
493 if (lastModified.isValid())
lastModified.isValid()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
15-22
494 httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified));
executed 22 times by 2 tests: httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
22
495-
496 it = cacheHeaders.findRawHeader("Cache-Control");-
497 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
15-22
498 QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second);-
499 if (cacheControl.contains("must-revalidate"))
cacheControl.c...t-revalidate")Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
6-16
500 return false;
executed 6 times by 2 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
6
501 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
16
502-
503 QDateTime currentDateTime = QDateTime::currentDateTimeUtc();-
504 QDateTime expirationDate = metaData.expirationDate();-
505-
506 bool response_is_fresh;-
507 if (!expirationDate.isValid()) {
!expirationDate.isValid()Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9-22
508 /*-
509 * age_value-
510 * is the value of Age: header received by the cache with-
511 * this response.-
512 * date_value-
513 * is the value of the origin server's Date: header-
514 * request_time-
515 * is the (local) time when the cache made the request-
516 * that resulted in this cached response-
517 * response_time-
518 * is the (local) time when the cache received the-
519 * response-
520 * now-
521 * is the current (local) time-
522 */-
523 int age_value = 0;-
524 it = cacheHeaders.findRawHeader("age");-
525 if (it != cacheHeaders.rawHeaders.constEnd())
it != cacheHea...ers.constEnd()Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
0-9
526 age_value = it->second.toInt();
never executed: age_value = it->second.toInt();
0
527-
528 QDateTime dateHeader;-
529 int date_value = 0;-
530 it = cacheHeaders.findRawHeader("date");-
531 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkDiskCache
1-8
532 dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second);-
533 date_value = dateHeader.toTime_t();-
534 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
8
535-
536 int now = currentDateTime.toTime_t();-
537 int request_time = now;-
538 int response_time = now;-
539-
540 // Algorithm from RFC 2616 section 13.2.3-
541 int apparent_age = qMax(0, response_time - date_value);-
542 int corrected_received_age = qMax(apparent_age, age_value);-
543 int response_delay = response_time - request_time;-
544 int corrected_initial_age = corrected_received_age + response_delay;-
545 int resident_time = now - response_time;-
546 int current_age = corrected_initial_age + resident_time;-
547-
548 int freshness_lifetime = 0;-
549-
550 // RFC 2616 13.2.4 Expiration Calculations-
551 if (lastModified.isValid() && dateHeader.isValid()) {
lastModified.isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
dateHeader.isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEnever evaluated
0-5
552 int diff = lastModified.secsTo(dateHeader);-
553 freshness_lifetime = diff / 10;-
554 if (httpRequest.headerField("Warning").isEmpty()) {
httpRequest.he...ng").isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEnever evaluated
0-4
555 QDateTime dt = currentDateTime.addSecs(current_age);-
556 if (currentDateTime.daysTo(dt) > 1)
currentDateTime.daysTo(dt) > 1Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-4
557 httpRequest.setHeaderField("Warning", "113");
never executed: httpRequest.setHeaderField("Warning", "113");
0
558 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
4
559 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
4
560-
561 // the cache-saving code below sets the freshness_lifetime with (dateHeader - last_modified) / 10-
562 // if "last-modified" is present, or to Expires otherwise-
563 response_is_fresh = (freshness_lifetime > current_age);-
564 } else {
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
9
565 // expiration date was calculated earlier (e.g. when storing object to the cache)-
566 response_is_fresh = currentDateTime.secsTo(expirationDate) >= 0;-
567 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
22
568-
569 if (!response_is_fresh)
!response_is_freshDescription
TRUEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
13-18
570 return false;
executed 13 times by 3 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
13
571-
572#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
573 qDebug() << "response_is_fresh" << CacheLoadControlAttribute;-
574#endif-
575 return sendCacheContents(metaData);
executed 18 times by 2 tests: return sendCacheContents(metaData);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
18
576}-
577-
578QHttpNetworkRequest::Priority QNetworkReplyHttpImplPrivate::convert(const QNetworkRequest::Priority& prio)-
579{-
580 switch (prio) {-
581 case QNetworkRequest::LowPriority:
never executed: case QNetworkRequest::LowPriority:
0
582 return QHttpNetworkRequest::LowPriority;
never executed: return QHttpNetworkRequest::LowPriority;
0
583 case QNetworkRequest::HighPriority:
never executed: case QNetworkRequest::HighPriority:
0
584 return QHttpNetworkRequest::HighPriority;
never executed: return QHttpNetworkRequest::HighPriority;
0
585 case QNetworkRequest::NormalPriority:
executed 887 times by 8 tests: case QNetworkRequest::NormalPriority:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
887
586 default:
never executed: default:
0
587 return QHttpNetworkRequest::NormalPriority;
executed 887 times by 8 tests: return QHttpNetworkRequest::NormalPriority;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
887
588 }-
589}-
590-
591void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpRequest)-
592{-
593 Q_Q(QNetworkReplyHttpImpl);-
594-
595 QThread *thread = 0;-
596 if (synchronous) {
synchronousDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 814 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
76-814
597 // A synchronous HTTP request uses its own thread-
598 thread = new QThread();-
599 thread->setObjectName(QStringLiteral("Qt HTTP synchronous thread"));
executed 76 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QNetworkReply
76
600 QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));-
601 thread->start();-
602 } else if (!managerPrivate->httpThread) {
executed 76 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
!managerPrivate->httpThreadDescription
TRUEevaluated 471 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 343 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
76-471
603 // We use the manager-global thread.-
604 // At some point we could switch to having multiple threads if it makes sense.-
605 managerPrivate->httpThread = new QThread();-
606 managerPrivate->httpThread->setObjectName(QStringLiteral("Qt HTTP thread"));
executed 471 times by 8 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
471
607 managerPrivate->httpThread->start();-
608-
609 thread = managerPrivate->httpThread;-
610 } else {
executed 471 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
471
611 // Asynchronous request, thread already exists-
612 thread = managerPrivate->httpThread;-
613 }
executed 343 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
343
614-
615 QUrl url = newHttpRequest.url();-
616 httpRequest.setUrl(url);-
617 httpRequest.setRedirectCount(newHttpRequest.maximumRedirectsAllowed());-
618-
619 QString scheme = url.scheme();-
620 bool ssl = (scheme == QLatin1String("https")
scheme == QLat...tring("https")Description
TRUEevaluated 231 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 659 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
231-659
621 || scheme == QLatin1String("preconnect-https"));
scheme == QLat...onnect-https")Description
TRUEnever evaluated
FALSEevaluated 659 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-659
622 q->setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, ssl);-
623 httpRequest.setSsl(ssl);-
624-
625 bool preConnect = (scheme == QLatin1String("preconnect-http")
scheme == QLat...connect-http")Description
TRUEnever evaluated
FALSEevaluated 890 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-890
626 || scheme == QLatin1String("preconnect-https"));
scheme == QLat...onnect-https")Description
TRUEnever evaluated
FALSEevaluated 890 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-890
627 httpRequest.setPreConnect(preConnect);-
628-
629#ifndef QT_NO_NETWORKPROXY-
630 QNetworkProxy transparentProxy, cacheProxy;-
631-
632 // FIXME the proxy stuff should be done in the HTTP thread-
633 const auto proxies = managerPrivate->queryProxy(QNetworkProxyQuery(newHttpRequest.url()));-
634 for (const QNetworkProxy &p : proxies) {-
635 // use the first proxy that works-
636 // for non-encrypted connections, any transparent or HTTP proxy-
637 // for encrypted, only transparent proxies-
638 if (!ssl
!sslDescription
TRUEevaluated 661 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 234 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
234-661
639 && (p.capabilities() & QNetworkProxy::CachingCapability)-
640 && (p.type() == QNetworkProxy::HttpProxy ||
p.type() == QN...oxy::HttpProxyDescription
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QNetworkReply
11-47
641 p.type() == QNetworkProxy::HttpCachingProxy)) {
p.type() == QN...tpCachingProxyDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-8
642 cacheProxy = p;-
643 transparentProxy = QNetworkProxy::NoProxy;-
644 break;
executed 55 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
55
645 }-
646 if (p.isTransparentProxy()) {
p.isTransparentProxy()Description
TRUEevaluated 832 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
8-832
647 transparentProxy = p;-
648 cacheProxy = QNetworkProxy::NoProxy;-
649 break;
executed 832 times by 8 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
832
650 }-
651 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
8
652-
653 // check if at least one of the proxies-
654 if (transparentProxy.type() == QNetworkProxy::DefaultProxy &&
transparentPro...::DefaultProxyDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 887 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
3-887
655 cacheProxy.type() == QNetworkProxy::DefaultProxy) {
cacheProxy.typ...::DefaultProxyDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-3
656 // unsuitable proxies-
657 QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,-
658 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError),-
659 Q_ARG(QString, QNetworkReplyHttpImpl::tr("No suitable proxy found")));-
660 QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);-
661 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
3
662 }-
663#endif-
664-
665 if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool())
newHttpRequest...bute).toBool()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 878 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
9-878
666 httpRequest.setFollowRedirects(true);
executed 9 times by 1 test: httpRequest.setFollowRedirects(true);
Executed by:
  • tst_QNetworkReply
9
667-
668 httpRequest.setPriority(convert(newHttpRequest.priority()));-
669-
670 switch (operation) {-
671 case QNetworkAccessManager::GetOperation:
executed 654 times by 7 tests: case QNetworkAccessManager::GetOperation:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
654
672 httpRequest.setOperation(QHttpNetworkRequest::Get);-
673 if (loadFromCacheIfAllowed(httpRequest))
loadFromCacheI...d(httpRequest)Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 636 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
18-636
674 return; // no need to send the request! :)
executed 18 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
18
675 break;
executed 636 times by 7 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
636
676-
677 case QNetworkAccessManager::HeadOperation:
executed 26 times by 1 test: case QNetworkAccessManager::HeadOperation:
Executed by:
  • tst_QNetworkReply
26
678 httpRequest.setOperation(QHttpNetworkRequest::Head);-
679 if (loadFromCacheIfAllowed(httpRequest))
loadFromCacheI...d(httpRequest)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-26
680 return; // no need to send the request! :)
never executed: return;
0
681 break;
executed 26 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
26
682-
683 case QNetworkAccessManager::PostOperation:
executed 157 times by 3 tests: case QNetworkAccessManager::PostOperation:
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
157
684 invalidateCache();-
685 httpRequest.setOperation(QHttpNetworkRequest::Post);-
686 createUploadByteDevice();-
687 break;
executed 157 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
157
688-
689 case QNetworkAccessManager::PutOperation:
executed 36 times by 2 tests: case QNetworkAccessManager::PutOperation:
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
36
690 invalidateCache();-
691 httpRequest.setOperation(QHttpNetworkRequest::Put);-
692 createUploadByteDevice();-
693 break;
executed 36 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
36
694-
695 case QNetworkAccessManager::DeleteOperation:
executed 7 times by 1 test: case QNetworkAccessManager::DeleteOperation:
Executed by:
  • tst_QNetworkReply
7
696 invalidateCache();-
697 httpRequest.setOperation(QHttpNetworkRequest::Delete);-
698 break;
executed 7 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
7
699-
700 case QNetworkAccessManager::CustomOperation:
executed 7 times by 1 test: case QNetworkAccessManager::CustomOperation:
Executed by:
  • tst_QNetworkReply
7
701 invalidateCache(); // for safety reasons, we don't know what the operation does-
702 httpRequest.setOperation(QHttpNetworkRequest::Custom);-
703 createUploadByteDevice();-
704 httpRequest.setCustomVerb(newHttpRequest.attribute(-
705 QNetworkRequest::CustomVerbAttribute).toByteArray());-
706 break;
executed 7 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
7
707-
708 default:
never executed: default:
0
709 break; // can't happen
never executed: break;
0
710 }-
711-
712 QList<QByteArray> headers = newHttpRequest.rawHeaderList();-
713 if (resumeOffset != 0) {
resumeOffset != 0Description
TRUEnever evaluated
FALSEevaluated 869 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-869
714 const int rangeIndex = headers.indexOf("Range");-
715 if (rangeIndex != -1) {
rangeIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
716 // Need to adjust resume offset for user specified range-
717-
718 headers.removeAt(rangeIndex);-
719-
720 // We've already verified that requestRange starts with "bytes=", see canResume.-
721 QByteArray requestRange = newHttpRequest.rawHeader("Range").mid(6);-
722-
723 int index = requestRange.indexOf('-');-
724-
725 quint64 requestStartOffset = requestRange.left(index).toULongLong();-
726 quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong();-
727-
728 requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) +-
729 '-' + QByteArray::number(requestEndOffset);-
730-
731 httpRequest.setHeaderField("Range", requestRange);-
732 } else {
never executed: end of block
0
733 httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-');-
734 }
never executed: end of block
0
735 }-
736-
737 for (const QByteArray &header : qAsConst(headers))-
738 httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header));
executed 319 times by 3 tests: httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header));
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
319
739-
740 if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool())
newHttpRequest...bute).toBool()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 849 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
20-849
741 httpRequest.setPipeliningAllowed(true);
executed 20 times by 1 test: httpRequest.setPipeliningAllowed(true);
Executed by:
  • tst_QNetworkReply
20
742-
743 if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool())
request.attrib...bute).toBool()Description
TRUEevaluated 113 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 756 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
113-756
744 httpRequest.setSPDYAllowed(true);
executed 113 times by 1 test: httpRequest.setSPDYAllowed(true);
Executed by:
  • tst_Spdy
113
745-
746 if (static_cast<QNetworkRequest::LoadControl>
static_cast<QN...equest::ManualDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 868 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1-868
747 (newHttpRequest.attribute(QNetworkRequest::AuthenticationReuseAttribute,
static_cast<QN...equest::ManualDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 868 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1-868
748 QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
static_cast<QN...equest::ManualDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 868 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1-868
749 httpRequest.setWithCredentials(false);
executed 1 time by 1 test: httpRequest.setWithCredentials(false);
Executed by:
  • tst_QNetworkReply
1
750-
751 if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool())
request.attrib...bute).toBool()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 868 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1-868
752 emitAllUploadProgressSignals = true;
executed 1 time by 1 test: emitAllUploadProgressSignals = true;
Executed by:
  • tst_QNetworkReply
1
753-
754-
755 // Create the HTTP thread delegate-
756 QHttpThreadDelegate *delegate = new QHttpThreadDelegate;-
757#ifndef QT_NO_BEARERMANAGEMENT-
758 delegate->networkSession = managerPrivate->getNetworkSession();-
759#endif-
760-
761 // For the synchronous HTTP, this is the normal way the delegate gets deleted-
762 // For the asynchronous HTTP this is a safety measure, the delegate deletes itself when HTTP is finished-
763 QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater()));-
764-
765 // Set the properties it needs-
766 delegate->httpRequest = httpRequest;-
767#ifndef QT_NO_NETWORKPROXY-
768 delegate->cacheProxy = cacheProxy;-
769 delegate->transparentProxy = transparentProxy;-
770#endif-
771 delegate->ssl = ssl;-
772#ifndef QT_NO_SSL-
773 if (ssl)
sslDescription
TRUEevaluated 229 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 640 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
229-640
774 delegate->incomingSslConfiguration = newHttpRequest.sslConfiguration();
executed 229 times by 2 tests: delegate->incomingSslConfiguration = newHttpRequest.sslConfiguration();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
229
775#endif-
776-
777 // Do we use synchronous HTTP?-
778 delegate->synchronous = synchronous;-
779-
780 // The authentication manager is used to avoid the BlockingQueuedConnection communication-
781 // from HTTP thread to user thread in some cases.-
782 delegate->authenticationManager = managerPrivate->authenticationManager;-
783-
784 if (!synchronous) {
!synchronousDescription
TRUEevaluated 793 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
76-793
785 // Tell our zerocopy policy to the delegate-
786 QVariant downloadBufferMaximumSizeAttribute = newHttpRequest.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute);-
787 if (downloadBufferMaximumSizeAttribute.isValid()) {
downloadBuffer...bute.isValid()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 786 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
7-786
788 delegate->downloadBufferMaximumSize = downloadBufferMaximumSizeAttribute.toLongLong();-
789 } else {
executed 7 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
7
790 // If there is no MaximumDownloadBufferSizeAttribute set (which is for the majority-
791 // of QNetworkRequest) then we can assume we'll do it anyway for small HTTP replies.-
792 // This helps with performance and memory fragmentation.-
793 delegate->downloadBufferMaximumSize = 128*1024;-
794 }
executed 786 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
786
795-
796-
797 // These atomic integers are used for signal compression-
798 delegate->pendingDownloadData = pendingDownloadDataEmissions;-
799 delegate->pendingDownloadProgress = pendingDownloadProgressEmissions;-
800-
801 // Connect the signals of the delegate to us-
802 QObject::connect(delegate, SIGNAL(downloadData(QByteArray)),-
803 q, SLOT(replyDownloadData(QByteArray)),-
804 Qt::QueuedConnection);-
805 QObject::connect(delegate, SIGNAL(downloadFinished()),-
806 q, SLOT(replyFinished()),-
807 Qt::QueuedConnection);-
808 QObject::connect(delegate, SIGNAL(downloadMetaData(QList<QPair<QByteArray,QByteArray> >,-
809 int, QString, bool,-
810 QSharedPointer<char>, qint64, bool)),-
811 q, SLOT(replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,-
812 int, QString, bool,-
813 QSharedPointer<char>, qint64, bool)),-
814 Qt::QueuedConnection);-
815 QObject::connect(delegate, SIGNAL(downloadProgress(qint64,qint64)),-
816 q, SLOT(replyDownloadProgressSlot(qint64,qint64)),-
817 Qt::QueuedConnection);-
818 QObject::connect(delegate, SIGNAL(error(QNetworkReply::NetworkError,QString)),-
819 q, SLOT(httpError(QNetworkReply::NetworkError,QString)),-
820 Qt::QueuedConnection);-
821 QObject::connect(delegate, SIGNAL(redirected(QUrl,int,int)),-
822 q, SLOT(onRedirected(QUrl,int,int)),-
823 Qt::QueuedConnection);-
824#ifndef QT_NO_SSL-
825 QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)),-
826 q, SLOT(replySslConfigurationChanged(QSslConfiguration)),-
827 Qt::QueuedConnection);-
828#endif-
829 // Those need to report back, therefire BlockingQueuedConnection-
830 QObject::connect(delegate, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)),-
831 q, SLOT(httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)),-
832 Qt::BlockingQueuedConnection);-
833#ifndef QT_NO_NETWORKPROXY-
834 QObject::connect(delegate, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),-
835 q, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),-
836 Qt::BlockingQueuedConnection);-
837#endif-
838#ifndef QT_NO_SSL-
839 QObject::connect(delegate, SIGNAL(encrypted()), q, SLOT(replyEncrypted()),-
840 Qt::BlockingQueuedConnection);-
841 QObject::connect(delegate, SIGNAL(sslErrors(QList<QSslError>,bool*,QList<QSslError>*)),-
842 q, SLOT(replySslErrors(QList<QSslError>,bool*,QList<QSslError>*)),-
843 Qt::BlockingQueuedConnection);-
844 QObject::connect(delegate, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)),-
845 q, SLOT(replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*)),-
846 Qt::BlockingQueuedConnection);-
847#endif-
848 // This signal we will use to start the request.-
849 QObject::connect(q, SIGNAL(startHttpRequest()), delegate, SLOT(startRequest()));-
850 QObject::connect(q, SIGNAL(abortHttpRequest()), delegate, SLOT(abortRequest()));-
851-
852 // To throttle the connection.-
853 QObject::connect(q, SIGNAL(readBufferSizeChanged(qint64)), delegate, SLOT(readBufferSizeChanged(qint64)));-
854 QObject::connect(q, SIGNAL(readBufferFreed(qint64)), delegate, SLOT(readBufferFreed(qint64)));-
855-
856 if (uploadByteDevice) {
uploadByteDeviceDescription
TRUEevaluated 155 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 638 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
155-638
857 QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice =-
858 new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size());-
859 forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread()-
860 delegate->httpRequest.setUploadByteDevice(forwardUploadDevice);-
861-
862 // If the device in the user thread claims it has more data, keep the flow to HTTP thread going-
863 QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),-
864 q, SLOT(uploadByteDeviceReadyReadSlot()),-
865 Qt::QueuedConnection);-
866-
867 // From user thread to http thread:-
868 QObject::connect(q, SIGNAL(haveUploadData(qint64,QByteArray,bool,qint64)),-
869 forwardUploadDevice, SLOT(haveDataSlot(qint64,QByteArray,bool,qint64)), Qt::QueuedConnection);-
870 QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),-
871 forwardUploadDevice, SIGNAL(readyRead()),-
872 Qt::QueuedConnection);-
873-
874 // From http thread to user thread:-
875 QObject::connect(forwardUploadDevice, SIGNAL(wantData(qint64)),-
876 q, SLOT(wantUploadDataSlot(qint64)));-
877 QObject::connect(forwardUploadDevice,SIGNAL(processedData(qint64, qint64)),-
878 q, SLOT(sentUploadDataSlot(qint64,qint64)));-
879 QObject::connect(forwardUploadDevice, SIGNAL(resetData(bool*)),-
880 q, SLOT(resetUploadDataSlot(bool*)),-
881 Qt::BlockingQueuedConnection); // this is the only one with BlockingQueued!-
882 }
executed 155 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
155
883 } else if (synchronous) {
executed 793 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
synchronousDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-793
884 QObject::connect(q, SIGNAL(startHttpRequestSynchronously()), delegate, SLOT(startRequestSynchronously()), Qt::BlockingQueuedConnection);-
885-
886 if (uploadByteDevice) {
uploadByteDeviceDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QNetworkReply
35-41
887 // For the synchronous HTTP use case the use thread (this one here) is blocked-
888 // so we cannot use the asynchronous upload architecture.-
889 // We therefore won't use the QNonContiguousByteDeviceThreadForwardImpl but directly-
890 // use the uploadByteDevice provided to us by the QNetworkReplyImpl.-
891 // The code that is in start() makes sure it is safe to use from a thread-
892 // since it only wraps a QRingBuffer-
893 delegate->httpRequest.setUploadByteDevice(uploadByteDevice.data());-
894 }
executed 41 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
41
895 }
executed 76 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
76
896-
897-
898 // Move the delegate to the http thread-
899 delegate->moveToThread(thread);-
900 // This call automatically moves the uploadDevice too for the asynchronous case.-
901-
902 // Prepare timers for progress notifications-
903 downloadProgressSignalChoke.start();-
904 uploadProgressSignalChoke.invalidate();-
905-
906 // Send an signal to the delegate so it starts working in the other thread-
907 if (synchronous) {
synchronousDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 793 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
76-793
908 emit q->startHttpRequestSynchronously(); // This one is BlockingQueuedConnection, so it will return when all work is done-
909-
910 if (delegate->incomingErrorCode != QNetworkReply::NoError) {
delegate->inco...Reply::NoErrorDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 63 times by 1 test
Evaluated by:
  • tst_QNetworkReply
13-63
911 replyDownloadMetaData-
912 (delegate->incomingHeaders,-
913 delegate->incomingStatusCode,-
914 delegate->incomingReasonPhrase,-
915 delegate->isPipeliningUsed,-
916 QSharedPointer<char>(),-
917 delegate->incomingContentLength,-
918 delegate->isSpdyUsed);-
919 replyDownloadData(delegate->synchronousDownloadData);-
920 httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail);-
921 } else {
executed 13 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
13
922 replyDownloadMetaData-
923 (delegate->incomingHeaders,-
924 delegate->incomingStatusCode,-
925 delegate->incomingReasonPhrase,-
926 delegate->isPipeliningUsed,-
927 QSharedPointer<char>(),-
928 delegate->incomingContentLength,-
929 delegate->isSpdyUsed);-
930 replyDownloadData(delegate->synchronousDownloadData);-
931 }
executed 63 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
63
932-
933 thread->quit();-
934 thread->wait(5000);-
935 if (thread->isFinished())
thread->isFinished()Description
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-76
936 delete thread;
executed 76 times by 1 test: delete thread;
Executed by:
  • tst_QNetworkReply
76
937 else-
938 QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
never executed: QObject::connect(thread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "938"), thread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "938"));
0
939-
940 finished();-
941 } else {
executed 76 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
76
942 emit q->startHttpRequest(); // Signal to the HTTP thread and go back to user.-
943 }
executed 793 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
793
944}-
945-
946void QNetworkReplyHttpImplPrivate::invalidateCache()-
947{-
948 QAbstractNetworkCache *nc = managerPrivate->networkCache;-
949 if (nc)
ncDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 205 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2-205
950 nc->remove(httpRequest.url());
executed 2 times by 1 test: nc->remove(httpRequest.url());
Executed by:
  • tst_QNetworkReply
2
951}
executed 207 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
207
952-
953void QNetworkReplyHttpImplPrivate::initCacheSaveDevice()-
954{-
955 Q_Q(QNetworkReplyHttpImpl);-
956-
957 // The disk cache does not support partial content, so don't even try to-
958 // save any such content into the cache.-
959 if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) {
q->attribute(Q...toInt() == 206Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 61 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
1-61
960 cacheEnabled = false;-
961 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
962 }-
963-
964 // save the meta data-
965 QNetworkCacheMetaData metaData;-
966 metaData.setUrl(url);-
967 metaData = fetchCacheMetaData(metaData);-
968-
969 // save the redirect request also in the cache-
970 QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute);-
971 if (redirectionTarget.isValid()) {
redirectionTarget.isValid()Description
TRUEnever evaluated
FALSEevaluated 61 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-61
972 QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes();-
973 attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);-
974 metaData.setAttributes(attributes);-
975 }
never executed: end of block
0
976-
977 cacheSaveDevice = managerPrivate->networkCache->prepare(metaData);-
978-
979 if (cacheSaveDevice)
cacheSaveDeviceDescription
TRUEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
7-54
980 q->connect(cacheSaveDevice, SIGNAL(aboutToClose()), SLOT(_q_cacheSaveDeviceAboutToClose()));
executed 54 times by 3 tests: q->connect(cacheSaveDevice, qFlagLocation("2""aboutToClose()" "\0" __FILE__ ":" "980"), qFlagLocation("1""_q_cacheSaveDeviceAboutToClose()" "\0" __FILE__ ":" "980"));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
54
981-
982 if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) {
!cacheSaveDeviceDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
cacheSaveDeviceDescription
TRUEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEnever evaluated
!cacheSaveDevice->isOpen()Description
TRUEnever evaluated
FALSEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-54
983 if (Q_UNLIKELY(cacheSaveDevice && !cacheSaveDevice->isOpen()))
__builtin_expe...pen()), false)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-7
984 qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- "
never executed: QMessageLogger(__FILE__, 984, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className());
0
985 "class %s probably needs to be fixed",
never executed: QMessageLogger(__FILE__, 984, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className());
0
986 managerPrivate->networkCache->metaObject()->className());
never executed: QMessageLogger(__FILE__, 984, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className());
0
987-
988 managerPrivate->networkCache->remove(url);-
989 cacheSaveDevice = 0;-
990 cacheEnabled = false;-
991 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
7
992}
executed 61 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
61
993-
994void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)-
995{-
996 Q_Q(QNetworkReplyHttpImpl);-
997-
998 // If we're closed just ignore this data-
999 if (!q->isOpen())
!q->isOpen()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6556 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
1-6556
1000 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
1001-
1002 int pendingSignals = (int)pendingDownloadDataEmissions->fetchAndAddAcquire(-1) - 1;-
1003-
1004 if (pendingSignals > 0) {
pendingSignals > 0Description
TRUEevaluated 1275 times by 3 tests
Evaluated by:
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 5281 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
1275-5281
1005 // Some more signal emissions to this slot are pending.-
1006 // Instead of writing the downstream data, we wait-
1007 // and do it in the next call we get-
1008 // (signal comppression)-
1009 pendingDownloadData.append(d);-
1010 return;
executed 1275 times by 3 tests: return;
Executed by:
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
1275
1011 }-
1012-
1013 pendingDownloadData.append(d);-
1014 d.clear();-
1015 // We need to usa a copy for calling writeDownstreamData as we could-
1016 // possibly recurse into this this function when we call-
1017 // appendDownstreamDataSignalEmissions because the user might call-
1018 // processEvents() or spin an event loop when this occur.-
1019 QByteDataBuffer pendingDownloadDataCopy = pendingDownloadData;-
1020 pendingDownloadData.clear();-
1021-
1022 if (cacheEnabled && isCachingAllowed() && !cacheSaveDevice) {
cacheEnabledDescription
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 5236 times by 3 tests
Evaluated by:
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
isCachingAllowed()Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
!cacheSaveDeviceDescription
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-5236
1023 initCacheSaveDevice();-
1024 }
executed 45 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
45
1025-
1026 qint64 bytesWritten = 0;-
1027 for (int i = 0; i < pendingDownloadDataCopy.bufferCount(); i++) {
i < pendingDow....bufferCount()Description
TRUEevaluated 6554 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 5281 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
5281-6554
1028 QByteArray const &item = pendingDownloadDataCopy[i];-
1029-
1030 // This is going to look a little strange. When downloading data while a-
1031 // HTTP redirect is happening (and enabled), we write the redirect-
1032 // response to the cache. However, we do not append it to our internal-
1033 // buffer as that will contain the response data only for the final-
1034 // response-
1035 if (cacheSaveDevice)
cacheSaveDeviceDescription
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 6510 times by 3 tests
Evaluated by:
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
44-6510
1036 cacheSaveDevice->write(item.constData(), item.size());
executed 44 times by 2 tests: cacheSaveDevice->write(item.constData(), item.size());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
44
1037-
1038 if (!isHttpRedirectResponse())
!isHttpRedirectResponse()Description
TRUEevaluated 6554 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-6554
1039 buffer.append(item);
executed 6554 times by 4 tests: buffer.append(item);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
6554
1040-
1041 bytesWritten += item.size();-
1042 }
executed 6554 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
6554
1043 bytesBuffered += bytesWritten;-
1044 pendingDownloadDataCopy.clear();-
1045-
1046 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
1047 if (preMigrationDownloaded != Q_INT64_C(-1))
preMigrationDo...ng long>(-1LL)Description
TRUEnever evaluated
FALSEevaluated 5281 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
0-5281
1048 totalSize = totalSize.toLongLong() + preMigrationDownloaded;
never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded;
0
1049-
1050 if (isHttpRedirectResponse())
isHttpRedirectResponse()Description
TRUEnever evaluated
FALSEevaluated 5281 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
0-5281
1051 return;
never executed: return;
0
1052-
1053 bytesDownloaded += bytesWritten;-
1054-
1055 emit q->readyRead();-
1056 // emit readyRead before downloadProgress incase this will cause events to be-
1057 // processed and we get into a recursive call (as in QProgressDialog).-
1058 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgre...SignalIntervalDescription
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 5232 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
49-5232
1059 downloadProgressSignalChoke.restart();-
1060 emit q->downloadProgress(bytesDownloaded,-
1061 totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());-
1062 }
executed 49 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
49
1063-
1064}
executed 5281 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
5281
1065-
1066void QNetworkReplyHttpImplPrivate::replyFinished()-
1067{-
1068 // We are already loading from cache, we still however-
1069 // got this signal because it was posted already-
1070 if (loadingFromCache)
loadingFromCacheDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 756 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
5-756
1071 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QAbstractNetworkCache
5
1072-
1073 finished();-
1074}
executed 756 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
756
1075-
1076QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperation(QNetworkAccessManager::Operation currentOp, int httpStatus)-
1077{-
1078 // HTTP status code can be used to decide if we can redirect with a GET-
1079 // operation or not. See http://www.ietf.org/rfc/rfc2616.txt [Sec 10.3] for-
1080 // more details-
1081 Q_UNUSED(httpStatus);-
1082-
1083 switch (currentOp) {-
1084 case QNetworkAccessManager::HeadOperation:
never executed: case QNetworkAccessManager::HeadOperation:
0
1085 return QNetworkAccessManager::HeadOperation;
never executed: return QNetworkAccessManager::HeadOperation;
0
1086 default:
executed 5 times by 1 test: default:
Executed by:
  • tst_QNetworkReply
5
1087 break;
executed 5 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
5
1088 }-
1089 // For now, we're always returning GET for anything other than HEAD-
1090 return QNetworkAccessManager::GetOperation;
executed 5 times by 1 test: return QNetworkAccessManager::GetOperation;
Executed by:
  • tst_QNetworkReply
5
1091}-
1092-
1093bool QNetworkReplyHttpImplPrivate::isHttpRedirectResponse() const-
1094{-
1095 return httpRequest.isFollowRedirects() && QHttpNetworkReply::isHttpRedirect(statusCode);
executed 14865 times by 7 tests: return httpRequest.isFollowRedirects() && QHttpNetworkReply::isHttpRedirect(statusCode);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
14865
1096}-
1097-
1098QNetworkRequest QNetworkReplyHttpImplPrivate::createRedirectRequest(const QNetworkRequest &originalRequest,-
1099 const QUrl &url,-
1100 int maxRedirectsRemaining)-
1101{-
1102 QNetworkRequest newRequest(originalRequest);-
1103 newRequest.setUrl(url);-
1104 newRequest.setMaximumRedirectsAllowed(maxRedirectsRemaining);-
1105-
1106 return newRequest;
executed 5 times by 1 test: return newRequest;
Executed by:
  • tst_QNetworkReply
5
1107}-
1108-
1109void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int httpStatus, int maxRedirectsRemaining)-
1110{-
1111 Q_Q(QNetworkReplyHttpImpl);-
1112-
1113 if (isFinished)
isFinishedDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-5
1114 return;
never executed: return;
0
1115-
1116 if (httpRequest.isFollowRedirects()) // update the reply's url as it could've changed
httpRequest.is...lowRedirects()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-5
1117 url = redirectUrl;
executed 5 times by 1 test: url = redirectUrl;
Executed by:
  • tst_QNetworkReply
5
1118-
1119 QNetworkRequest redirectRequest = createRedirectRequest(originalRequest, redirectUrl, maxRedirectsRemaining);-
1120 operation = getRedirectOperation(operation, httpStatus);-
1121-
1122 cookedHeaders.clear();-
1123-
1124 if (managerPrivate->httpThread)
managerPrivate->httpThreadDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-5
1125 managerPrivate->httpThread->disconnect();
executed 5 times by 1 test: managerPrivate->httpThread->disconnect();
Executed by:
  • tst_QNetworkReply
5
1126-
1127 // Recurse-
1128 QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection,-
1129 Q_ARG(QNetworkRequest, redirectRequest));-
1130-
1131 emit q->redirected(redirectUrl);-
1132}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
5
1133-
1134void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode)-
1135{-
1136 Q_Q(QNetworkReplyHttpImpl);-
1137 switch (statusCode) {-
1138 case 301: // Moved Permanently
executed 3 times by 1 test: case 301:
Executed by:
  • tst_QNetworkProxyFactory
3
1139 case 302: // Found
never executed: case 302:
0
1140 case 303: // See Other
never executed: case 303:
0
1141 case 307: // Temporary Redirect
never executed: case 307:
0
1142 // What do we do about the caching of the HTML note?-
1143 // The response to a 303 MUST NOT be cached, while the response to-
1144 // all of the others is cacheable if the headers indicate it to be-
1145 QByteArray header = q->rawHeader("location");-
1146 QUrl url = QUrl(QString::fromUtf8(header));-
1147 if (!url.isValid())
!url.isValid()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
0-3
1148 url = QUrl(QLatin1String(header));
never executed: url = QUrl(QLatin1String(header));
0
1149 q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, url);-
1150 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QNetworkProxyFactory
3
1151}
executed 817 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
817
1152-
1153void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByteArray,QByteArray> > &hm,-
1154 int sc, const QString &rp, bool pu,-
1155 QSharedPointer<char> db,-
1156 qint64 contentLength, bool spdyWasUsed)-
1157{-
1158 Q_Q(QNetworkReplyHttpImpl);-
1159 Q_UNUSED(contentLength);-
1160-
1161 statusCode = sc;-
1162 reasonPhrase = rp;-
1163-
1164 // Download buffer-
1165 if (!db.isNull()) {
!db.isNull()Description
TRUEevaluated 364 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 432 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
364-432
1166 downloadBufferPointer = db;-
1167 downloadZerocopyBuffer = downloadBufferPointer.data();-
1168 downloadBufferCurrentSize = 0;-
1169 q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer));-
1170 }
executed 364 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
364
1171-
1172 q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);-
1173 q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);-
1174-
1175 // reconstruct the HTTP header-
1176 QList<QPair<QByteArray, QByteArray> > headerMap = hm;-
1177 QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(),-
1178 end = headerMap.constEnd();-
1179 for (; it != end; ++it) {
it != endDescription
TRUEevaluated 5050 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 796 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
796-5050
1180 QByteArray value = q->rawHeader(it->first);-
1181-
1182 // Reset any previous "location" header set in the reply. In case of-
1183 // redirects, we don't want to 'append' multiple location header values,-
1184 // rather we keep only the latest one-
1185 if (it->first.toLower() == "location")
it->first.toLo... == "location"Description
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEevaluated 5007 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
43-5007
1186 value.clear();
executed 43 times by 2 tests: value.clear();
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
43
1187-
1188 if (!value.isEmpty()) {
!value.isEmpty()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 5045 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
5-5045
1189 // Why are we appending values for headers which are already-
1190 // present?-
1191 if (qstricmp(it->first.constData(), "set-cookie") == 0)
qstricmp(it->f...-cookie") == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
2-3
1192 value += '\n';
executed 2 times by 1 test: value += '\n';
Executed by:
  • tst_QNetworkReply
2
1193 else-
1194 value += ", ";
executed 3 times by 1 test: value += ", ";
Executed by:
  • tst_QNetworkReply
3
1195 }-
1196 value += it->second;-
1197 q->setRawHeader(it->first, value);-
1198 }
executed 5050 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
5050
1199-
1200 q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode);-
1201 q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase);-
1202-
1203 // is it a redirection?-
1204 if (!isHttpRedirectResponse())
!isHttpRedirectResponse()Description
TRUEevaluated 790 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
6-790
1205 checkForRedirect(statusCode);
executed 790 times by 6 tests: checkForRedirect(statusCode);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
790
1206-
1207 if (statusCode >= 500 && statusCode < 600) {
statusCode >= 500Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 795 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
statusCode < 600Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-795
1208 QAbstractNetworkCache *nc = managerPrivate->networkCache;-
1209 if (nc) {
ncDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1
1210 QNetworkCacheMetaData metaData = nc->metaData(httpRequest.url());-
1211 QNetworkHeadersPrivate cacheHeaders;-
1212 cacheHeaders.setAllRawHeaders(metaData.rawHeaders());-
1213 QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;-
1214 it = cacheHeaders.findRawHeader("Cache-Control");-
1215 bool mustReValidate = false;-
1216 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1217 QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second);-
1218 if (cacheControl.contains("must-revalidate"))
cacheControl.c...t-revalidate")Description
TRUEnever evaluated
FALSEnever evaluated
0
1219 mustReValidate = true;
never executed: mustReValidate = true;
0
1220 }
never executed: end of block
0
1221 if (!mustReValidate && sendCacheContents(metaData))
!mustReValidateDescription
TRUEnever evaluated
FALSEnever evaluated
sendCacheContents(metaData)Description
TRUEnever evaluated
FALSEnever evaluated
0
1222 return;
never executed: return;
0
1223 }
never executed: end of block
0
1224 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
1225-
1226 if (statusCode == 304) {
statusCode == 304Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
9-787
1227#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
1228 qDebug() << "Received a 304 from" << request.url();-
1229#endif-
1230 QAbstractNetworkCache *nc = managerPrivate->networkCache;-
1231 if (nc) {
ncDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-9
1232 QNetworkCacheMetaData oldMetaData = nc->metaData(httpRequest.url());-
1233 QNetworkCacheMetaData metaData = fetchCacheMetaData(oldMetaData);-
1234 if (oldMetaData != metaData)
oldMetaData != metaDataDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-9
1235 nc->updateMetaData(metaData);
executed 9 times by 2 tests: nc->updateMetaData(metaData);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
1236 if (sendCacheContents(metaData))
sendCacheContents(metaData)Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-9
1237 return;
executed 9 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
1238 }
never executed: end of block
0
1239 }
never executed: end of block
0
1240-
1241-
1242 if (statusCode != 304 && statusCode != 303) {
statusCode != 304Description
TRUEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
statusCode != 303Description
TRUEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-787
1243 if (!isCachingEnabled())
!isCachingEnabled()Description
TRUEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-787
1244 setCachingEnabled(true);
executed 787 times by 6 tests: setCachingEnabled(true);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
787
1245 }
executed 787 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
787
1246-
1247 _q_metaDataChanged();-
1248}
executed 787 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
787
1249-
1250void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceived, qint64 bytesTotal)-
1251{-
1252 Q_Q(QNetworkReplyHttpImpl);-
1253-
1254 // If we're closed just ignore this data-
1255 if (!q->isOpen())
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 1489 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-1489
1256 return;
never executed: return;
0
1257-
1258 // we can be sure here that there is a download buffer-
1259-
1260 int pendingSignals = (int)pendingDownloadProgressEmissions->fetchAndAddAcquire(-1) - 1;-
1261 if (pendingSignals > 0) {
pendingSignals > 0Description
TRUEevaluated 205 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
205-1284
1262 // Let's ignore this signal and look at the next one coming in-
1263 // (signal comppression)-
1264 return;
executed 205 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
205
1265 }-
1266-
1267 if (!q->isOpen())
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 1284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-1284
1268 return;
never executed: return;
0
1269-
1270 if (cacheEnabled && isCachingAllowed() && bytesReceived == bytesTotal) {
cacheEnabledDescription
TRUEevaluated 19 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 1265 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
isCachingAllowed()Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
bytesReceived == bytesTotalDescription
TRUEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkDiskCache
1-1265
1271 // Write everything in one go if we use a download buffer. might be more performant.-
1272 initCacheSaveDevice();-
1273 // need to check again if cache enabled and device exists-
1274 if (cacheSaveDevice && cacheEnabled)
cacheSaveDeviceDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
cacheEnabledDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEnever evaluated
0-10
1275 cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal);
executed 10 times by 2 tests: cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
10
1276 // FIXME where is it closed?-
1277 }
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
17
1278-
1279 if (isHttpRedirectResponse())
isHttpRedirectResponse()Description
TRUEnever evaluated
FALSEevaluated 1284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-1284
1280 return;
never executed: return;
0
1281-
1282 bytesDownloaded = bytesReceived;-
1283-
1284 downloadBufferCurrentSize = bytesReceived;-
1285-
1286 // Only emit readyRead when actual data is there-
1287 // emit readyRead before downloadProgress incase this will cause events to be-
1288 // processed and we get into a recursive call (as in QProgressDialog).-
1289 if (bytesDownloaded > 0)
bytesDownloaded > 0Description
TRUEevaluated 1284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEnever evaluated
0-1284
1290 emit q->readyRead();
executed 1284 times by 3 tests: q->readyRead();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
1284
1291 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgre...SignalIntervalDescription
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1226 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
58-1226
1292 downloadProgressSignalChoke.restart();-
1293 emit q->downloadProgress(bytesDownloaded, bytesTotal);-
1294 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
58
1295}
executed 1284 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
1284
1296-
1297void QNetworkReplyHttpImplPrivate::httpAuthenticationRequired(const QHttpNetworkRequest &request,-
1298 QAuthenticator *auth)-
1299{-
1300 managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication, request.withCredentials());-
1301}
executed 124 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
124
1302-
1303#ifndef QT_NO_NETWORKPROXY-
1304void QNetworkReplyHttpImplPrivate::proxyAuthenticationRequired(const QNetworkProxy &proxy,-
1305 QAuthenticator *authenticator)-
1306{-
1307 managerPrivate->proxyAuthenticationRequired(request.url(), proxy, synchronous, authenticator, &lastProxyAuthentication);-
1308}
executed 68 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
68
1309#endif-
1310-
1311void QNetworkReplyHttpImplPrivate::httpError(QNetworkReply::NetworkError errorCode,-
1312 const QString &errorString)-
1313{-
1314#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
1315 qDebug() << "http error!" << errorCode << errorString;-
1316#endif-
1317-
1318 // FIXME?-
1319 error(errorCode, errorString);-
1320}
executed 112 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
112
1321-
1322#ifndef QT_NO_SSL-
1323void QNetworkReplyHttpImplPrivate::replyEncrypted()-
1324{-
1325 Q_Q(QNetworkReplyHttpImpl);-
1326 emit q->encrypted();-
1327}
executed 75 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
75
1328-
1329void QNetworkReplyHttpImplPrivate::replySslErrors(-
1330 const QList<QSslError> &list, bool *ignoreAll, QList<QSslError> *toBeIgnored)-
1331{-
1332 Q_Q(QNetworkReplyHttpImpl);-
1333 emit q->sslErrors(list);-
1334 // Check if the callback set any ignore and return this here to http thread-
1335 if (pendingIgnoreAllSslErrors)
pendingIgnoreAllSslErrorsDescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
16-32
1336 *ignoreAll = true;
executed 32 times by 2 tests: *ignoreAll = true;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
32
1337 if (!pendingIgnoreSslErrorsList.isEmpty())
!pendingIgnore...List.isEmpty()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
6-42
1338 *toBeIgnored = pendingIgnoreSslErrorsList;
executed 6 times by 1 test: *toBeIgnored = pendingIgnoreSslErrorsList;
Executed by:
  • tst_QNetworkReply
6
1339}
executed 48 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
48
1340-
1341void QNetworkReplyHttpImplPrivate::replySslConfigurationChanged(const QSslConfiguration &sslConfiguration)-
1342{-
1343 // Receiving the used SSL configuration from the HTTP thread-
1344 this->sslConfiguration = sslConfiguration;-
1345}
executed 526 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
526
1346-
1347void QNetworkReplyHttpImplPrivate::replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator)-
1348{-
1349 Q_Q(QNetworkReplyHttpImpl);-
1350 emit q->preSharedKeyAuthenticationRequired(authenticator);-
1351}
never executed: end of block
0
1352#endif-
1353-
1354// Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread-
1355void QNetworkReplyHttpImplPrivate::resetUploadDataSlot(bool *r)-
1356{-
1357 *r = uploadByteDevice->reset();-
1358 if (*r) {
*rDescription
TRUEevaluated 126 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-126
1359 // reset our own position which is used for the inter-thread communication-
1360 uploadByteDevicePosition = 0;-
1361 }
executed 126 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
126
1362}
executed 127 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
127
1363-
1364// Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread-
1365void QNetworkReplyHttpImplPrivate::sentUploadDataSlot(qint64 pos, qint64 amount)-
1366{-
1367 if (uploadByteDevicePosition + amount != pos) {
uploadByteDevi... amount != posDescription
TRUEnever evaluated
FALSEevaluated 2695 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-2695
1368 // Sanity check, should not happen.-
1369 error(QNetworkReply::UnknownNetworkError, QString());-
1370 return;
never executed: return;
0
1371 }-
1372 uploadByteDevice->advanceReadPointer(amount);-
1373 uploadByteDevicePosition += amount;-
1374}
executed 2695 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
2695
1375-
1376// Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread-
1377void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize)-
1378{-
1379 Q_Q(QNetworkReplyHttpImpl);-
1380-
1381 // call readPointer-
1382 qint64 currentUploadDataLength = 0;-
1383 char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength));-
1384-
1385 if (currentUploadDataLength == 0) {
currentUploadDataLength == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2710 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
4-2710
1386 uploadDeviceChoking = true;-
1387 // No bytes from upload byte device. There will be bytes later, it will emit readyRead()-
1388 // and our uploadByteDeviceReadyReadSlot() is called.-
1389 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
4
1390 } else {-
1391 uploadDeviceChoking = false;-
1392 }
executed 2710 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2710
1393-
1394 // Let's make a copy of this data-
1395 QByteArray dataArray(data, currentUploadDataLength);-
1396-
1397 // Communicate back to HTTP thread-
1398 emit q->haveUploadData(uploadByteDevicePosition, dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size());-
1399}
executed 2710 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2710
1400-
1401void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot()-
1402{-
1403 // Start the flow between this thread and the HTTP thread again by triggering a upload.-
1404 // However only do this when we were choking before, else the state in-
1405 // QNonContiguousByteDeviceThreadForwardImpl gets messed up.-
1406 if (uploadDeviceChoking) {
uploadDeviceChokingDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-6
1407 uploadDeviceChoking = false;-
1408 wantUploadDataSlot(1024);-
1409 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
4
1410}
executed 10 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
10
1411-
1412-
1413/*-
1414 A simple web page that can be used to test us: http://www.procata.com/cachetest/-
1415 */-
1416bool QNetworkReplyHttpImplPrivate::sendCacheContents(const QNetworkCacheMetaData &metaData)-
1417{-
1418 Q_Q(QNetworkReplyHttpImpl);-
1419-
1420 setCachingEnabled(false);-
1421 if (!metaData.isValid())
!metaData.isValid()Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1422 return false;
never executed: return false;
0
1423-
1424 QAbstractNetworkCache *nc = managerPrivate->networkCache;-
1425 Q_ASSERT(nc);-
1426 QIODevice *contents = nc->data(url);-
1427 if (!contents) {
!contentsDescription
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1428#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
1429 qDebug() << "Can not send cache, the contents are 0" << url;-
1430#endif-
1431 return false;
never executed: return false;
0
1432 }-
1433 contents->setParent(q);-
1434-
1435 QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes();-
1436 int status = attributes.value(QNetworkRequest::HttpStatusCodeAttribute).toInt();-
1437 if (status < 100)
status < 100Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
8-19
1438 status = 200; // fake it
executed 8 times by 1 test: status = 200;
Executed by:
  • tst_QNetworkReply
8
1439-
1440 statusCode = status;-
1441-
1442 q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status);-
1443 q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));-
1444 q->setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true);-
1445-
1446 QNetworkCacheMetaData::RawHeaderList rawHeaders = metaData.rawHeaders();-
1447 QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(),-
1448 end = rawHeaders.constEnd();-
1449 QUrl redirectUrl;-
1450 for ( ; it != end; ++it) {
it != endDescription
TRUEevaluated 100 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27-100
1451 if (httpRequest.isFollowRedirects() &&
httpRequest.is...lowRedirects()Description
TRUEnever evaluated
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-100
1452 !qstricmp(it->first.toLower().constData(), "location"))
!qstricmp(it->...), "location")Description
TRUEnever evaluated
FALSEnever evaluated
0
1453 redirectUrl = QUrl::fromEncoded(it->second);
never executed: redirectUrl = QUrl::fromEncoded(it->second);
0
1454 setRawHeader(it->first, it->second);-
1455 }
executed 100 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
100
1456-
1457 if (!isHttpRedirectResponse())
!isHttpRedirectResponse()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-27
1458 checkForRedirect(status);
executed 27 times by 2 tests: checkForRedirect(status);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1459-
1460 cacheLoadDevice = contents;-
1461 q->connect(cacheLoadDevice, SIGNAL(readyRead()), SLOT(_q_cacheLoadReadyRead()));-
1462 q->connect(cacheLoadDevice, SIGNAL(readChannelFinished()), SLOT(_q_cacheLoadReadyRead()));-
1463-
1464 // This needs to be emitted in the event loop because it can be reached at-
1465 // the direct code path of qnam.get(...) before the user has a chance-
1466 // to connect any signals.-
1467 QMetaObject::invokeMethod(q, "_q_metaDataChanged", Qt::QueuedConnection);-
1468 QMetaObject::invokeMethod(q, "_q_cacheLoadReadyRead", Qt::QueuedConnection);-
1469-
1470-
1471#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
1472 qDebug() << "Successfully sent cache:" << url << contents->size() << "bytes";-
1473#endif-
1474-
1475 // Do redirect processing-
1476 if (httpRequest.isFollowRedirects() && QHttpNetworkReply::isHttpRedirect(status)) {
httpRequest.is...lowRedirects()Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
QHttpNetworkRe...direct(status)Description
TRUEnever evaluated
FALSEnever evaluated
0-27
1477 QMetaObject::invokeMethod(q, "onRedirected", Qt::QueuedConnection,-
1478 Q_ARG(QUrl, redirectUrl),-
1479 Q_ARG(int, status),-
1480 Q_ARG(int, httpRequest.redirectCount() - 1));-
1481 }
never executed: end of block
0
1482-
1483 // Set the following flag so we can ignore some signals from HTTP thread-
1484 // that would still come-
1485 loadingFromCache = true;-
1486 return true;
executed 27 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1487}-
1488-
1489QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNetworkCacheMetaData &oldMetaData) const-
1490{-
1491 Q_Q(const QNetworkReplyHttpImpl);-
1492-
1493 QNetworkCacheMetaData metaData = oldMetaData;-
1494-
1495 QNetworkHeadersPrivate cacheHeaders;-
1496 cacheHeaders.setAllRawHeaders(metaData.rawHeaders());-
1497 QNetworkHeadersPrivate::RawHeadersList::ConstIterator it;-
1498-
1499 const QList<QByteArray> newHeaders = q->rawHeaderList();-
1500 for (QByteArray header : newHeaders) {-
1501 QByteArray originalHeader = header;-
1502 header = header.toLower();-
1503 bool hop_by_hop =-
1504 (header == "connection"
header == "connection"Description
TRUEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 387 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
69-387
1505 || header == "keep-alive"
header == "keep-alive"Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
62-325
1506 || header == "proxy-authenticate"
header == "proxy-authenticate"Description
TRUEnever evaluated
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-325
1507 || header == "proxy-authorization"
header == "pro...authorization"Description
TRUEnever evaluated
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-325
1508 || header == "te"
header == "te"Description
TRUEnever evaluated
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-325
1509 || header == "trailers"
header == "trailers"Description
TRUEnever evaluated
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-325
1510 || header == "transfer-encoding"
header == "transfer-encoding"Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
41-284
1511 || header == "upgrade");
header == "upgrade"Description
TRUEnever evaluated
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-284
1512 if (hop_by_hop)
hop_by_hopDescription
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
172-284
1513 continue;
executed 172 times by 2 tests: continue;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
172
1514-
1515 if (header == "set-cookie")
header == "set-cookie"Description
TRUEnever evaluated
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-284
1516 continue;
never executed: continue;
0
1517-
1518 // for 4.6.0, we were planning to not store the date header in the-
1519 // cached resource; through that we planned to reduce the number-
1520 // of writes to disk when using a QNetworkDiskCache (i.e. don't-
1521 // write to disk when only the date changes).-
1522 // However, without the date we cannot calculate the age of the page-
1523 // anymore.-
1524 //if (header == "date")-
1525 //continue;-
1526-
1527 // Don't store Warning 1xx headers-
1528 if (header == "warning") {
header == "warning"Description
TRUEnever evaluated
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-284
1529 QByteArray v = q->rawHeader(header);-
1530 if (v.length() == 3
v.length() == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1531 && v[0] == '1'
v[0] == '1'Description
TRUEnever evaluated
FALSEnever evaluated
0
1532 && v[1] >= '0' && v[1] <= '9'
v[1] >= '0'Description
TRUEnever evaluated
FALSEnever evaluated
v[1] <= '9'Description
TRUEnever evaluated
FALSEnever evaluated
0
1533 && v[2] >= '0' && v[2] <= '9')
v[2] >= '0'Description
TRUEnever evaluated
FALSEnever evaluated
v[2] <= '9'Description
TRUEnever evaluated
FALSEnever evaluated
0
1534 continue;
never executed: continue;
0
1535 }
never executed: end of block
0
1536-
1537 it = cacheHeaders.findRawHeader(header);-
1538 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 271 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
13-271
1539 // Match the behavior of Firefox and assume Cache-Control: "no-transform"-
1540 if (header == "content-encoding"
header == "content-encoding"Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-13
1541 || header == "content-range"
header == "content-range"Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-13
1542 || header == "content-type")
header == "content-type"Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-13
1543 continue;
never executed: continue;
0
1544-
1545 // For MS servers that send "Content-Length: 0" on 304 responses-
1546 // ignore this too-
1547 if (header == "content-length")
header == "content-length"Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
0-13
1548 continue;
never executed: continue;
0
1549 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
13
1550-
1551#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)-
1552 QByteArray n = q->rawHeader(header);-
1553 QByteArray o;-
1554 if (it != cacheHeaders.rawHeaders.constEnd())-
1555 o = (*it).second;-
1556 if (n != o && header != "date") {-
1557 qDebug() << "replacing" << header;-
1558 qDebug() << "new" << n;-
1559 qDebug() << "old" << o;-
1560 }-
1561#endif-
1562 cacheHeaders.setRawHeader(originalHeader, q->rawHeader(header));-
1563 }
executed 284 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
284
1564 metaData.setRawHeaders(cacheHeaders.rawHeaders);-
1565-
1566 bool checkExpired = true;-
1567-
1568 QHash<QByteArray, QByteArray> cacheControl;-
1569 it = cacheHeaders.findRawHeader("Cache-Control");-
1570 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
28-42
1571 cacheControl = parseHttpOptionHeader(it->second);-
1572 QByteArray maxAge = cacheControl.value("max-age");-
1573 if (!maxAge.isEmpty()) {
!maxAge.isEmpty()Description
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
7-21
1574 checkExpired = false;-
1575 QDateTime dt = QDateTime::currentDateTimeUtc();-
1576 dt = dt.addSecs(maxAge.toInt());-
1577 metaData.setExpirationDate(dt);-
1578 }
executed 21 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
21
1579 }
executed 28 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
28
1580 if (checkExpired) {
checkExpiredDescription
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
21-49
1581 it = cacheHeaders.findRawHeader("expires");-
1582 if (it != cacheHeaders.rawHeaders.constEnd()) {
it != cacheHea...ers.constEnd()Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
17-32
1583 QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(it->second);-
1584 metaData.setExpirationDate(expiredDateTime);-
1585 }
executed 17 times by 1 test: end of block
Executed by:
  • tst_QAbstractNetworkCache
17
1586 }
executed 49 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
49
1587-
1588 it = cacheHeaders.findRawHeader("last-modified");-
1589 if (it != cacheHeaders.rawHeaders.constEnd())
it != cacheHea...ers.constEnd()Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 41 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
29-41
1590 metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second));
executed 29 times by 1 test: metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second));
Executed by:
  • tst_QAbstractNetworkCache
29
1591-
1592 bool canDiskCache;-
1593 // only cache GET replies by default, all other replies (POST, PUT, DELETE)-
1594 // are not cacheable by default (according to RFC 2616 section 9)-
1595 if (httpRequest.operation() == QHttpNetworkRequest::Get) {
httpRequest.op...rkRequest::GetDescription
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEnever evaluated
0-70
1596-
1597 canDiskCache = true;-
1598 // 14.32-
1599 // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client-
1600 // had sent "Cache-Control: no-cache".-
1601 it = cacheHeaders.findRawHeader("pragma");-
1602 if (it != cacheHeaders.rawHeaders.constEnd()
it != cacheHea...ers.constEnd()Description
TRUEnever evaluated
FALSEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-70
1603 && it->second == "no-cache")
it->second == "no-cache"Description
TRUEnever evaluated
FALSEnever evaluated
0
1604 canDiskCache = false;
never executed: canDiskCache = false;
0
1605-
1606 // HTTP/1.1. Check the Cache-Control header-
1607 if (cacheControl.contains("no-cache"))
cacheControl.c...ns("no-cache")Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
7-63
1608 canDiskCache = false;
executed 7 times by 1 test: canDiskCache = false;
Executed by:
  • tst_QAbstractNetworkCache
7
1609 else if (cacheControl.contains("no-store"))
cacheControl.c...ns("no-store")Description
TRUEnever evaluated
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-63
1610 canDiskCache = false;
never executed: canDiskCache = false;
0
1611-
1612 // responses to POST might be cacheable-
1613 } else if (httpRequest.operation() == QHttpNetworkRequest::Post) {
executed 70 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
httpRequest.op...kRequest::PostDescription
TRUEnever evaluated
FALSEnever evaluated
0-70
1614-
1615 canDiskCache = false;-
1616 // some pages contain "expires:" and "cache-control: no-cache" field,-
1617 // so we only might cache POST requests if we get "cache-control: max-age ..."-
1618 if (cacheControl.contains("max-age"))
cacheControl.c...ins("max-age")Description
TRUEnever evaluated
FALSEnever evaluated
0
1619 canDiskCache = true;
never executed: canDiskCache = true;
0
1620-
1621 // responses to PUT and DELETE are not cacheable-
1622 } else {
never executed: end of block
0
1623 canDiskCache = false;-
1624 }
never executed: end of block
0
1625-
1626 metaData.setSaveToDisk(canDiskCache);-
1627 QNetworkCacheMetaData::AttributesMap attributes;-
1628 if (statusCode != 304) {
statusCode != 304Description
TRUEevaluated 61 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9-61
1629 // update the status code-
1630 attributes.insert(QNetworkRequest::HttpStatusCodeAttribute, statusCode);-
1631 attributes.insert(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase);-
1632 } else {
executed 61 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
61
1633 // this is a redirection, keep the attributes intact-
1634 attributes = oldMetaData.attributes();-
1635 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
1636 metaData.setAttributes(attributes);-
1637 return metaData;
executed 70 times by 3 tests: return metaData;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
70
1638}-
1639-
1640bool QNetworkReplyHttpImplPrivate::canResume() const-
1641{-
1642 Q_Q(const QNetworkReplyHttpImpl);-
1643-
1644 // Only GET operation supports resuming.-
1645 if (operation != QNetworkAccessManager::GetOperation)
operation != Q...::GetOperationDescription
TRUEnever evaluated
FALSEnever evaluated
0
1646 return false;
never executed: return false;
0
1647-
1648 // Can only resume if server/resource supports Range header.-
1649 QByteArray acceptRangesheaderName("Accept-Ranges");-
1650 if (!q->hasRawHeader(acceptRangesheaderName) || q->rawHeader(acceptRangesheaderName) == "none")
!q->hasRawHead...gesheaderName)Description
TRUEnever evaluated
FALSEnever evaluated
q->rawHeader(a...ame) == "none"Description
TRUEnever evaluated
FALSEnever evaluated
0
1651 return false;
never executed: return false;
0
1652-
1653 // We only support resuming for byte ranges.-
1654 if (request.hasRawHeader("Range")) {
request.hasRawHeader("Range")Description
TRUEnever evaluated
FALSEnever evaluated
0
1655 QByteArray range = request.rawHeader("Range");-
1656 if (!range.startsWith("bytes="))
!range.startsWith("bytes=")Description
TRUEnever evaluated
FALSEnever evaluated
0
1657 return false;
never executed: return false;
0
1658 }
never executed: end of block
0
1659-
1660 // If we're using a download buffer then we don't support resuming/migration-
1661 // right now. Too much trouble.-
1662 if (downloadZerocopyBuffer)
downloadZerocopyBufferDescription
TRUEnever evaluated
FALSEnever evaluated
0
1663 return false;
never executed: return false;
0
1664-
1665 return true;
never executed: return true;
0
1666}-
1667-
1668void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset)-
1669{-
1670 resumeOffset = offset;-
1671}
never executed: end of block
0
1672-
1673/*!-
1674 Starts the backend. Returns \c true if the backend is started. Returns \c false if the backend-
1675 could not be started due to an unopened or roaming session. The caller should recall this-
1676 function once the session has been opened or the roaming process has finished.-
1677*/-
1678bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest)-
1679{-
1680#ifndef QT_NO_BEARERMANAGEMENT-
1681 QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession());-
1682 if (!networkSession) {
!networkSessionDescription
TRUEnever evaluated
FALSEevaluated 946 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-946
1683#endif-
1684 postRequest(newHttpRequest);-
1685 return true;
never executed: return true;
0
1686#ifndef QT_NO_BEARERMANAGEMENT-
1687 }-
1688-
1689 // This is not ideal.-
1690 const QString host = url.host();-
1691 if (host == QLatin1String("localhost") ||
host == QLatin...g("localhost")Description
TRUEevaluated 138 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 808 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
138-808
1692 QHostAddress(host).isLoopback()) {
QHostAddress(h...).isLoopback()Description
TRUEevaluated 43 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 765 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
43-765
1693 // Don't need an open session for localhost access.-
1694 postRequest(newHttpRequest);-
1695 return true;
executed 181 times by 4 tests: return true;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
181
1696 }-
1697-
1698 if (networkSession->isOpen() &&
networkSession->isOpen()Description
TRUEevaluated 709 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 56 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56-709
1699 networkSession->state() == QNetworkSession::Connected) {
networkSession...ion::ConnectedDescription
TRUEevaluated 709 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-709
1700 Q_Q(QNetworkReplyHttpImpl);-
1701 QObject::connect(networkSession.data(), SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)),-
1702 q, SLOT(_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies)));-
1703 postRequest(newHttpRequest);-
1704 return true;
executed 709 times by 5 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
709
1705 } else if (synchronous) {
synchronousDescription
TRUEnever evaluated
FALSEevaluated 56 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-56
1706 // Command line applications using the synchronous path such as xmlpatterns may need an extra push.-
1707 networkSession->open();-
1708 if (networkSession->waitForOpened()) {
networkSession...aitForOpened()Description
TRUEnever evaluated
FALSEnever evaluated
0
1709 postRequest(newHttpRequest);-
1710 return true;
never executed: return true;
0
1711 }-
1712 }
never executed: end of block
0
1713 return false;
executed 56 times by 5 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1714#endif-
1715}-
1716-
1717void QNetworkReplyHttpImplPrivate::_q_startOperation()-
1718{-
1719 Q_Q(QNetworkReplyHttpImpl);-
1720-
1721 // ensure this function is only being called once-
1722 if (state == Working) {
state == WorkingDescription
TRUEnever evaluated
FALSEevaluated 943 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-943
1723 qDebug() << "QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once" << url;-
1724 return;
never executed: return;
0
1725 }-
1726 state = Working;-
1727-
1728#ifndef QT_NO_BEARERMANAGEMENT-
1729 // Do not start background requests if they are not allowed by session policy-
1730 QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());-
1731 QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false));-
1732 if (isBackground.toBool() && session && session->usagePolicies().testFlag(QNetworkSession::NoBackgroundTrafficPolicy)) {
isBackground.toBool()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 935 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
sessionDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
session->usage...TrafficPolicy)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-935
1733 QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,-
1734 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::BackgroundRequestNotAllowedError),-
1735 Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Background request not allowed.")));-
1736 QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);-
1737 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
2
1738 }-
1739-
1740 if (!start(request)) {
!start(request)Description
TRUEevaluated 56 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 885 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
56-885
1741 // backend failed to start because the session state is not Connected.-
1742 // QNetworkAccessManager will call reply->backend->start() again for us when the session-
1743 // state changes.-
1744 state = WaitingForSession;-
1745-
1746 if (session) {
sessionDescription
TRUEevaluated 56 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-56
1747 QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)),-
1748 q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection);-
1749-
1750 if (!session->isOpen()) {
!session->isOpen()Description
TRUEevaluated 56 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-56
1751 session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground);
executed 56 times by 5 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1752 session->open();-
1753 }
executed 56 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1754 } else {
executed 56 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1755 qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");-
1756 QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,-
1757 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError),-
1758 Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error.")));-
1759 QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);-
1760 return;
never executed: return;
0
1761 }-
1762 } else if (session) {
sessionDescription
TRUEevaluated 885 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEnever evaluated
0-885
1763 QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),-
1764 q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)),-
1765 Qt::QueuedConnection);-
1766 }
executed 885 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
885
1767#else-
1768 if (!start(request)) {-
1769 qWarning("Backend start failed");-
1770 QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,-
1771 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::UnknownNetworkError),-
1772 Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "backend start error.")));-
1773 QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);-
1774 return;-
1775 }-
1776#endif // QT_NO_BEARERMANAGEMENT-
1777-
1778 if (synchronous) {
synchronousDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 865 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
76-865
1779 state = Finished;-
1780 q_func()->setFinished(true);-
1781 }
executed 76 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
76
1782}
executed 941 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
941
1783-
1784void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()-
1785{-
1786 Q_Q(QNetworkReplyHttpImpl);-
1787-
1788 if (state != Working)
state != WorkingDescription
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1789 return;
never executed: return;
0
1790 if (!cacheLoadDevice || !q->isOpen() || !cacheLoadDevice->bytesAvailable())
!cacheLoadDeviceDescription
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
!q->isOpen()Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
!cacheLoadDevi...tesAvailable()Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1791 return;
never executed: return;
0
1792-
1793 // FIXME Optimize to use zerocopy download buffer if it is a QBuffer.-
1794 // Needs to be done where sendCacheContents() (?) of HTTP is emitting-
1795 // metaDataChanged ?-
1796-
1797-
1798 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
1799-
1800 // emit readyRead before downloadProgress incase this will cause events to be-
1801 // processed and we get into a recursive call (as in QProgressDialog).-
1802-
1803 if (!(isHttpRedirectResponse())) {
!(isHttpRedirectResponse())Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-27
1804 // This readyRead() goes to the user. The user then may or may not read() anything.-
1805 emit q->readyRead();-
1806-
1807 if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) {
downloadProgre...SignalIntervalDescription
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1808 downloadProgressSignalChoke.restart();-
1809 emit q->downloadProgress(bytesDownloaded,-
1810 totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());-
1811 }
never executed: end of block
0
1812 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1813 // If there are still bytes available in the cacheLoadDevice then the user did not read-
1814 // in response to the readyRead() signal. This means we have to load from the cacheLoadDevice-
1815 // and buffer that stuff. This is needed to be able to properly emit finished() later.-
1816 while (cacheLoadDevice->bytesAvailable() && !isHttpRedirectResponse())
cacheLoadDevic...tesAvailable()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
!isHttpRedirectResponse()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-27
1817 buffer.append(cacheLoadDevice->readAll());
executed 27 times by 2 tests: buffer.append(cacheLoadDevice->readAll());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1818-
1819 if (cacheLoadDevice->isSequential()) {
cacheLoadDevic...isSequential()Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-27
1820 // check if end and we can read the EOF -1-
1821 char c;-
1822 qint64 actualCount = cacheLoadDevice->read(&c, 1);-
1823 if (actualCount < 0) {
actualCount < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1824 cacheLoadDevice->deleteLater();-
1825 cacheLoadDevice = 0;-
1826 QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection);-
1827 } else if (actualCount == 1) {
never executed: end of block
actualCount == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1828 // This is most probably not happening since most QIODevice returned something proper for bytesAvailable()-
1829 // and had already been "emptied".-
1830 cacheLoadDevice->ungetChar(c);-
1831 }
never executed: end of block
0
1832 } else if ((!cacheLoadDevice->isSequential() && cacheLoadDevice->atEnd())) {
never executed: end of block
!cacheLoadDevi...isSequential()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
cacheLoadDevice->atEnd()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-27
1833 // This codepath is in case the cache device is a QBuffer, e.g. from QNetworkDiskCache.-
1834 cacheLoadDevice->deleteLater();-
1835 cacheLoadDevice = 0;-
1836 QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection);-
1837 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1838}
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
1839-
1840-
1841void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingDataFinished()-
1842{-
1843 Q_Q(QNetworkReplyHttpImpl);-
1844-
1845 // make sure this is only called once, ever.-
1846 //_q_bufferOutgoingData may call it or the readChannelFinished emission-
1847 if (state != Buffering)
state != BufferingDescription
TRUEnever evaluated
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-58
1848 return;
never executed: return;
0
1849-
1850 // disconnect signals-
1851 QObject::disconnect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData()));-
1852 QObject::disconnect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished()));-
1853-
1854 // finally, start the request-
1855 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
1856}
executed 58 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
58
1857-
1858void QNetworkReplyHttpImplPrivate::_q_cacheSaveDeviceAboutToClose()-
1859{-
1860 // do not keep a dangling pointer to the device around (device-
1861 // is closing because e.g. QAbstractNetworkCache::remove() was called).-
1862 cacheSaveDevice = 0;-
1863}
executed 54 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
54
1864-
1865void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData()-
1866{-
1867 Q_Q(QNetworkReplyHttpImpl);-
1868-
1869 if (!outgoingDataBuffer) {
!outgoingDataBufferDescription
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QNetworkReply
48-58
1870 // first call, create our buffer-
1871 outgoingDataBuffer = QSharedPointer<QRingBuffer>::create();-
1872-
1873 QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData()));-
1874 QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished()));-
1875 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
58
1876-
1877 qint64 bytesBuffered = 0;-
1878 qint64 bytesToBuffer = 0;-
1879-
1880 // read data into our buffer-
1881 forever {-
1882 bytesToBuffer = outgoingData->bytesAvailable();-
1883 // unknown? just try 2 kB, this also ensures we always try to read the EOF-
1884 if (bytesToBuffer <= 0)
bytesToBuffer <= 0Description
TRUEevaluated 106 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QNetworkReply
48-106
1885 bytesToBuffer = 2*1024;
executed 106 times by 1 test: bytesToBuffer = 2*1024;
Executed by:
  • tst_QNetworkReply
106
1886-
1887 char *dst = outgoingDataBuffer->reserve(bytesToBuffer);-
1888 bytesBuffered = outgoingData->read(dst, bytesToBuffer);-
1889-
1890 if (bytesBuffered == -1) {
bytesBuffered == -1Description
TRUEnever evaluated
FALSEevaluated 154 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-154
1891 // EOF has been reached.-
1892 outgoingDataBuffer->chop(bytesToBuffer);-
1893-
1894 _q_bufferOutgoingDataFinished();-
1895 break;
never executed: break;
0
1896 } else if (bytesBuffered == 0) {
bytesBuffered == 0Description
TRUEevaluated 106 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QNetworkReply
48-106
1897 // nothing read right now, just wait until we get called again-
1898 outgoingDataBuffer->chop(bytesToBuffer);-
1899-
1900 break;
executed 106 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
106
1901 } else {-
1902 // don't break, try to read() again-
1903 outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered);-
1904 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
48
1905 }-
1906}
executed 106 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
106
1907-
1908#ifndef QT_NO_BEARERMANAGEMENT-
1909void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected()-
1910{-
1911 Q_Q(QNetworkReplyHttpImpl);-
1912-
1913 if (!manager)
!managerDescription
TRUEnever evaluated
FALSEevaluated 158 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-158
1914 return;
never executed: return;
0
1915-
1916 QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession();-
1917 if (!session)
!sessionDescription
TRUEnever evaluated
FALSEevaluated 158 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-158
1918 return;
never executed: return;
0
1919-
1920 if (session->state() != QNetworkSession::Connected)
session->state...ion::ConnectedDescription
TRUEnever evaluated
FALSEevaluated 158 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-158
1921 return;
never executed: return;
0
1922-
1923 switch (state) {-
1924 case QNetworkReplyPrivate::Buffering:
never executed: case QNetworkReplyPrivate::Buffering:
0
1925 case QNetworkReplyPrivate::Working:
never executed: case QNetworkReplyPrivate::Working:
0
1926 case QNetworkReplyPrivate::Reconnecting:
never executed: case QNetworkReplyPrivate::Reconnecting:
0
1927 // Migrate existing downloads to new network connection.-
1928 migrateBackend();-
1929 break;
never executed: break;
0
1930 case QNetworkReplyPrivate::WaitingForSession:
executed 56 times by 5 tests: case QNetworkReplyPrivate::WaitingForSession:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1931 // Start waiting requests.-
1932 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
1933 break;
executed 56 times by 5 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
56
1934 default:
executed 102 times by 1 test: default:
Executed by:
  • tst_Spdy
102
1935 ;-
1936 }
executed 102 times by 1 test: end of block
Executed by:
  • tst_Spdy
102
1937}-
1938-
1939void QNetworkReplyHttpImplPrivate::_q_networkSessionStateChanged(QNetworkSession::State sessionState)-
1940{-
1941 if (sessionState == QNetworkSession::Disconnected
sessionState =...::DisconnectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1942 && state != Idle && state != Reconnecting) {
state != IdleDescription
TRUEnever evaluated
FALSEnever evaluated
state != ReconnectingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1943 error(QNetworkReplyImpl::NetworkSessionFailedError,-
1944 QCoreApplication::translate("QNetworkReply", "Network session error."));-
1945 finished();-
1946 }
never executed: end of block
0
1947}
never executed: end of block
0
1948-
1949void QNetworkReplyHttpImplPrivate::_q_networkSessionFailed()-
1950{-
1951 // Abort waiting and working replies.-
1952 if (state == WaitingForSession || state == Working) {
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEnever evaluated
state == WorkingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1953 state = Working;-
1954 QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());-
1955 QString errorStr;-
1956 if (session)
sessionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1957 errorStr = session->errorString();
never executed: errorStr = session->errorString();
0
1958 else-
1959 errorStr = QCoreApplication::translate("QNetworkReply", "Network session error.");
never executed: errorStr = QCoreApplication::translate("QNetworkReply", "Network session error.");
0
1960 error(QNetworkReplyImpl::NetworkSessionFailedError, errorStr);-
1961 finished();-
1962 }
never executed: end of block
0
1963}
never executed: end of block
0
1964-
1965void QNetworkReplyHttpImplPrivate::_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies newPolicies)-
1966{-
1967 if (request.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) {
request.attrib...bute).toBool()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-6
1968 if (newPolicies & QNetworkSession::NoBackgroundTrafficPolicy) {
newPolicies & ...dTrafficPolicyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
2
1969 // Abort waiting and working replies.-
1970 if (state == WaitingForSession || state == Working) {
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
state == WorkingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-2
1971 state = Working;-
1972 error(QNetworkReply::BackgroundRequestNotAllowedError,-
1973 QCoreApplication::translate("QNetworkReply", "Background request not allowed."));-
1974 finished();-
1975 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
1976 // ### if canResume(), then we could resume automatically-
1977 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
1978 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
4
1979-
1980}
executed 10 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
10
1981#endif-
1982-
1983-
1984// need to have this function since the reply is a private member variable-
1985// and the special backends need to access this.-
1986void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal)-
1987{-
1988 Q_Q(QNetworkReplyHttpImpl);-
1989 if (isFinished)
isFinishedDescription
TRUEnever evaluated
FALSEevaluated 2695 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-2695
1990 return;
never executed: return;
0
1991-
1992 if (!emitAllUploadProgressSignals) {
!emitAllUploadProgressSignalsDescription
TRUEevaluated 2631 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_QNetworkReply
64-2631
1993 //choke signal emissions, except the first and last signals which are unconditional-
1994 if (uploadProgressSignalChoke.isValid()) {
uploadProgress...hoke.isValid()Description
TRUEevaluated 2498 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 133 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
133-2498
1995 if (bytesSent != bytesTotal && uploadProgressSignalChoke.elapsed() < progressSignalInterval) {
bytesSent != bytesTotalDescription
TRUEevaluated 2425 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 73 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
uploadProgress...SignalIntervalDescription
TRUEevaluated 2403 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
22-2425
1996 return;
executed 2403 times by 2 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
2403
1997 }-
1998 uploadProgressSignalChoke.restart();-
1999 } else {
executed 95 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
95
2000 uploadProgressSignalChoke.start();-
2001 }
executed 133 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
133
2002 }-
2003-
2004 emit q->uploadProgress(bytesSent, bytesTotal);-
2005}
executed 292 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
292
2006-
2007QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice()-
2008{-
2009 Q_Q(QNetworkReplyHttpImpl);-
2010-
2011 if (outgoingDataBuffer)
outgoingDataBufferDescription
TRUEevaluated 99 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 101 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
99-101
2012 uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingDataBuffer);
executed 99 times by 1 test: uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingDataBuffer);
Executed by:
  • tst_QNetworkReply
99
2013 else if (outgoingData) {
outgoingDataDescription
TRUEevaluated 97 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-97
2014 uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingData);-
2015 } else {
executed 97 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
97
2016 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_QNetworkReply
4
2017 }-
2018-
2019 // We want signal emissions only for normal asynchronous uploads-
2020 if (!synchronous)
!synchronousDescription
TRUEevaluated 155 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QNetworkReply
41-155
2021 QObject::connect(uploadByteDevice.data(), SIGNAL(readProgress(qint64,qint64)),
executed 155 times by 3 tests: QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "2021"), q, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "2022"));
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
155
2022 q, SLOT(emitReplyUploadProgress(qint64,qint64)));
executed 155 times by 3 tests: QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "2021"), q, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "2022"));
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
155
2023-
2024 return uploadByteDevice.data();
executed 196 times by 3 tests: return uploadByteDevice.data();
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
196
2025}-
2026-
2027void QNetworkReplyHttpImplPrivate::_q_finished()-
2028{-
2029 // This gets called queued, just forward to real call then-
2030 finished();-
2031}
executed 32 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
32
2032-
2033void QNetworkReplyHttpImplPrivate::finished()-
2034{-
2035 Q_Q(QNetworkReplyHttpImpl);-
2036-
2037 if (state == Finished || state == Aborted || state == WaitingForSession)
state == FinishedDescription
TRUEnever evaluated
FALSEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
state == AbortedDescription
TRUEnever evaluated
FALSEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-869
2038 return;
never executed: return;
0
2039-
2040 QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);-
2041 if (preMigrationDownloaded != Q_INT64_C(-1))
preMigrationDo...ng long>(-1LL)Description
TRUEnever evaluated
FALSEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-869
2042 totalSize = totalSize.toLongLong() + preMigrationDownloaded;
never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded;
0
2043-
2044 if (manager) {
managerDescription
TRUEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-869
2045#ifndef QT_NO_BEARERMANAGEMENT-
2046 QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession();-
2047 if (session && session->state() == QNetworkSession::Roaming &&
sessionDescription
TRUEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
session->state...ssion::RoamingDescription
TRUEnever evaluated
FALSEevaluated 869 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-869
2048 state == Working && errorCode != QNetworkReply::OperationCanceledError) {
state == WorkingDescription
TRUEnever evaluated
FALSEnever evaluated
errorCode != Q...nCanceledErrorDescription
TRUEnever evaluated
FALSEnever evaluated
0
2049 // only content with a known size will fail with a temporary network failure error-
2050 if (!totalSize.isNull()) {
!totalSize.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
2051 if (bytesDownloaded != totalSize) {
bytesDownloaded != totalSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2052 if (migrateBackend()) {
migrateBackend()Description
TRUEnever evaluated
FALSEnever evaluated
0
2053 // either we are migrating or the request is finished/aborted-
2054 if (state == Reconnecting || state == WaitingForSession) {
state == ReconnectingDescription
TRUEnever evaluated
FALSEnever evaluated
state == WaitingForSessionDescription
TRUEnever evaluated
FALSEnever evaluated
0
2055 return; // exit early if we are migrating.
never executed: return;
0
2056 }-
2057 } else {
never executed: end of block
0
2058 error(QNetworkReply::TemporaryNetworkFailureError,-
2059 QNetworkReply::tr("Temporary network failure."));-
2060 }
never executed: end of block
0
2061 }-
2062 }
never executed: end of block
0
2063 }
never executed: end of block
0
2064#endif-
2065 }
executed 869 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
869
2066-
2067 // if we don't know the total size of or we received everything save the cache-
2068 if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize)
totalSize.isNull()Description
TRUEevaluated 319 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 550 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
totalSize == -1Description
TRUEnever evaluated
FALSEevaluated 550 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
bytesDownloaded == totalSizeDescription
TRUEevaluated 518 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-550
2069 completeCacheSave();
executed 837 times by 7 tests: completeCacheSave();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
837
2070-
2071 // We check for errorCode too as in case of SSL handshake failure, we still-
2072 // get the HTTP redirect status code (301, 303 etc)-
2073 if (isHttpRedirectResponse() && errorCode == QNetworkReply::NoError)
isHttpRedirectResponse()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 863 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
errorCode == Q...Reply::NoErrorDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-863
2074 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
5
2075-
2076 state = Finished;-
2077 q->setFinished(true);-
2078-
2079 if (totalSize.isNull() || totalSize == -1) {
totalSize.isNull()Description
TRUEevaluated 314 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 550 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
totalSize == -1Description
TRUEnever evaluated
FALSEevaluated 550 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-550
2080 emit q->downloadProgress(bytesDownloaded, bytesDownloaded);-
2081 } else {
executed 314 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
314
2082 emit q->downloadProgress(bytesDownloaded, totalSize.toLongLong());-
2083 }
executed 550 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
550
2084-
2085 if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer))
bytesUploaded == -1Description
TRUEevaluated 864 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
outgoingDataDescription
TRUEevaluated 195 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 669 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
outgoingDataBufferDescription
TRUEnever evaluated
FALSEevaluated 669 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-864
2086 emit q->uploadProgress(0, 0);
executed 195 times by 2 tests: q->uploadProgress(0, 0);
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
195
2087-
2088 emit q->readChannelFinished();-
2089 emit q->finished();-
2090}
executed 864 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
864
2091-
2092void QNetworkReplyHttpImplPrivate::_q_error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage)-
2093{-
2094 this->error(code, errorMessage);-
2095}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
5
2096-
2097-
2098void QNetworkReplyHttpImplPrivate::error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage)-
2099{-
2100 Q_Q(QNetworkReplyHttpImpl);-
2101 // Can't set and emit multiple errors.-
2102 if (errorCode != QNetworkReply::NoError) {
errorCode != Q...Reply::NoErrorDescription
TRUEnever evaluated
FALSEevaluated 122 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
0-122
2103 qWarning("QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");-
2104 return;
never executed: return;
0
2105 }-
2106-
2107 errorCode = code;-
2108 q->setErrorString(errorMessage);-
2109-
2110 // note: might not be a good idea, since users could decide to delete us-
2111 // which would delete the backend too...-
2112 // maybe we should protect the backend-
2113 emit q->error(code);-
2114}
executed 122 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
122
2115-
2116void QNetworkReplyHttpImplPrivate::_q_metaDataChanged()-
2117{-
2118 // FIXME merge this with replyDownloadMetaData(); ?-
2119-
2120 Q_Q(QNetworkReplyHttpImpl);-
2121 // 1. do we have cookies?-
2122 // 2. are we allowed to set them?-
2123 if (manager) {
managerDescription
TRUEevaluated 814 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-814
2124 const auto it = cookedHeaders.constFind(QNetworkRequest::SetCookieHeader);-
2125 if (it != cookedHeaders.cend()
it != cookedHeaders.cend()Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 801 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
13-801
2126 && request.attribute(QNetworkRequest::CookieSaveControlAttribute,
request.attrib...est::AutomaticDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-13
2127 QNetworkRequest::Automatic).toInt() == QNetworkRequest::Automatic) {
request.attrib...est::AutomaticDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-13
2128 QNetworkCookieJar *jar = manager->cookieJar();-
2129 if (jar) {
jarDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-13
2130 QList<QNetworkCookie> cookies =-
2131 qvariant_cast<QList<QNetworkCookie> >(it.value());-
2132 jar->setCookiesFromUrl(cookies, url);-
2133 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
13
2134 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
13
2135 }
executed 814 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
814
2136 emit q->metaDataChanged();-
2137}
executed 814 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
814
2138-
2139/*-
2140 Migrates the backend of the QNetworkReply to a new network connection if required. Returns-
2141 true if the reply is migrated or it is not required; otherwise returns \c false.-
2142*/-
2143bool QNetworkReplyHttpImplPrivate::migrateBackend()-
2144{-
2145 Q_Q(QNetworkReplyHttpImpl);-
2146-
2147 // Network reply is already finished or aborted, don't need to migrate.-
2148 if (state == Finished || state == Aborted)
state == FinishedDescription
TRUEnever evaluated
FALSEnever evaluated
state == AbortedDescription
TRUEnever evaluated
FALSEnever evaluated
0
2149 return true;
never executed: return true;
0
2150-
2151 // Backend does not support resuming download.-
2152 if (!canResume())
!canResume()Description
TRUEnever evaluated
FALSEnever evaluated
0
2153 return false;
never executed: return false;
0
2154-
2155 // Request has outgoing data, not migrating.-
2156 if (outgoingData)
outgoingDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
2157 return false;
never executed: return false;
0
2158-
2159 // Request is serviced from the cache, don't need to migrate.-
2160 if (cacheLoadDevice)
cacheLoadDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
0
2161 return true;
never executed: return true;
0
2162-
2163 state = Reconnecting;-
2164-
2165 cookedHeaders.clear();-
2166 rawHeaders.clear();-
2167-
2168 preMigrationDownloaded = bytesDownloaded;-
2169-
2170 setResumeOffset(bytesDownloaded);-
2171-
2172 emit q->abortHttpRequest();-
2173-
2174 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);-
2175-
2176 return true;
never executed: return true;
0
2177}-
2178-
2179-
2180void QNetworkReplyHttpImplPrivate::createCache()-
2181{-
2182 // check if we can save and if we're allowed to-
2183 if (!managerPrivate->networkCache
!managerPrivate->networkCacheDescription
TRUEevaluated 712 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 75 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
75-712
2184 || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool())
!request.attri...true).toBool()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 65 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
10-65
2185 return;
executed 722 times by 5 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
722
2186 cacheEnabled = true;-
2187}
executed 65 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
65
2188-
2189bool QNetworkReplyHttpImplPrivate::isCachingEnabled() const-
2190{-
2191 return (cacheEnabled && managerPrivate->networkCache != 0);
executed 787 times by 6 tests: return (cacheEnabled && managerPrivate->networkCache != 0);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
787
2192}-
2193-
2194void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable)-
2195{-
2196 if (!enable && !cacheEnabled)
!enableDescription
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
!cacheEnabledDescription
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-787
2197 return; // nothing to do
executed 27 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
27
2198 if (enable && cacheEnabled)
enableDescription
TRUEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
cacheEnabledDescription
TRUEnever evaluated
FALSEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-787
2199 return; // nothing to do either!
never executed: return;
0
2200-
2201 if (enable) {
enableDescription
TRUEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-787
2202 if (Q_UNLIKELY(bytesDownloaded)) {
__builtin_expe...oaded), false)Description
TRUEnever evaluated
FALSEevaluated 787 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-787
2203 qDebug() << "setCachingEnabled: " << bytesDownloaded << " bytesDownloaded";-
2204 // refuse to enable in this case-
2205 qCritical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");-
2206 return;
never executed: return;
0
2207 }-
2208-
2209 createCache();-
2210 } else {
executed 787 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
787
2211 // someone told us to turn on, then back off?-
2212 // ok... but you should make up your mind-
2213 qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)");-
2214 managerPrivate->networkCache->remove(url);-
2215 cacheSaveDevice = 0;-
2216 cacheEnabled = false;-
2217 }
never executed: end of block
0
2218}-
2219-
2220bool QNetworkReplyHttpImplPrivate::isCachingAllowed() const-
2221{-
2222 return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation;
executed 64 times by 3 tests: return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
64
2223}-
2224-
2225void QNetworkReplyHttpImplPrivate::completeCacheSave()-
2226{-
2227 if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {
cacheEnabledDescription
TRUEevaluated 56 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 781 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
errorCode != Q...yImpl::NoErrorDescription
TRUEnever evaluated
FALSEevaluated 56 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-781
2228 managerPrivate->networkCache->remove(url);-
2229 } else if (cacheEnabled && cacheSaveDevice) {
never executed: end of block
cacheEnabledDescription
TRUEevaluated 56 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 781 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
cacheSaveDeviceDescription
TRUEevaluated 53 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
0-781
2230 managerPrivate->networkCache->insert(cacheSaveDevice);-
2231 }
executed 53 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
53
2232 cacheSaveDevice = 0;-
2233 cacheEnabled = false;-
2234}
executed 837 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
837
2235-
2236QT_END_NAMESPACE-
2237-
2238#endif // QT_NO_HTTP-
Source codeSwitch to Preprocessed file

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