qnetworkaccessbackend.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkaccessbackend.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#include "qnetworkaccessbackend_p.h"-
41#include "qnetworkaccessmanager_p.h"-
42#include "qnetworkconfigmanager.h"-
43#include "qnetworkrequest.h"-
44#include "qnetworkreply.h"-
45#include "qnetworkreply_p.h"-
46#include "QtCore/qmutex.h"-
47#include "QtCore/qstringlist.h"-
48#include "QtNetwork/private/qnetworksession_p.h"-
49-
50#include "qnetworkaccesscachebackend_p.h"-
51#include "qabstractnetworkcache.h"-
52#include "qhostinfo.h"-
53-
54#include "private/qnoncontiguousbytedevice_p.h"-
55-
56QT_BEGIN_NAMESPACE-
57-
58class QNetworkAccessBackendFactoryData: public QList<QNetworkAccessBackendFactory *>-
59{-
60public:-
61 QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive)-
62 {-
63 valid.ref();-
64 }
executed 9 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QXmlInputSource
  • tst_QXmlStream
9
65 ~QNetworkAccessBackendFactoryData()-
66 {-
67 QMutexLocker locker(&mutex); // why do we need to lock?-
68 valid.deref();-
69 }
executed 10 times by 10 tests: end of block
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
10
70-
71 QMutex mutex;-
72 //this is used to avoid (re)constructing factory data from destructors of other global classes-
73 static QBasicAtomicInt valid;-
74};-
75Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData)
executed 10 times by 10 tests: end of block
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
executed 10 times by 10 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
executed 438 times by 20 tests: return &holder.value;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
guard.load() =...c::InitializedDescription
TRUEevaluated 10 times by 10 tests
Evaluated by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
FALSEnever evaluated
0-438
76QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0);-
77-
78QNetworkAccessBackendFactory::QNetworkAccessBackendFactory()-
79{-
80 QMutexLocker locker(&factoryData()->mutex);-
81 factoryData()->append(this);-
82}
executed 27 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QXmlInputSource
  • tst_QXmlStream
27
83-
84QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory()-
85{-
86 if (QNetworkAccessBackendFactoryData::valid.load()) {
QNetworkAccess...::valid.load()Description
TRUEevaluated 30 times by 10 tests
Evaluated by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
FALSEnever evaluated
0-30
87 QMutexLocker locker(&factoryData()->mutex);-
88 factoryData()->removeAll(this);-
89 }
executed 30 times by 10 tests: end of block
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
30
90}
executed 30 times by 10 tests: end of block
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfigurationmanagerqappless - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
30
91-
92QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op,-
93 const QNetworkRequest &request)-
94{-
95 if (QNetworkAccessBackendFactoryData::valid.load()) {
QNetworkAccess...::valid.load()Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-108
96 QMutexLocker locker(&factoryData()->mutex);-
97 QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(),-
98 end = factoryData()->constEnd();-
99 while (it != end) {
it != endDescription
TRUEevaluated 209 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-209
100 QNetworkAccessBackend *backend = (*it)->create(op, request);-
101 if (backend) {
backendDescription
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 105 times by 1 test
Evaluated by:
  • tst_QNetworkReply
104-105
102 backend->manager = this;-
103 return backend; // found a factory that handled our request
executed 104 times by 1 test: return backend;
Executed by:
  • tst_QNetworkReply
104
104 }-
105 ++it;-
106 }
executed 105 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
105
107 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
4
108 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_QNetworkReply
4
109}-
110-
111QStringList QNetworkAccessManagerPrivate::backendSupportedSchemes() const-
112{-
113 if (QNetworkAccessBackendFactoryData::valid.load()) {
QNetworkAccess...::valid.load()Description
TRUEnever evaluated
FALSEnever evaluated
0
114 QMutexLocker locker(&factoryData()->mutex);-
115 QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin();-
116 QNetworkAccessBackendFactoryData::ConstIterator end = factoryData()->constEnd();-
117 QStringList schemes;-
118 while (it != end) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
119 schemes += (*it)->supportedSchemes();-
120 ++it;-
121 }
never executed: end of block
0
122 return schemes;
never executed: return schemes;
0
123 }-
124 return QStringList();
never executed: return QStringList();
0
125}-
126-
127QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice()-
128{-
129 if (reply->outgoingDataBuffer)
reply->outgoingDataBufferDescription
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-59
130 uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingDataBuffer);
never executed: uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingDataBuffer);
0
131 else if (reply->outgoingData) {
reply->outgoingDataDescription
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-59
132 uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingData);-
133 } else {
executed 59 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
59
134 return 0;
never executed: return 0;
0
135 }-
136-
137 // We want signal emissions only for normal asynchronous uploads-
138 if (!isSynchronous())
!isSynchronous()Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-59
139 connect(uploadByteDevice.data(), SIGNAL(readProgress(qint64,qint64)), this, SLOT(emitReplyUploadProgress(qint64,qint64)));
executed 59 times by 1 test: connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "139"), this, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "139"));
Executed by:
  • tst_QNetworkReply
