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

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