59
140-
141 return uploadByteDevice.data();
executed 59 times by 1 test: return uploadByteDevice.data();
Executed by:
  • tst_QNetworkReply
59
142}-
143-
144// need to have this function since the reply is a private member variable-
145// and the special backends need to access this.-
146void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal)-
147{-
148 if (reply->isFinished)
reply->isFinishedDescription
TRUEnever evaluated
FALSEevaluated 1053 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1053
149 return;
never executed: return;
0
150 reply->emitUploadProgress(bytesSent, bytesTotal);-
151}
executed 1053 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1053
152-
153QNetworkAccessBackend::QNetworkAccessBackend()-
154 : manager(0)-
155 , reply(0)-
156 , synchronous(false)-
157{-
158}
executed 118 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
118
159-
160QNetworkAccessBackend::~QNetworkAccessBackend()-
161{-
162}-
163-
164void QNetworkAccessBackend::downstreamReadyWrite()-
165{-
166 // do nothing-
167}-
168-
169void QNetworkAccessBackend::setDownstreamLimited(bool b)-
170{-
171 Q_UNUSED(b);-
172 // do nothing-
173}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
4
174-
175void QNetworkAccessBackend::copyFinished(QIODevice *)-
176{-
177 // do nothing-
178}-
179-
180void QNetworkAccessBackend::ignoreSslErrors()-
181{-
182 // do nothing-
183}-
184-
185void QNetworkAccessBackend::ignoreSslErrors(const QList<QSslError> &errors)-
186{-
187 Q_UNUSED(errors);-
188 // do nothing-
189}
never executed: end of block
0
190-
191void QNetworkAccessBackend::fetchSslConfiguration(QSslConfiguration &) const-
192{-
193 // do nothing-
194}-
195-
196void QNetworkAccessBackend::setSslConfiguration(const QSslConfiguration &)-
197{-
198 // do nothing-
199}-
200-
201QNetworkCacheMetaData QNetworkAccessBackend::fetchCacheMetaData(const QNetworkCacheMetaData &) const-
202{-
203 return QNetworkCacheMetaData();
never executed: return QNetworkCacheMetaData();
0
204}-
205-
206QNetworkAccessManager::Operation QNetworkAccessBackend::operation() const-
207{-
208 return reply->operation;
executed 462 times by 2 tests: return reply->operation;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
462
209}-
210-
211QNetworkRequest QNetworkAccessBackend::request() const-
212{-
213 return reply->request;
executed 125 times by 2 tests: return reply->request;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
125
214}-
215-
216#ifndef QT_NO_NETWORKPROXY-
217QList<QNetworkProxy> QNetworkAccessBackend::proxyList() const-
218{-
219 return reply->proxyList;
executed 53 times by 1 test: return reply->proxyList;
Executed by:
  • tst_QNetworkReply
53
220}-
221#endif-
222-
223QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const-
224{-
225 if (!manager)
!managerDescription
TRUEnever evaluated
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-43
226 return 0;
never executed: return 0;
0
227 return manager->networkCache;
executed 43 times by 2 tests: return manager->networkCache;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
43
228}-
229-
230void QNetworkAccessBackend::setCachingEnabled(bool enable)-
231{-
232 reply->setCachingEnabled(enable);-
233}
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
43
234-
235bool QNetworkAccessBackend::isCachingEnabled() const-
236{-
237 return reply->isCachingEnabled();
never executed: return reply->isCachingEnabled();
0
238}-
239-
240qint64 QNetworkAccessBackend::nextDownstreamBlockSize() const-
241{-
242 return reply->nextDownstreamBlockSize();
executed 38 times by 1 test: return reply->nextDownstreamBlockSize();
Executed by:
  • tst_QNetworkReply
38
243}-
244-
245void QNetworkAccessBackend::writeDownstreamData(QByteDataBuffer &list)-
246{-
247 reply->appendDownstreamData(list);-
248}
executed 488 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
488
249-
250void QNetworkAccessBackend::writeDownstreamData(QIODevice *data)-
251{-
252 reply->appendDownstreamData(data);-
253}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
254-
255// not actually appending data, it was already written to the user buffer-
256void QNetworkAccessBackend::writeDownstreamDataDownloadBuffer(qint64 bytesReceived, qint64 bytesTotal)-
257{-
258 reply->appendDownstreamDataDownloadBuffer(bytesReceived, bytesTotal);-
259}
never executed: end of block
0
260-
261char* QNetworkAccessBackend::getDownloadBuffer(qint64 size)-
262{-
263 return reply->getDownloadBuffer(size);
never executed: return reply->getDownloadBuffer(size);
0
264}-
265-
266QVariant QNetworkAccessBackend::header(QNetworkRequest::KnownHeaders header) const-
267{-
268 return reply->q_func()->header(header);
never executed: return reply->q_func()->header(header);
0
269}-
270-
271void QNetworkAccessBackend::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)-
272{-
273 reply->setCookedHeader(header, value);-
274}
executed 69 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
69
275-
276bool QNetworkAccessBackend::hasRawHeader(const QByteArray &headerName) const-
277{-
278 return reply->q_func()->hasRawHeader(headerName);
never executed: return reply->q_func()->hasRawHeader(headerName);
0
279}-
280-
281QByteArray QNetworkAccessBackend::rawHeader(const QByteArray &headerName) const-
282{-
283 return reply->q_func()->rawHeader(headerName);
never executed: return reply->q_func()->rawHeader(headerName);
0
284}-
285-
286QList<QByteArray> QNetworkAccessBackend::rawHeaderList() const-
287{-
288 return reply->q_func()->rawHeaderList();
never executed: return reply->q_func()->rawHeaderList();
0
289}-
290-
291void QNetworkAccessBackend::setRawHeader(const QByteArray &headerName, const QByteArray &headerValue)-
292{-
293 reply->setRawHeader(headerName, headerValue);-
294}
executed 36 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
36
295-
296QVariant QNetworkAccessBackend::attribute(QNetworkRequest::Attribute code) const-
297{-
298 return reply->q_func()->attribute(code);
never executed: return reply->q_func()->attribute(code);
0
299}-
300-
301void QNetworkAccessBackend::setAttribute(QNetworkRequest::Attribute code, const QVariant &value)-
302{-
303 if (value.isValid())
value.isValid()Description
TRUEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
8-25
304 reply->attributes.insert(code, value);
executed 25 times by 2 tests: reply->attributes.insert(code, value);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
25
305 else-
306 reply->attributes.remove(code);
executed 8 times by 1 test: reply->attributes.remove(code);
Executed by:
  • tst_QNetworkReply
8
307}-
308QUrl QNetworkAccessBackend::url() const-
309{-
310 return reply->url;
executed 391 times by 2 tests: return reply->url;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
391
311}-
312-
313void QNetworkAccessBackend::setUrl(const QUrl &url)-
314{-
315 reply->url = url;-
316}
executed 50 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
50
317-
318void QNetworkAccessBackend::finished()-
319{-
320 reply->finished();-
321}
executed 114 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
114
322-
323void QNetworkAccessBackend::error(QNetworkReply::NetworkError code, const QString &errorString)-
324{-
325 reply->error(code, errorString);-
326}
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
17
327-
328#ifndef QT_NO_NETWORKPROXY-
329void QNetworkAccessBackend::proxyAuthenticationRequired(const QNetworkProxy &proxy,-
330 QAuthenticator *authenticator)-
331{-
332 manager->proxyAuthenticationRequired(QUrl(), proxy, synchronous, authenticator, &reply->lastProxyAuthentication);-
333}
never executed: end of block
0
334#endif-
335-
336void QNetworkAccessBackend::authenticationRequired(QAuthenticator *authenticator)-
337{-
338 manager->authenticationRequired(authenticator, reply->q_func(), synchronous, reply->url, &reply->urlForLastAuthentication);-
339}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
3
340-
341void QNetworkAccessBackend::metaDataChanged()-
342{-
343 reply->metaDataChanged();-
344}
executed 54 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
54
345-
346void QNetworkAccessBackend::redirectionRequested(const QUrl &target)-
347{-
348 reply->redirectionRequested(target);-
349}
never executed: end of block
0
350-
351void QNetworkAccessBackend::encrypted()-
352{-
353#ifndef QT_NO_SSL-
354 reply->encrypted();-
355#endif-
356}
never executed: end of block
0
357-
358void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors)-
359{-
360#ifndef QT_NO_SSL-
361 reply->sslErrors(errors);-
362#else-
363 Q_UNUSED(errors);-
364#endif-
365}
never executed: end of block
0
366-
367/*!-
368 Starts the backend. Returns \c true if the backend is started. Returns \c false if the backend-
369 could not be started due to an unopened or roaming session. The caller should recall this-
370 function once the session has been opened or the roaming process has finished.-
371*/-
372bool QNetworkAccessBackend::start()-
373{-
374#ifndef QT_NO_BEARERMANAGEMENT-
375 // For bearer, check if session start is required-
376 QSharedPointer<QNetworkSession> networkSession(manager->getNetworkSession());-
377 if (networkSession) {
networkSessionDescription
TRUEevaluated 119 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-119
378 // session required-
379 if (networkSession->isOpen() &&
networkSession->isOpen()Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-116
380 networkSession->state() == QNetworkSession::Connected) {
networkSession...ion::ConnectedDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-116
381 // Session is already open and ready to use.-
382 // copy network session down to the backend-
383 setProperty("_q_networksession", QVariant::fromValue(networkSession));-
384 } else {
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
385 // Session not ready, but can skip for loopback connections-
386-
387 // This is not ideal.-
388 // Don't need an open session for localhost access.-
389 if (!reply->url.isLocalFile()) {
!reply->url.isLocalFile()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-3
390 const QString host = reply->url.host();-
391 if (host != QLatin1String("localhost") && !QHostAddress(host).isLoopback())
host != QLatin...g("localhost")Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
!QHostAddress(...).isLoopback()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-3
392 return false; // need to wait for session to be opened
executed 3 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
3
393 }
never executed: end of block
0
394 }
never executed: end of block
0
395 }-
396#endif-
397-
398#ifndef QT_NO_NETWORKPROXY-
399#ifndef QT_NO_BEARERMANAGEMENT-
400 // Get the proxy settings from the network session (in the case of service networks,-
401 // the proxy settings change depending which AP was activated)-
402 QNetworkSession *session = networkSession.data();-
403 QNetworkConfiguration config;-
404 if (session) {
sessionDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-116
405 QNetworkConfigurationManager configManager;-
406 // The active configuration tells us what IAP is in use-
407 QVariant v = session->sessionProperty(QLatin1String("ActiveConfiguration"));-
408 if (v.isValid())
v.isValid()Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
0-116
409 config = configManager.configurationFromIdentifier(qvariant_cast<QString>(v));
executed 116 times by 2 tests: config = configManager.configurationFromIdentifier(qvariant_cast<QString>(v));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
410 // Fallback to using the configuration if no active configuration-
411 if (!config.isValid())
!config.isValid()Description
TRUEnever evaluated
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-116
412 config = session->configuration();
never executed: config = session->configuration();
0
413 // or unspecified configuration if that is no good either-
414 if (!config.isValid())
!config.isValid()Description
TRUEnever evaluated
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
0-116
415 config = QNetworkConfiguration();
never executed: config = QNetworkConfiguration();
0
416 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
417 reply->proxyList = manager->queryProxy(QNetworkProxyQuery(config, url()));-
418#else // QT_NO_BEARERMANAGEMENT-
419 // Without bearer management, the proxy depends only on the url-
420 reply->proxyList = manager->queryProxy(QNetworkProxyQuery(url()));-
421#endif-
422#endif-
423-
424 // now start the request-
425 open();-
426 return true;
executed 116 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
116
427}-
428-
429QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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