qhttpnetworkconnection.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkconnection.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 "qhttpnetworkconnection_p.h"-
41#include <private/qabstractsocket_p.h>-
42#include "qhttpnetworkconnectionchannel_p.h"-
43#include "private/qnoncontiguousbytedevice_p.h"-
44#include <private/qnetworkrequest_p.h>-
45#include <private/qobject_p.h>-
46#include <private/qauthenticator_p.h>-
47#include "private/qhostinfo_p.h"-
48#include <qnetworkproxy.h>-
49#include <qauthenticator.h>-
50#include <qcoreapplication.h>-
51-
52#include <qbuffer.h>-
53#include <qpair.h>-
54#include <qdebug.h>-
55-
56#ifndef QT_NO_HTTP-
57-
58#ifndef QT_NO_SSL-
59# include <private/qsslsocket_p.h>-
60# include <QtNetwork/qsslkey.h>-
61# include <QtNetwork/qsslcipher.h>-
62# include <QtNetwork/qsslconfiguration.h>-
63#endif-
64-
65-
66-
67QT_BEGIN_NAMESPACE-
68-
69const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6;-
70-
71// The pipeline length. So there will be 4 requests in flight.-
72const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;-
73// Only re-fill the pipeline if there's defaultRePipelineLength slots free in the pipeline.-
74// This means that there are 2 requests in flight and 2 slots free that will be re-filled.-
75const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2;-
76-
77-
78QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName,-
79 quint16 port, bool encrypt,-
80 QHttpNetworkConnection::ConnectionType type)-
81: state(RunningState),-
82 networkLayerState(Unknown),-
83 hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true)-
84#ifndef QT_NO_SSL-
85, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY) ? 1 : defaultHttpChannelCount)-
86#else-
87, channelCount(defaultHttpChannelCount)-
88#endif // QT_NO_SSL-
89#ifndef QT_NO_NETWORKPROXY-
90 , networkProxy(QNetworkProxy::NoProxy)-
91#endif-
92 , preConnectRequests(0)-
93 , connectionType(type)-
94{-
95 channels = new QHttpNetworkConnectionChannel[channelCount];-
96}
executed 575 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
575
97-
98QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName,-
99 quint16 port, bool encrypt,-
100 QHttpNetworkConnection::ConnectionType type)-
101: state(RunningState), networkLayerState(Unknown),-
102 hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true),-
103 channelCount(channelCount)-
104#ifndef QT_NO_NETWORKPROXY-
105 , networkProxy(QNetworkProxy::NoProxy)-
106#endif-
107 , preConnectRequests(0)-
108 , connectionType(type)-
109{-
110 channels = new QHttpNetworkConnectionChannel[channelCount];-
111}
executed 8 times by 1 test: end of block
Executed by:
  • tst_QHttpNetworkConnection
8
112-
113-
114-
115QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()-
116{-
117 for (int i = 0; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 3410 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
FALSEevaluated 582 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
582-3410
118 if (channels[i].socket) {
channels[i].socketDescription
TRUEevaluated 752 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
FALSEevaluated 2658 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
752-2658
119 QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR);-
120 channels[i].socket->close();-
121 delete channels[i].socket;-
122 }
executed 752 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
752
123 }
executed 3410 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
3410
124 delete []channels;-
125}
executed 582 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
582
126-
127void QHttpNetworkConnectionPrivate::init()-
128{-
129 Q_Q(QHttpNetworkConnection);-
130 for (int i = 0; i < channelCount; i++) {
i < channelCountDescription
TRUEevaluated 3416 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 583 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
583-3416
131 channels[i].setConnection(this->q_func());-
132 channels[i].ssl = encrypt;-
133#ifndef QT_NO_BEARERMANAGEMENT-
134 //push session down to channels-
135 channels[i].networkSession = networkSession;-
136#endif-
137 }
executed 3416 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
3416
138-
139 delayedConnectionTimer.setSingleShot(true);-
140 QObject::connect(&delayedConnectionTimer, SIGNAL(timeout()), q, SLOT(_q_connectDelayedChannel()));-
141}
executed 583 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
583
142-
143void QHttpNetworkConnectionPrivate::pauseConnection()-
144{-
145 state = PausedState;-
146-
147 // Disable all socket notifiers-
148 for (int i = 0; i < channelCount; i++) {
i < channelCountDescription
TRUEevaluated 1600 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 275 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
275-1600
149 if (channels[i].socket) {
channels[i].socketDescription
TRUEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 1275 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
325-1275
150#ifndef QT_NO_SSL-
151 if (encrypt)
encryptDescription
TRUEevaluated 128 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 197 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
128-197
152 QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
executed 128 times by 3 tests: QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
128
153 else-
154#endif-
155 QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
executed 197 times by 2 tests: QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
197
156 }-
157 }
executed 1600 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
1600
158}
executed 275 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
275
159-
160void QHttpNetworkConnectionPrivate::resumeConnection()-
161{-
162 state = RunningState;-
163 // Enable all socket notifiers-
164 for (int i = 0; i < channelCount; i++) {
i < channelCountDescription
TRUEevaluated 1600 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 275 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
275-1600
165 if (channels[i].socket) {
channels[i].socketDescription
TRUEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 1275 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
325-1275
166#ifndef QT_NO_SSL-
167 if (encrypt)
encryptDescription
TRUEevaluated 128 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 197 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
128-197
168 QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
executed 128 times by 3 tests: QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
128
169 else-
170#endif-
171 QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);
executed 197 times by 2 tests: QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
197
172-
173 // Resume pending upload if needed-
174 if (channels[i].state == QHttpNetworkConnectionChannel::WritingState)
channels[i].st...::WritingStateDescription
TRUEnever evaluated
FALSEevaluated 325 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-325
175 QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
never executed: QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
0
176 }
executed 325 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
325
177 }
executed 1600 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
1600
178-
179 // queue _q_startNextRequest-
180 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);-
181}
executed 275 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
275
182-
183int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const-
184{-
185 for (int i = 0; i < channelCount; ++i)
i < channelCountDescription
TRUEevaluated 16109 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-16109
186 if (channels[i].socket == socket)
channels[i].socket == socketDescription
TRUEevaluated 7294 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 8815 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
7294-8815
187 return i;
executed 7294 times by 8 tests: return i;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
7294
188-
189 qFatal("Called with unknown socket object.");-
190 return 0;
never executed: return 0;
0
191}-
192-
193// If the connection is in the HostLookupPendening state channel errors should not always be-
194// emitted. This function will check the status of the connection channels if we-
195// have not decided the networkLayerState and will return true if the channel error-
196// should be emitted by the channel.-
197bool QHttpNetworkConnectionPrivate::shouldEmitChannelError(QAbstractSocket *socket)-
198{-
199 Q_Q(QHttpNetworkConnection);-
200-
201 bool emitError = true;-
202 int i = indexOf(socket);-
203 int otherSocket = (i == 0 ? 1 : 0);
i == 0Description
TRUEevaluated 27 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 125 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
27-125
204-
205 // If the IPv4 connection still isn't started we need to start it now.-
206 if (delayedConnectionTimer.isActive()) {
delayedConnect...mer.isActive()Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 30 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
30-122
207 delayedConnectionTimer.stop();-
208 channels[otherSocket].ensureConnection();-
209 }
executed 122 times by 2 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
122
210-
211 if (channelCount == 1) {
channelCount == 1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 149 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
3-149
212 if (networkLayerState == HostLookupPending || networkLayerState == IPv4or6)
networkLayerSt...tLookupPendingDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_Spdy
networkLayerState == IPv4or6Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_Spdy
0-3
213 networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
never executed: networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
0
214 channels[0].close();-
215 emitError = true;-
216 } else {
executed 3 times by 1 test: end of block
Executed by:
  • tst_Spdy
3
217 if (networkLayerState == HostLookupPending || networkLayerState == IPv4or6) {
networkLayerSt...tLookupPendingDescription
TRUEnever evaluated
FALSEevaluated 149 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
networkLayerState == IPv4or6Description
TRUEevaluated 124 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-149
218 if (channels[otherSocket].isSocketBusy() && (channels[otherSocket].state != QHttpNetworkConnectionChannel::ClosingState)) {
channels[other...isSocketBusy()Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
(channels[othe...:ClosingState)Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEnever evaluated
0-122
219 // this was the first socket to fail.-
220 channels[i].close();-
221 emitError = false;-
222 }
executed 122 times by 2 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
122
223 else {-
224 // Both connection attempts has failed.-
225 networkLayerState = QHttpNetworkConnectionPrivate::Unknown;-
226 channels[i].close();-
227 emitError = true;-
228 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
2
229 } else {-
230 if (((networkLayerState == QHttpNetworkConnectionPrivate::IPv4) && (channels[i].networkLayerPreference != QAbstractSocket::IPv4Protocol))
(networkLayerS...Private::IPv4)Description
TRUEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
(channels[i].n...:IPv4Protocol)Description
TRUEnever evaluated
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-25
231 || ((networkLayerState == QHttpNetworkConnectionPrivate::IPv6) && (channels[i].networkLayerPreference != QAbstractSocket::IPv6Protocol))) {
(networkLayerS...Private::IPv6)Description
TRUEnever evaluated
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
(channels[i].n...:IPv6Protocol)Description
TRUEnever evaluated
FALSEnever evaluated
0-25
232 // First connection worked so this is the second one to complete and it failed.-
233 channels[i].close();-
234 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
235 emitError = false;-
236 }
never executed: end of block
0
237 if (networkLayerState == QHttpNetworkConnectionPrivate::Unknown)
networkLayerSt...ivate::UnknownDescription
TRUEnever evaluated
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-25
238 qWarning("We got a connection error when networkLayerState is Unknown");
never executed: QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("We got a connection error when networkLayerState is Unknown");
0
239 }
executed 25 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
25
240 }-
241 return emitError;
executed 152 times by 4 tests: return emitError;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
152
242}-
243-
244-
245qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const-
246{-
247 return reply.d_func()->responseData.byteAmount();
executed 12636 times by 1 test: return reply.d_func()->responseData.byteAmount();
Executed by:
  • tst_QHttpNetworkConnection
12636
248}-
249-
250qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const-
251{-
252 return reply.d_func()->responseData.sizeNextBlock();
never executed: return reply.d_func()->responseData.sizeNextBlock();
0
253}-
254-
255void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)-
256{-
257 QHttpNetworkRequest &request = messagePair.first;-
258 QHttpNetworkReply *reply = messagePair.second;-
259-
260 // add missing fields for the request-
261 QByteArray value;-
262 // check if Content-Length is provided-
263 QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice();-
264 if (uploadByteDevice) {
uploadByteDeviceDescription
TRUEevaluated 201 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1436 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
201-1436
265 const qint64 contentLength = request.contentLength();-
266 const qint64 uploadDeviceSize = uploadByteDevice->size();-
267 if (contentLength != -1 && uploadDeviceSize != -1) {
contentLength != -1Description
TRUEevaluated 131 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
uploadDeviceSize != -1Description
TRUEevaluated 130 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-131
268 // both values known, take the smaller one.-
269 request.setContentLength(qMin(uploadDeviceSize, contentLength));-
270 } else if (contentLength == -1 && uploadDeviceSize != -1) {
executed 130 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
contentLength == -1Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
uploadDeviceSize != -1Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-130
271 // content length not supplied by user, but the upload device knows it-
272 request.setContentLength(uploadDeviceSize);-
273 } else if (contentLength != -1 && uploadDeviceSize == -1) {
executed 70 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
contentLength != -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
uploadDeviceSize == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-70
274 // everything OK, the user supplied us the contentLength-
275 } else if (Q_UNLIKELY(contentLength == -1 && uploadDeviceSize == -1)) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
0-1
276 qFatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given");-
277 }
never executed: end of block
0
278 }
executed 201 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
201
279 // set the Connection/Proxy-Connection: Keep-Alive headers-
280#ifndef QT_NO_NETWORKPROXY-
281 if (networkProxy.type() == QNetworkProxy::HttpCachingProxy) {
networkProxy.t...tpCachingProxyDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1629 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
8-1629
282 value = request.headerField("proxy-connection");-
283 if (value.isEmpty())
value.isEmpty()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-8
284 request.setHeaderField("Proxy-Connection", "Keep-Alive");
executed 8 times by 1 test: request.setHeaderField("Proxy-Connection", "Keep-Alive");
Executed by:
  • tst_QNetworkReply
8
285 } else {
executed 8 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
8
286#endif-
287 value = request.headerField("connection");-
288 if (value.isEmpty())
value.isEmpty()Description
TRUEevaluated 1629 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-1629
289 request.setHeaderField("Connection", "Keep-Alive");
executed 1629 times by 8 tests: request.setHeaderField("Connection", "Keep-Alive");
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1629
290#ifndef QT_NO_NETWORKPROXY-
291 }
executed 1629 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
1629
292#endif-
293-
294 // If the request had a accept-encoding set, we better not mess-
295 // with it. If it was not set, we announce that we understand gzip-
296 // and remember this fact in request.d->autoDecompress so that-
297 // we can later decompress the HTTP reply if it has such an-
298 // encoding.-
299 value = request.headerField("accept-encoding");-
300 if (value.isEmpty()) {
value.isEmpty()Description
TRUEevaluated 1635 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 2 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
2-1635
301#ifndef QT_NO_COMPRESS-
302 request.setHeaderField("Accept-Encoding", "gzip, deflate");-
303 request.d->autoDecompress = true;-
304#else-
305 // if zlib is not available set this to false always-
306 request.d->autoDecompress = false;-
307#endif-
308 }
executed 1635 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
1635
309-
310 // some websites mandate an accept-language header and fail-
311 // if it is not sent. This is a problem with the website and-
312 // not with us, but we work around this by setting-
313 // one always.-
314 value = request.headerField("accept-language");-
315 if (value.isEmpty()) {
value.isEmpty()Description
TRUEevaluated 1637 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-1637
316 QString systemLocale = QLocale::system().name().replace(QChar::fromLatin1('_'),QChar::fromLatin1('-'));-
317 QString acceptLanguage;-
318 if (systemLocale == QLatin1String("C"))
systemLocale =...in1String("C")Description
TRUEnever evaluated
FALSEevaluated 1637 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-1637
319 acceptLanguage = QString::fromLatin1("en,*");
never executed: acceptLanguage = QString::fromLatin1("en,*");
0
320 else if (systemLocale.startsWith(QLatin1String("en-")))
systemLocale.s...String("en-"))Description
TRUEevaluated 1637 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-1637
321 acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);
executed 1637 times by 8 tests: acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1637
322 else-
323 acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale);
never executed: acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale);
0
324 request.setHeaderField("Accept-Language", acceptLanguage.toLatin1());-
325 }
executed 1637 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
1637
326-
327 // set the User Agent-
328 value = request.headerField("user-agent");-
329 if (value.isEmpty())
value.isEmpty()Description
TRUEevaluated 1633 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
4-1633
330 request.setHeaderField("User-Agent", "Mozilla/5.0");
executed 1633 times by 7 tests: request.setHeaderField("User-Agent", "Mozilla/5.0");
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
1633
331 // set the host-
332 value = request.headerField("host");-
333 if (value.isEmpty()) {
value.isEmpty()Description
TRUEevaluated 1636 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QXmlInputSource
1-1636
334 QHostAddress add;-
335 QByteArray host;-
336 if (add.setAddress(hostName)) {
add.setAddress(hostName)Description
TRUEevaluated 43 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 1593 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
43-1593
337 if (add.protocol() == QAbstractSocket::IPv6Protocol)
add.protocol()...::IPv6ProtocolDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 42 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
1-42
338 host = '[' + hostName.toLatin1() + ']'; //format the ipv6 in the standard way
executed 1 time by 1 test: host = '[' + hostName.toLatin1() + ']';
Executed by:
  • tst_QNetworkReply
1
339 else-
340 host = hostName.toLatin1();
executed 42 times by 3 tests: host = hostName.toLatin1();
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
42
341-
342 } else {-
343 host = QUrl::toAce(hostName);-
344 }
executed 1593 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
1593
345-
346 int port = request.url().port();-
347 if (port != -1) {
port != -1Description
TRUEevaluated 173 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 1463 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
173-1463
348 host += ':';-
349 host += QByteArray::number(port);-
350 }
executed 173 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
173
351-
352 request.setHeaderField("Host", host);-
353 }
executed 1636 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
1636
354-
355 reply->d_func()->requestIsPrepared = true;-
356}
executed 1637 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
1637
357-
358-
359-
360-
361void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket,-
362 QHttpNetworkReply *reply,-
363 QNetworkReply::NetworkError errorCode)-
364{-
365 Q_Q(QHttpNetworkConnection);-
366-
367 int i = 0;-
368 if (socket)
socketDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4-5
369 i = indexOf(socket);
executed 5 times by 2 tests: i = indexOf(socket);
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
5
370-
371 if (reply) {
replyDescription
TRUEevaluated 9 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-9
372 // this error matters only to this reply-
373 reply->d_func()->errorString = errorDetail(errorCode, socket);-
374 emit reply->finishedWithError(errorCode, reply->d_func()->errorString);-
375 // remove the corrupt data if any-
376 reply->d_func()->eraseData();-
377-
378 // Clean the channel-
379 channels[i].close();-
380 channels[i].reply = 0;-
381 if (channels[i].protocolHandler)
channels[i].protocolHandlerDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4-5
382 channels[i].protocolHandler->setReply(0);
executed 5 times by 2 tests: channels[i].protocolHandler->setReply(0);
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
5
383 channels[i].request = QHttpNetworkRequest();-
384 if (socket)
socketDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4-5
385 channels[i].requeueCurrentlyPipelinedRequests();
executed 5 times by 2 tests: channels[i].requeueCurrentlyPipelinedRequests();
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
5
386-
387 // send the next request-
388 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
389 }
executed 9 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
9
390}
executed 9 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
9
391-
392void QHttpNetworkConnectionPrivate::copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy)-
393{-
394 Q_ASSERT(auth);-
395-
396 // NTLM is a multi phase authentication. Copying credentials between authenticators would mess things up.-
397 if (fromChannel >= 0) {
fromChannel >= 0Description
TRUEevaluated 201 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-201
398 if (!isProxy && channels[fromChannel].authMethod == QAuthenticatorPrivate::Ntlm)
!isProxyDescription
TRUEevaluated 135 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 66 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
channels[fromC...rPrivate::NtlmDescription
TRUEnever evaluated
FALSEevaluated 135 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-135
399 return;
never executed: return;
0
400 if (isProxy && channels[fromChannel].proxyAuthMethod == QAuthenticatorPrivate::Ntlm)
isProxyDescription
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 135 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
channels[fromC...rPrivate::NtlmDescription
TRUEnever evaluated
FALSEevaluated 66 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-135
401 return;
never executed: return;
0
402 }
executed 201 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
201
403-
404 // select another channel-
405 QAuthenticator* otherAuth = 0;-
406 for (int i = 0; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 1191 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 201 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
201-1191
407 if (i == fromChannel)
i == fromChannelDescription
TRUEevaluated 201 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 990 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
201-990
408 continue;
executed 201 times by 3 tests: continue;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
201
409 if (isProxy)
isProxyDescription
TRUEevaluated 315 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 675 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
315-675
410 otherAuth = &channels[i].proxyAuthenticator;
executed 315 times by 1 test: otherAuth = &channels[i].proxyAuthenticator;
Executed by:
  • tst_QNetworkReply
315
411 else-
412 otherAuth = &channels[i].authenticator;
executed 675 times by 2 tests: otherAuth = &channels[i].authenticator;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
675
413 // if the credentials are different, copy them-
414 if (otherAuth->user().compare(auth->user()))
otherAuth->use...(auth->user())Description
TRUEevaluated 735 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 255 times by 1 test
Evaluated by:
  • tst_QNetworkReply
255-735
415 otherAuth->setUser(auth->user());
executed 735 times by 2 tests: otherAuth->setUser(auth->user());
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
735
416 if (otherAuth->password().compare(auth->password()))
otherAuth->pas...h->password())Description
TRUEevaluated 745 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 245 times by 1 test
Evaluated by:
  • tst_QNetworkReply
245-745
417 otherAuth->setPassword(auth->password());
executed 745 times by 2 tests: otherAuth->setPassword(auth->password());
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
745
418 }
executed 990 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
990
419}
executed 201 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
201
420-
421-
422// handles the authentication for one channel and eventually re-starts the other channels-
423bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply,-
424 bool isProxy, bool &resend)-
425{-
426 Q_ASSERT(socket);-
427 Q_ASSERT(reply);-
428-
429 resend = false;-
430 //create the response header to be used with QAuthenticatorPrivate.-
431 QList<QPair<QByteArray, QByteArray> > fields = reply->header();-
432-
433 //find out the type of authentication protocol requested.-
434 QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy);-
435 if (authMethod != QAuthenticatorPrivate::None) {
authMethod != ...rPrivate::NoneDescription
TRUEevaluated 353 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-353
436 int i = indexOf(socket);-
437 //Use a single authenticator for all domains. ### change later to use domain/realm-
438 QAuthenticator* auth = 0;-
439 if (isProxy) {
isProxyDescription
TRUEevaluated 53 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 300 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
53-300
440 auth = &channels[i].proxyAuthenticator;-
441 channels[i].proxyAuthMethod = authMethod;-
442 } else {
executed 53 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
53
443 auth = &channels[i].authenticator;-
444 channels[i].authMethod = authMethod;-
445 }
executed 300 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
300
446 //proceed with the authentication.-
447 if (auth->isNull())
auth->isNull()Description
TRUEnever evaluated
FALSEevaluated 353 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-353
448 auth->detach();
never executed: auth->detach();
0
449 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);-
450 priv->parseHttpResponse(fields, isProxy);-
451-
452 if (priv->phase == QAuthenticatorPrivate::Done) {
priv->phase ==...rPrivate::DoneDescription
TRUEevaluated 179 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 174 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
174-179
453 pauseConnection();-
454 if (!isProxy) {
!isProxyDescription
TRUEevaluated 152 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QNetworkReply
27-152
455 if (channels[i].authenticationCredentialsSent) {
channels[i].au...redentialsSentDescription
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
52-100
456 auth->detach();-
457 priv = QAuthenticatorPrivate::getPrivate(*auth);-
458 priv->hasFailed = true;-
459 priv->phase = QAuthenticatorPrivate::Done;-
460 channels[i].authenticationCredentialsSent = false;-
461 }
executed 52 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
52
462 emit reply->authenticationRequired(reply->request(), auth);-
463#ifndef QT_NO_NETWORKPROXY-
464 } else {
executed 152 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
152
465 if (channels[i].proxyCredentialsSent) {
channels[i].pr...redentialsSentDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QNetworkReply
2-25
466 auth->detach();-
467 priv = QAuthenticatorPrivate::getPrivate(*auth);-
468 priv->hasFailed = true;-
469 priv->phase = QAuthenticatorPrivate::Done;-
470 channels[i].proxyCredentialsSent = false;-
471 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
472 emit reply->proxyAuthenticationRequired(networkProxy, auth);-
473#endif-
474 }
executed 27 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
27
475 resumeConnection();-
476-
477 if (priv->phase != QAuthenticatorPrivate::Done) {
priv->phase !=...rPrivate::DoneDescription
TRUEevaluated 141 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
38-141
478 // send any pending requests-
479 copyCredentials(i, auth, isProxy);-
480 }
executed 141 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
141
481 } else if (priv->phase == QAuthenticatorPrivate::Start) {
executed 179 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
priv->phase ==...Private::StartDescription
TRUEevaluated 174 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-179
482 // If the url's authenticator has a 'user' set we will end up here (phase is only set to 'Done' by-
483 // parseHttpResponse above if 'user' is empty). So if credentials were supplied with the request,-
484 // such as in the case of an XMLHttpRequest, this is our only opportunity to cache them.-
485 emit reply->cacheCredentials(reply->request(), auth);-
486 }
executed 174 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
174
487 // - Changing values in QAuthenticator will reset the 'phase'. Therefore if it is still "Done"-
488 // then nothing was filled in by the user or the cache-
489 // - If withCredentials has been set to false (e.g. by Qt WebKit for a cross-origin XMLHttpRequest) then-
490 // we need to bail out if authentication is required.-
491 if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
priv->phase ==...rPrivate::DoneDescription
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 315 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
!reply->reques...hCredentials()Description
TRUEnever evaluated
FALSEevaluated 315 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-315
492 // Reset authenticator so the next request on that channel does not get messed up-
493 auth = 0;-
494 if (isProxy)
isProxyDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
3-35
495 channels[i].proxyAuthenticator = QAuthenticator();
executed 3 times by 1 test: channels[i].proxyAuthenticator = QAuthenticator();
Executed by:
  • tst_QNetworkReply
3
496 else-
497 channels[i].authenticator = QAuthenticator();
executed 35 times by 2 tests: channels[i].authenticator = QAuthenticator();
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
35
498-
499 // authentication is cancelled, send the current contents to the user.-
500 emit channels[i].reply->headerChanged();-
501 emit channels[i].reply->readyRead();-
502 QNetworkReply::NetworkError errorCode =-
503 isProxy
isProxyDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
3-35
504 ? QNetworkReply::ProxyAuthenticationRequiredError-
505 : QNetworkReply::AuthenticationRequiredError;-
506 reply->d_func()->errorString = errorDetail(errorCode, socket);-
507 emit reply->finishedWithError(errorCode, reply->d_func()->errorString);-
508 // ### at this point the reply could be deleted-
509 return true;
executed 38 times by 2 tests: return true;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
38
510 }-
511 //resend the request-
512 resend = true;-
513 return true;
executed 315 times by 2 tests: return true;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
315
514 }-
515 return false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
3
516}-
517-
518QUrl QHttpNetworkConnectionPrivate::parseRedirectResponse(QAbstractSocket *socket, QHttpNetworkReply *reply)-
519{-
520 if (!reply->request().isFollowRedirects())
!reply->reques...lowRedirects()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkProxyFactory
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-6
521 return QUrl();
executed 3 times by 1 test: return QUrl();
Executed by:
  • tst_QNetworkProxyFactory
3
522-
523 QUrl rUrl;-
524 const QList<QPair<QByteArray, QByteArray> > fields = reply->header();-
525 for (const QNetworkReply::RawHeaderPair &header : fields) {-
526 if (header.first.toLower() == "location") {
header.first.t... == "location"Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
6
527 rUrl = QUrl::fromEncoded(header.second);-
528 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
6
529 }-
530 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
6
531-
532 // If the location url is invalid/empty, we emit ProtocolUnknownError-
533 if (!rUrl.isValid()) {
!rUrl.isValid()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-6
534 emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError);-
535 return QUrl();
never executed: return QUrl();
0
536 }-
537-
538 // Check if we have exceeded max redirects allowed-
539 if (reply->request().redirectCount() <= 0) {
reply->request...ctCount() <= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
1-5
540 emitReplyError(socket, reply, QNetworkReply::TooManyRedirectsError);-
541 return QUrl();
executed 1 time by 1 test: return QUrl();
Executed by:
  • tst_QNetworkReply
1
542 }-
543-
544 // Resolve the URL if it's relative-
545 if (rUrl.isRelative())
rUrl.isRelative()Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-5
546 rUrl = reply->request().url().resolved(rUrl);
never executed: rUrl = reply->request().url().resolved(rUrl);
0
547-
548 // Check redirect url protocol-
549 QString scheme = rUrl.scheme();-
550 if (scheme == QLatin1String("http") || scheme == QLatin1String("https")) {
scheme == QLat...String("http")Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
scheme == QLat...tring("https")Description
TRUEnever evaluated
FALSEnever evaluated
0-5
551 QString previousUrlScheme = reply->request().url().scheme();-
552 // Check if we're doing an unsecure redirect (https -> http)-
553 if (previousUrlScheme == QLatin1String("https")
previousUrlSch...tring("https")Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-5
554 && scheme == QLatin1String("http")) {
scheme == QLat...String("http")Description
TRUEnever evaluated
FALSEnever evaluated
0
555 emitReplyError(socket, reply, QNetworkReply::InsecureRedirectError);-
556 return QUrl();
never executed: return QUrl();
0
557 }-
558 } else {
executed 5 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
5
559 emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError);-
560 return QUrl();
never executed: return QUrl();
0
561 }-
562 return rUrl;
executed 5 times by 1 test: return rUrl;
Executed by:
  • tst_QNetworkReply
5
563}-
564-
565void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request)-
566{-
567 Q_ASSERT(socket);-
568-
569 int i = indexOf(socket);-
570-
571 // Send "Authorization" header, but not if it's NTLM and the socket is already authenticated.-
572 if (channels[i].authMethod != QAuthenticatorPrivate::None) {
channels[i].au...rPrivate::NoneDescription
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 1149 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
172-1149
573 if ((channels[i].authMethod != QAuthenticatorPrivate::Ntlm && request.headerField("Authorization").isEmpty()) || channels[i].lastStatus == 401) {
channels[i].au...rPrivate::NtlmDescription
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
request.header...on").isEmpty()Description
TRUEevaluated 137 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QNetworkReply
channels[i].lastStatus == 401Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-172
574 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator);-
575 if (priv && priv->method != QAuthenticatorPrivate::None) {
privDescription
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
priv->method !...rPrivate::NoneDescription
TRUEevaluated 152 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-172
576 QByteArray response = priv->calculateResponse(request.methodName(), request.uri(false));-
577 request.setHeaderField("Authorization", response);-
578 channels[i].authenticationCredentialsSent = true;-
579 }
executed 152 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
152
580 }
executed 172 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
172
581 }
executed 172 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
172
582-
583 // Send "Proxy-Authorization" header, but not if it's NTLM and the socket is already authenticated.-
584 if (channels[i].proxyAuthMethod != QAuthenticatorPrivate::None) {
channels[i].pr...rPrivate::NoneDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1281 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
40-1281
585 if (!(channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 407)) {
channels[i].pr...rPrivate::NtlmDescription
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_QNetworkReply
channels[i].lastStatus != 407Description
TRUEnever evaluated
FALSEnever evaluated
0-40
586 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].proxyAuthenticator);-
587 if (priv && priv->method != QAuthenticatorPrivate::None) {
privDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
priv->method !...rPrivate::NoneDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-40
588 QByteArray response = priv->calculateResponse(request.methodName(), request.uri(false));-
589 request.setHeaderField("Proxy-Authorization", response);-
590 channels[i].proxyCredentialsSent = true;-
591 }
executed 38 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
38
592 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
40
593 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
40
594}
executed 1321 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
1321
595-
596QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetworkRequest &request)-
597{-
598 Q_Q(QHttpNetworkConnection);-
599-
600 // The reply component of the pair is created initially.-
601 QHttpNetworkReply *reply = new QHttpNetworkReply(request.url());-
602 reply->setRequest(request);-
603 reply->d_func()->connection = q;-
604 reply->d_func()->connectionChannel = &channels[0]; // will have the correct one set later-
605 HttpMessagePair pair = qMakePair(request, reply);-
606-
607 if (request.isPreConnect())
request.isPreConnect()Description
TRUEnever evaluated
FALSEevaluated 1646 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-1646
608 preConnectRequests++;
never executed: preConnectRequests++;
0
609-
610 if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP) {
connectionType...ectionTypeHTTPDescription
TRUEevaluated 1534 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 112 times by 1 test
Evaluated by:
  • tst_Spdy
112-1534
611 switch (request.priority()) {-
612 case QHttpNetworkRequest::HighPriority:
executed 116 times by 1 test: case QHttpNetworkRequest::HighPriority:
Executed by:
  • tst_QHttpNetworkConnection
116
613 highPriorityQueue.prepend(pair);-
614 break;
executed 116 times by 1 test: break;
Executed by:
  • tst_QHttpNetworkConnection
116
615 case QHttpNetworkRequest::NormalPriority:
executed 1362 times by 8 tests: case QHttpNetworkRequest::NormalPriority:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1362
616 case QHttpNetworkRequest::LowPriority:
executed 56 times by 1 test: case QHttpNetworkRequest::LowPriority:
Executed by:
  • tst_QHttpNetworkConnection
56
617 lowPriorityQueue.prepend(pair);-
618 break;
executed 1418 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
1418
619 }-
620 }
executed 1534 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
1534
621#ifndef QT_NO_SSL-
622 else { // SPDY-
623 if (!pair.second->d_func()->requestIsPrepared)
!pair.second->...uestIsPreparedDescription
TRUEevaluated 112 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-112
624 prepareRequest(pair);
executed 112 times by 1 test: prepareRequest(pair);
Executed by:
  • tst_Spdy
112
625 channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair);-
626 }
executed 112 times by 1 test: end of block
Executed by:
  • tst_Spdy
112
627#endif // QT_NO_SSL-
628-
629 // For Happy Eyeballs the networkLayerState is set to Unknown-
630 // untill we have started the first connection attempt. So no-
631 // request will be started untill we know if IPv4 or IPv6-
632 // should be used.-
633 if (networkLayerState == Unknown || networkLayerState == HostLookupPending) {
networkLayerState == UnknownDescription
TRUEevaluated 583 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 1063 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
networkLayerSt...tLookupPendingDescription
TRUEnever evaluated
FALSEevaluated 1063 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-1063
634 startHostInfoLookup();-
635 } else if ( networkLayerState == IPv4 || networkLayerState == IPv6 ) {
executed 583 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
networkLayerState == IPv4Description
TRUEevaluated 1061 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
networkLayerState == IPv6Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1061
636 // this used to be called via invokeMethod and a QueuedConnection-
637 // It is the only place _q_startNextRequest is called directly without going-
638 // through the event loop using a QueuedConnection.-
639 // This is dangerous because of recursion that might occur when emitting-
640 // signals as DirectConnection from this code path. Therefore all signal-
641 // emissions that can come out from this code path need to-
642 // be QueuedConnection.-
643 // We are currently trying to fine-tune this.-
644 _q_startNextRequest();-
645 }
executed 1061 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
1061
646 return reply;
executed 1646 times by 8 tests: return reply;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1646
647}-
648-
649void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair)-
650{-
651 Q_Q(QHttpNetworkConnection);-
652-
653 QHttpNetworkRequest request = pair.first;-
654 switch (request.priority()) {-
655 case QHttpNetworkRequest::HighPriority:
never executed: case QHttpNetworkRequest::HighPriority:
0
656 highPriorityQueue.prepend(pair);-
657 break;
never executed: break;
0
658 case QHttpNetworkRequest::NormalPriority:
never executed: case QHttpNetworkRequest::NormalPriority:
0
659 case QHttpNetworkRequest::LowPriority:
never executed: case QHttpNetworkRequest::LowPriority:
0
660 lowPriorityQueue.prepend(pair);-
661 break;
never executed: break;
0
662 }-
663-
664 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
665}
never executed: end of block
0
666-
667bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket)-
668{-
669 int i = 0;-
670 if (socket)
socketDescription
TRUEevaluated 1151 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 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4-1151
671 i = indexOf(socket);
executed 1151 times by 8 tests: i = indexOf(socket);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1151
672-
673 if (!highPriorityQueue.isEmpty()) {
!highPriorityQueue.isEmpty()Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 1101 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
54-1101
674 // remove from queue before sendRequest! else we might pipeline the same request again-
675 HttpMessagePair messagePair = highPriorityQueue.takeLast();-
676 if (!messagePair.second->d_func()->requestIsPrepared)
!messagePair.s...uestIsPreparedDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEnever evaluated
0-54
677 prepareRequest(messagePair);
executed 54 times by 1 test: prepareRequest(messagePair);
Executed by:
  • tst_QHttpNetworkConnection
54
678 updateChannel(i, messagePair);-
679 return true;
executed 54 times by 1 test: return true;
Executed by:
  • tst_QHttpNetworkConnection
54
680 }-
681-
682 if (!lowPriorityQueue.isEmpty()) {
!lowPriorityQueue.isEmpty()Description
TRUEevaluated 1069 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 32 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
32-1069
683 // remove from queue before sendRequest! else we might pipeline the same request again-
684 HttpMessagePair messagePair = lowPriorityQueue.takeLast();-
685 if (!messagePair.second->d_func()->requestIsPrepared)
!messagePair.s...uestIsPreparedDescription
TRUEevaluated 1069 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-1069
686 prepareRequest(messagePair);
executed 1069 times by 8 tests: prepareRequest(messagePair);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1069
687 updateChannel(i, messagePair);-
688 return true;
executed 1069 times by 8 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1069
689 }-
690 return false;
executed 32 times by 3 tests: return false;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
32
691}-
692-
693void QHttpNetworkConnectionPrivate::updateChannel(int i, const HttpMessagePair &messagePair)-
694{-
695 channels[i].request = messagePair.first;-
696 channels[i].reply = messagePair.second;-
697 // Now that reply is assigned a channel, correct reply to channel association-
698 // previously set in queueRequest.-
699 channels[i].reply->d_func()->connectionChannel = &channels[i];-
700}
executed 1123 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
1123
701-
702QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest() const-
703{-
704 if (!highPriorityQueue.isEmpty())
!highPriorityQueue.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-21
705 return highPriorityQueue.last().first;
never executed: return highPriorityQueue.last().first;
0
706 if (!lowPriorityQueue.isEmpty())
!lowPriorityQueue.isEmpty()Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_Spdy
4-17
707 return lowPriorityQueue.last().first;
executed 17 times by 1 test: return lowPriorityQueue.last().first;
Executed by:
  • tst_QNetworkReply
17
708 return QHttpNetworkRequest();
executed 4 times by 1 test: return QHttpNetworkRequest();
Executed by:
  • tst_Spdy
4
709}-
710-
711// this is called from _q_startNextRequest and when a request has been sent down a socket from the channel-
712void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket)-
713{-
714 // return fast if there is nothing to pipeline-
715 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
highPriorityQueue.isEmpty()Description
TRUEevaluated 3929 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 358 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
lowPriorityQueue.isEmpty()Description
TRUEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3894 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
35-3929
716 return;
executed 35 times by 2 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
35
717-
718 int i = indexOf(socket);-
719-
720 // return fast if there was no reply right now processed-
721 if (channels[i].reply == 0)
channels[i].reply == 0Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4219 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
33-4219
722 return;
executed 33 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
33
723-
724 if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)) {
! (defaultPipe...ipelineLength)Description
TRUEevaluated 1034 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3185 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
1034-3185
725 return;
executed 1034 times by 2 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
1034
726 }-
727-
728 if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported)
channels[i].pi...bablySupportedDescription
TRUEevaluated 316 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2869 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
316-2869
729 return;
executed 316 times by 2 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
316
730-
731 // the current request that is in must already support pipelining-
732 if (!channels[i].request.isPipeliningAllowed())
!channels[i].r...iningAllowed()Description
TRUEevaluated 2599 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 270 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
270-2599
733 return;
executed 2599 times by 2 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
2599
734-
735 // the current request must be a idempotent (right now we only check GET)-
736 if (channels[i].request.operation() != QHttpNetworkRequest::Get)
channels[i].re...rkRequest::GetDescription
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
64-206
737 return;
executed 64 times by 1 test: return;
Executed by:
  • tst_QHttpNetworkConnection
64
738-
739 // check if socket is connected-
740 if (socket->state() != QAbstractSocket::ConnectedState)
socket->state(...ConnectedStateDescription
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
741 return;
never executed: return;
0
742-
743 // check for resendCurrent-
744 if (channels[i].resendCurrent)
channels[i].resendCurrentDescription
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
745 return;
never executed: return;
0
746-
747 // we do not like authentication stuff-
748 // ### make sure to be OK with this in later releases-
749 if (!channels[i].authenticator.isNull()
!channels[i].a...cator.isNull()Description
TRUEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-206
750 && (!channels[i].authenticator.user().isEmpty()
!channels[i].a...er().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
751 || !channels[i].authenticator.password().isEmpty()))
!channels[i].a...rd().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
752 return;
never executed: return;
0
753 if (!channels[i].proxyAuthenticator.isNull()
!channels[i].p...cator.isNull()Description
TRUEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-206
754 && (!channels[i].proxyAuthenticator.user().isEmpty()
!channels[i].p...er().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
755 || !channels[i].proxyAuthenticator.password().isEmpty()))
!channels[i].p...rd().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 206 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-206
756 return;
never executed: return;
0
757-
758 // must be in ReadingState or WaitingState-
759 if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState
channels[i].st...::WaitingStateDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 190 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
16-190
760 || channels[i].state == QHttpNetworkConnectionChannel::ReadingState))
channels[i].st...::ReadingStateDescription
TRUEevaluated 190 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEnever evaluated
0-190
761 return;
never executed: return;
0
762-
763 int lengthBefore;-
764 while (!highPriorityQueue.isEmpty()) {
!highPriorityQueue.isEmpty()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 176 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
62-176
765 lengthBefore = channels[i].alreadyPipelinedRequests.length();-
766 fillPipeline(highPriorityQueue, channels[i]);-
767-
768 if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
channels[i].al...PipelineLengthDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
30-32
769 channels[i].pipelineFlush();-
770 return;
executed 30 times by 1 test: return;
Executed by:
  • tst_QHttpNetworkConnection
30
771 }-
772-
773 if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
lengthBefore =...uests.length()Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
0-32
774 break; // did not process anything, now do the low prio queue
never executed: break;
0
775 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_QHttpNetworkConnection
32
776-
777 while (!lowPriorityQueue.isEmpty()) {
!lowPriorityQueue.isEmpty()Description
TRUEevaluated 351 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
3-351
778 lengthBefore = channels[i].alreadyPipelinedRequests.length();-
779 fillPipeline(lowPriorityQueue, channels[i]);-
780-
781 if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
channels[i].al...PipelineLengthDescription
TRUEevaluated 162 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 189 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
162-189
782 channels[i].pipelineFlush();-
783 return;
executed 162 times by 2 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
162
784 }-
785-
786 if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
lengthBefore =...uests.length()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 178 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
11-178
787 break; // did not process anything
executed 11 times by 1 test: break;
Executed by:
  • tst_QHttpNetworkConnection
11
788 }
executed 178 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
178
789-
790-
791 channels[i].pipelineFlush();-
792}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
14
793-
794// returns true when the processing of a queue has been done-
795bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue, QHttpNetworkConnectionChannel &channel)-
796{-
797 if (queue.isEmpty())
queue.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 413 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-413
798 return true;
never executed: return true;
0
799-
800 for (int i = queue.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEevaluated 772 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
11-772
801 HttpMessagePair messagePair = queue.at(i);-
802 const QHttpNetworkRequest &request = messagePair.first;-
803-
804 // we currently do not support pipelining if HTTP authentication is used-
805 if (!request.url().userInfo().isEmpty())
!request.url()...fo().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 772 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-772
806 continue;
never executed: continue;
0
807-
808 // take only GET requests-
809 if (request.operation() != QHttpNetworkRequest::Get)
request.operat...rkRequest::GetDescription
TRUEevaluated 370 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEevaluated 402 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
370-402
810 continue;
executed 370 times by 1 test: continue;
Executed by:
  • tst_QHttpNetworkConnection
370
811-
812 if (!request.isPipeliningAllowed())
!request.isPipeliningAllowed()Description
TRUEnever evaluated
FALSEevaluated 402 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-402
813 continue;
never executed: continue;
0
814-
815 // remove it from the queue-
816 queue.takeAt(i);-
817 // we modify the queue we iterate over here, but since we return from the function-
818 // afterwards this is fine.-
819-
820 // actually send it-
821 if (!messagePair.second->d_func()->requestIsPrepared)
!messagePair.s...uestIsPreparedDescription
TRUEevaluated 402 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-402
822 prepareRequest(messagePair);
executed 402 times by 2 tests: prepareRequest(messagePair);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
402
823 channel.pipelineInto(messagePair);-
824-
825 // return false because we processed something and need to process again-
826 return false;
executed 402 times by 2 tests: return false;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
402
827 }-
828-
829 // return true, the queue has been processed and not changed-
830 return true;
executed 11 times by 1 test: return true;
Executed by:
  • tst_QHttpNetworkConnection
11
831}-
832-
833-
834QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail)-
835{-
836 QString errorString;-
837 switch (errorCode) {-
838 case QNetworkReply::HostNotFoundError:
executed 6 times by 3 tests: case QNetworkReply::HostNotFoundError:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
6
839 if (socket)
socketDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
2-4
840 errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
executed 2 times by 1 test: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
Executed by:
  • tst_QNetworkReply
2
841 else-
842 errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);
executed 4 times by 3 tests: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4
843 break;
executed 6 times by 3 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
6
844 case QNetworkReply::ConnectionRefusedError:
executed 124 times by 2 tests: case QNetworkReply::ConnectionRefusedError:
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
124
845 errorString = QCoreApplication::translate("QHttp", "Connection refused");-
846 break;
executed 124 times by 2 tests: break;
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
124
847 case QNetworkReply::RemoteHostClosedError:
executed 35 times by 3 tests: case QNetworkReply::RemoteHostClosedError:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
35
848 errorString = QCoreApplication::translate("QHttp", "Connection closed");-
849 break;
executed 35 times by 3 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
35
850 case QNetworkReply::TimeoutError:
never executed: case QNetworkReply::TimeoutError:
0
851 errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out");-
852 break;
never executed: break;
0
853 case QNetworkReply::ProxyAuthenticationRequiredError:
executed 9 times by 2 tests: case QNetworkReply::ProxyAuthenticationRequiredError:
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
9
854 errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication");-
855 break;
executed 9 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
9
856 case QNetworkReply::AuthenticationRequiredError:
executed 37 times by 2 tests: case QNetworkReply::AuthenticationRequiredError:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
37
857 errorString = QCoreApplication::translate("QHttp", "Host requires authentication");-
858 break;
executed 37 times by 2 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
37
859 case QNetworkReply::ProtocolFailure:
executed 1 time by 1 test: case QNetworkReply::ProtocolFailure:
Executed by:
  • tst_QNetworkReply
1
860 errorString = QCoreApplication::translate("QHttp", "Data corrupted");-
861 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QNetworkReply
1
862 case QNetworkReply::ProtocolUnknownError:
never executed: case QNetworkReply::ProtocolUnknownError:
0
863 errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified");-
864 break;
never executed: break;
0
865 case QNetworkReply::SslHandshakeFailedError:
executed 12 times by 3 tests: case QNetworkReply::SslHandshakeFailedError:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
12
866 errorString = QCoreApplication::translate("QHttp", "SSL handshake failed");-
867 break;
executed 12 times by 3 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
12
868 case QNetworkReply::TooManyRedirectsError:
executed 1 time by 1 test: case QNetworkReply::TooManyRedirectsError:
Executed by:
  • tst_QNetworkReply
1
869 errorString = QCoreApplication::translate("QHttp", "Too many redirects");-
870 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QNetworkReply
1
871 case QNetworkReply::InsecureRedirectError:
never executed: case QNetworkReply::InsecureRedirectError:
0
872 errorString = QCoreApplication::translate("QHttp", "Insecure redirect");-
873 break;
never executed: break;
0
874 default:
executed 4 times by 2 tests: default:
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
4
875 // all other errors are treated as QNetworkReply::UnknownNetworkError-
876 errorString = extraDetail;-
877 break;
executed 4 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
4
878 }-
879 return errorString;
executed 229 times by 4 tests: return errorString;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
229
880}-
881-
882// this is called from the destructor of QHttpNetworkReply. It is called when-
883// the reply was finished correctly or when it was aborted.-
884void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply)-
885{-
886 Q_Q(QHttpNetworkConnection);-
887-
888 // check if the reply is currently being processed or it is pipelined in-
889 for (int i = 0; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 6232 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 1537 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
1537-6232
890 // is the reply associated the currently processing of this channel?-
891 if (channels[i].reply == reply) {
channels[i].reply == replyDescription
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 6207 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
25-6207
892 channels[i].reply = 0;-
893 if (channels[i].protocolHandler)
channels[i].protocolHandlerDescription
TRUEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEnever evaluated
0-25
894 channels[i].protocolHandler->setReply(0);
executed 25 times by 3 tests: channels[i].protocolHandler->setReply(0);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
25
895 channels[i].request = QHttpNetworkRequest();-
896 channels[i].resendCurrent = false;-
897-
898 if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) {
!reply->isFinished()Description
TRUEevaluated 19 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
!channels[i].a...ests.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 19 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
0-19
899 // the reply had to be prematurely removed, e.g. it was not finished-
900 // therefore we have to requeue the already pipelined requests.-
901 channels[i].requeueCurrentlyPipelinedRequests();-
902 }
never executed: end of block
0
903-
904 // if HTTP mandates we should close-
905 // or the reply is not finished yet, e.g. it was aborted-
906 // we have to close that connection-
907 if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished()) {
reply->d_func(...CloseEnabled()Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
!reply->isFinished()Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-20
908 if (reply->isAborted()) {
reply->isAborted()Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
12-13
909 channels[i].abort();-
910 } else {
executed 13 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
13
911 channels[i].close();-
912 }
executed 11 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
11
913 }-
914-
915 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
916 return;
executed 24 times by 3 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
24
917 }-
918-
919 // is the reply inside the pipeline of this channel already?-
920 for (int j = 0; j < channels[i].alreadyPipelinedRequests.length(); j++) {
j < channels[i...uests.length()Description
TRUEevaluated 105 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6207 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
105-6207
921 if (channels[i].alreadyPipelinedRequests.at(j).second == reply) {
channels[i].al...econd == replyDescription
TRUEnever evaluated
FALSEevaluated 105 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-105
922 // Remove that HttpMessagePair-
923 channels[i].alreadyPipelinedRequests.removeAt(j);-
924-
925 channels[i].requeueCurrentlyPipelinedRequests();-
926-
927 // Since some requests had already been pipelined, but we removed-
928 // one and re-queued the others-
929 // we must force a connection close after the request that is-
930 // currently in processing has been finished.-
931 if (channels[i].reply)
channels[i].replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
932 channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
never executed: channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
0
933-
934 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
935 return;
never executed: return;
0
936 }-
937 }
executed 105 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
105
938#ifndef QT_NO_SSL-
939 // is the reply inside the SPDY pipeline of this channel already?-
940 QMultiMap<int, HttpMessagePair>::iterator it = channels[i].spdyRequestsToSend.begin();-
941 QMultiMap<int, HttpMessagePair>::iterator end = channels[i].spdyRequestsToSend.end();-
942 for (; it != end; ++it) {
it != endDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 6202 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
5-6202
943 if (it.value().second == reply) {
it.value().second == replyDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-5
944 channels[i].spdyRequestsToSend.remove(it.key());-
945-
946 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
947 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_Spdy
5
948 }-
949 }
never executed: end of block
0
950#endif-
951 }
executed 6202 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
6202
952 // remove from the high priority queue-
953 if (!highPriorityQueue.isEmpty()) {
!highPriorityQueue.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1537 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-1537
954 for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
j >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
955 HttpMessagePair messagePair = highPriorityQueue.at(j);-
956 if (messagePair.second == reply) {
messagePair.second == replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
957 highPriorityQueue.removeAt(j);-
958 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
959 return;
never executed: return;
0
960 }-
961 }
never executed: end of block
0
962 }
never executed: end of block
0
963 // remove from the low priority queue-
964 if (!lowPriorityQueue.isEmpty()) {
!lowPriorityQueue.isEmpty()Description
TRUEevaluated 90 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 1447 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
90-1447
965 for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
j >= 0Description
TRUEevaluated 437 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 83 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
83-437
966 HttpMessagePair messagePair = lowPriorityQueue.at(j);-
967 if (messagePair.second == reply) {
messagePair.second == replyDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 430 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
7-430
968 lowPriorityQueue.removeAt(j);-
969 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);-
970 return;
executed 7 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
7
971 }-
972 }
executed 430 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
430
973 }
executed 83 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
83
974}
executed 1530 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
1530
975-
976-
977-
978// This function must be called from the event loop. The only-
979// exception is documented in QHttpNetworkConnectionPrivate::queueRequest-
980// although it is called _q_startNextRequest, it will actually start multiple requests when possible-
981void QHttpNetworkConnectionPrivate::_q_startNextRequest()-
982{-
983 // If there is no network layer state decided we should not start any new requests.-
984 if (networkLayerState == Unknown || networkLayerState == HostLookupPending || networkLayerState == IPv4or6)
networkLayerState == UnknownDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 5341 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
networkLayerSt...tLookupPendingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 5339 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
networkLayerState == IPv4or6Description
TRUEnever evaluated
FALSEevaluated 5339 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-5341
985 return;
executed 5 times by 3 tests: return;
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
5
986-
987 // If the QHttpNetworkConnection is currently paused then bail out immediately-
988 if (state == PausedState)
state == PausedStateDescription
TRUEnever evaluated
FALSEevaluated 5339 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-5339
989 return;
never executed: return;
0
990-
991 //resend the necessary ones.-
992 for (int i = 0; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 25349 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 5339 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
5339-25349
993 if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) {
channels[i].resendCurrentDescription
TRUEevaluated 241 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 25108 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
(channels[i].s...:ClosingState)Description
TRUEevaluated 241 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-25108
994 channels[i].resendCurrent = false;-
995-
996 // if this is not possible, error will be emitted and connection terminated-
997 if (!channels[i].resetUploadData())
!channels[i].resetUploadData()Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
9-232
998 continue;
executed 9 times by 2 tests: continue;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
9
999 channels[i].sendRequest();-
1000 }
executed 232 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
232
1001 }
executed 25340 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
25340
1002-
1003 // dequeue new ones-
1004-
1005 switch (connectionType) {-
1006 case QHttpNetworkConnection::ConnectionTypeHTTP: {
executed 5214 times by 8 tests: case QHttpNetworkConnection::ConnectionTypeHTTP:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
5214
1007 // return fast if there is nothing to do-
1008 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
highPriorityQueue.isEmpty()Description
TRUEevaluated 4862 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 352 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
lowPriorityQueue.isEmpty()Description
TRUEevaluated 2551 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 2311 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
352-4862
1009 return;
executed 2551 times by 7 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
2551
1010-
1011 // try to get a free AND connected socket-
1012 for (int i = 0; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 10056 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 2663 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2663-10056
1013 if (channels[i].socket) {
channels[i].socketDescription
TRUEevaluated 6421 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 3635 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
3635-6421
1014 if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
!channels[i].replyDescription
TRUEevaluated 2834 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 3587 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
!channels[i].isSocketBusy()Description
TRUEevaluated 530 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 2304 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
channels[i].so...ConnectedStateDescription
TRUEevaluated 474 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
56-3587
1015 if (dequeueRequest(channels[i].socket))
dequeueRequest...els[i].socket)Description
TRUEevaluated 461 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
13-461
1016 channels[i].sendRequest();
executed 461 times by 4 tests: channels[i].sendRequest();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
461
1017 }
executed 474 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
474
1018 }
executed 6421 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
6421
1019 }
executed 10056 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
10056
1020 break;
executed 2663 times by 7 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2663
1021 }-
1022 case QHttpNetworkConnection::ConnectionTypeSPDY: {
executed 125 times by 1 test: case QHttpNetworkConnection::ConnectionTypeSPDY:
Executed by:
  • tst_Spdy
125
1023#ifndef QT_NO_SSL-
1024 if (channels[0].spdyRequestsToSend.isEmpty())
channels[0].sp...Send.isEmpty()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 119 times by 1 test
Evaluated by:
  • tst_Spdy
6-119
1025 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_Spdy
6
1026-
1027 if (networkLayerState == IPv4)
networkLayerState == IPv4Description
TRUEevaluated 119 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-119
1028 channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;
executed 119 times by 1 test: channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;
Executed by:
  • tst_Spdy
119
1029 else if (networkLayerState == IPv6)
networkLayerState == IPv6Description
TRUEnever evaluated
FALSEnever evaluated
0
1030 channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
never executed: channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
0
1031 channels[0].ensureConnection();-
1032 if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
channels[0].socketDescription
TRUEevaluated 119 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
channels[0].so...ConnectedStateDescription
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_Spdy
0-119
1033 && !channels[0].pendingEncrypt)
!channels[0].pendingEncryptDescription
TRUEevaluated 107 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-107
1034 channels[0].sendRequest();
executed 107 times by 1 test: channels[0].sendRequest();
Executed by:
  • tst_Spdy
107
1035#endif // QT_NO_SSL-
1036 break;
executed 119 times by 1 test: break;
Executed by:
  • tst_Spdy
119
1037 }-
1038 }-
1039-
1040 // try to push more into all sockets-
1041 // ### FIXME we should move this to the beginning of the function-
1042 // as soon as QtWebkit is properly using the pipelining-
1043 // (e.g. not for XMLHttpRequest or the first page load)-
1044 // ### FIXME we should also divide the requests more even-
1045 // on the connected sockets-
1046 //tryToFillPipeline(socket);-
1047 // return fast if there is nothing to pipeline-
1048 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
highPriorityQueue.isEmpty()Description
TRUEevaluated 2431 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 351 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
lowPriorityQueue.isEmpty()Description
TRUEevaluated 192 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 2239 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
192-2431
1049 return;
executed 192 times by 4 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
192
1050 for (int i = 0; i < channelCount; i++)
i < channelCountDescription
TRUEevaluated 9631 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 2590 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2590-9631
1051 if (channels[i].socket && channels[i].socket->state() == QAbstractSocket::ConnectedState)
channels[i].socketDescription
TRUEevaluated 6303 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3328 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
channels[i].so...ConnectedStateDescription
TRUEevaluated 3885 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2418 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
2418-6303
1052 fillPipeline(channels[i].socket);
executed 3885 times by 2 tests: fillPipeline(channels[i].socket);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
3885
1053-
1054 // If there is not already any connected channels we need to connect a new one.-
1055 // We do not pair the channel with the request until we know if it is-
1056 // connected or not. This is to reuse connected channels before we connect new once.-
1057 int queuedRequests = highPriorityQueue.count() + lowPriorityQueue.count();-
1058-
1059 // in case we have in-flight preconnect requests and normal requests,-
1060 // we only need one socket for each (preconnect, normal request) pair-
1061 int neededOpenChannels = queuedRequests;-
1062 if (preConnectRequests > 0) {
preConnectRequests > 0Description
TRUEnever evaluated
FALSEevaluated 2590 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0-2590
1063 int normalRequests = queuedRequests - preConnectRequests;-
1064 neededOpenChannels = qMax(normalRequests, preConnectRequests);-
1065 }
never executed: end of block
0
1066 for (int i = 0; i < channelCount && neededOpenChannels > 0; ++i) {
i < channelCountDescription
TRUEevaluated 7244 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1959 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
neededOpenChannels > 0Description
TRUEevaluated 6735 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 509 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
509-7244
1067 bool connectChannel = false;-
1068 if (channels[i].socket) {
channels[i].socketDescription
TRUEevaluated 6238 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 497 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
497-6238
1069 if ((channels[i].socket->state() == QAbstractSocket::ConnectingState)
(channels[i].s...nnectingState)Description
TRUEevaluated 2332 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3906 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
2332-3906
1070 || (channels[i].socket->state() == QAbstractSocket::HostLookupState)
(channels[i].s...stLookupState)Description
TRUEnever evaluated
FALSEevaluated 3906 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-3906
1071 || channels[i].pendingEncrypt) // pendingEncrypt == "EncryptingState"
channels[i].pendingEncryptDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3883 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
23-3883
1072 neededOpenChannels--;
executed 2355 times by 2 tests: neededOpenChannels--;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
2355
1073-
1074 if (neededOpenChannels <= 0)
neededOpenChannels <= 0Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 6116 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
122-6116
1075 break;
executed 122 times by 2 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
122
1076 if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState))
!channels[i].replyDescription
TRUEevaluated 2207 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 3909 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
!channels[i].isSocketBusy()Description
TRUEevaluated 47 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2160 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
(channels[i].s...onnectedState)Description
TRUEevaluated 47 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-3909
1077 connectChannel = true;
executed 47 times by 2 tests: connectChannel = true;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
47
1078 } else { // not previously used channel
executed 6116 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
6116
1079 connectChannel = true;-
1080 }
executed 497 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
497
1081-
1082 if (connectChannel) {
connectChannelDescription
TRUEevaluated 544 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 6069 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
544-6069
1083 if (networkLayerState == IPv4)
networkLayerState == IPv4Description
TRUEevaluated 543 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-543
1084 channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;
executed 543 times by 7 tests: channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
543
1085 else if (networkLayerState == IPv6)
networkLayerState == IPv6Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-1
1086 channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol;
executed 1 time by 1 test: channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol;
Executed by:
  • tst_QNetworkReply
1
1087 channels[i].ensureConnection();-
1088 neededOpenChannels--;-
1089 }
executed 544 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
544
1090 }
executed 6613 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
6613
1091}
executed 2590 times by 7 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
2590
1092-
1093-
1094void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply)-
1095{-
1096 for (int i = 0 ; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 289 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
16-289
1097 if (channels[i].reply == reply) {
channels[i].reply == replyDescription
TRUEevaluated 193 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 96 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
96-193
1098 // emulate a readyRead() from the socket-
1099 QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection);-
1100 return;
executed 193 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
193
1101 }-
1102 }
executed 96 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
96
1103}
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
16
1104-
1105-
1106-
1107// The first time we start the connection is used we do not know if we-
1108// should use IPv4 or IPv6. So we start a hostlookup to figure this out.-
1109// Later when we do the connection the socket will not need to do another-
1110// lookup as then the hostinfo will already be in the cache.-
1111void QHttpNetworkConnectionPrivate::startHostInfoLookup()-
1112{-
1113 networkLayerState = HostLookupPending;-
1114-
1115 // check if we already now can decide if this is IPv4 or IPv6-
1116 QString lookupHost = hostName;-
1117#ifndef QT_NO_NETWORKPROXY-
1118 if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
networkProxy.c...okupCapabilityDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 539 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
44-539
1119 lookupHost = networkProxy.hostName();-
1120 } else if (channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
executed 44 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
channels[0].pr...okupCapabilityDescription
TRUEevaluated 58 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 481 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
44-481
1121 lookupHost = channels[0].proxy.hostName();-
1122 }
executed 58 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
58
1123#endif-
1124 QHostAddress temp;-
1125 if (temp.setAddress(lookupHost)) {
temp.setAddress(lookupHost)Description
TRUEevaluated 108 times by 5 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 475 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
108-475
1126 const QAbstractSocket::NetworkLayerProtocol protocol = temp.protocol();-
1127 if (protocol == QAbstractSocket::IPv4Protocol) {
protocol == QA...::IPv4ProtocolDescription
TRUEevaluated 107 times by 5 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-107
1128 networkLayerState = QHttpNetworkConnectionPrivate::IPv4;-
1129 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);-
1130 return;
executed 107 times by 5 tests: return;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
107
1131 } else if (protocol == QAbstractSocket::IPv6Protocol) {
protocol == QA...::IPv6ProtocolDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-1
1132 networkLayerState = QHttpNetworkConnectionPrivate::IPv6;-
1133 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);-
1134 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
1135 }-
1136 } else {
never executed: end of block
0
1137 int hostLookupId;-
1138 bool immediateResultValid = false;-
1139 QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost,-
1140 this->q_func(),-
1141 SLOT(_q_hostLookupFinished(QHostInfo)),-
1142 &immediateResultValid,-
1143 &hostLookupId);-
1144 if (immediateResultValid) {
immediateResultValidDescription
TRUEevaluated 460 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 15 times by 5 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
15-460
1145 _q_hostLookupFinished(hostInfo);-
1146 }
executed 460 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
460
1147 }
executed 475 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
475
1148}-
1149-
1150-
1151void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info)-
1152{-
1153 bool bIpv4 = false;-
1154 bool bIpv6 = false;-
1155 bool foundAddress = false;-
1156 if (networkLayerState == IPv4 || networkLayerState == IPv6 || networkLayerState == IPv4or6)
networkLayerState == IPv4Description
TRUEnever evaluated
FALSEevaluated 475 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
networkLayerState == IPv6Description
TRUEnever evaluated
FALSEevaluated 475 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
networkLayerState == IPv4or6Description
TRUEnever evaluated
FALSEevaluated 475 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-475
1157 return;
never executed: return;
0
1158-
1159 const auto addresses = info.addresses();-
1160 for (const QHostAddress &address : addresses) {-
1161 const QAbstractSocket::NetworkLayerProtocol protocol = address.protocol();-
1162 if (protocol == QAbstractSocket::IPv4Protocol) {
protocol == QA...::IPv4ProtocolDescription
TRUEevaluated 475 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 130 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
130-475
1163 if (!foundAddress) {
!foundAddressDescription
TRUEevaluated 349 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
126-349
1164 foundAddress = true;-
1165 delayIpv4 = false;-
1166 }
executed 349 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
349
1167 bIpv4 = true;-
1168 } else if (protocol == QAbstractSocket::IPv6Protocol) {
executed 475 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
protocol == QA...::IPv6ProtocolDescription
TRUEevaluated 130 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEnever evaluated
0-475
1169 if (!foundAddress) {
!foundAddressDescription
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
8-122
1170 foundAddress = true;-
1171 delayIpv4 = true;-
1172 }
executed 122 times by 2 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
122
1173 bIpv6 = true;-
1174 }
executed 130 times by 3 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
130
1175 }
executed 605 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
605
1176-
1177 if (bIpv4 && bIpv6)
bIpv4Description
TRUEevaluated 471 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
bIpv6Description
TRUEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEevaluated 345 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
4-471
1178 startNetworkLayerStateLookup();
executed 126 times by 3 tests: startNetworkLayerStateLookup();
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
126
1179 else if (bIpv4) {
bIpv4Description
TRUEevaluated 345 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
4-345
1180 networkLayerState = QHttpNetworkConnectionPrivate::IPv4;-
1181 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);-
1182 } else if (bIpv6) {
executed 345 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
bIpv6Description
TRUEnever evaluated
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-345
1183 networkLayerState = QHttpNetworkConnectionPrivate::IPv6;-
1184 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);-
1185 } else {
never executed: end of block
0
1186 if (dequeueRequest(channels[0].socket)) {
dequeueRequest...els[0].socket)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Spdy
2
1187 emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError);-
1188 networkLayerState = QHttpNetworkConnectionPrivate::Unknown;-
1189 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
2
1190#ifndef QT_NO_SSL-
1191 else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY) {
connectionType...ectionTypeSPDYDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEnever evaluated
0-2
1192 for (const HttpMessagePair &spdyPair : qAsConst(channels[0].spdyRequestsToSend)) {-
1193 // emit error for all replies-
1194 QHttpNetworkReply *currentReply = spdyPair.second;-
1195 Q_ASSERT(currentReply);-
1196 emitReplyError(channels[0].socket, currentReply, QNetworkReply::HostNotFoundError);-
1197 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Spdy
2
1198 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Spdy
2
1199#endif // QT_NO_SSL-
1200 else {-
1201 // Should not happen-
1202 qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not de-queue request");-
1203 networkLayerState = QHttpNetworkConnectionPrivate::Unknown;-
1204 }
never executed: end of block
0
1205 }-
1206}-
1207-
1208-
1209// This will be used if the host lookup found both and Ipv4 and-
1210// Ipv6 address. Then we will start up two connections and pick-
1211// the network layer of the one that finish first. The second-
1212// connection will then be disconnected.-
1213void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup()-
1214{-
1215 if (channelCount > 1) {
channelCount > 1Description
TRUEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEnever evaluated
0-126
1216 // At this time all channels should be unconnected.-
1217 Q_ASSERT(!channels[0].isSocketBusy());-
1218 Q_ASSERT(!channels[1].isSocketBusy());-
1219-
1220 networkLayerState = IPv4or6;-
1221-
1222 channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;-
1223 channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol;-
1224-
1225 int timeout = 300;-
1226#ifndef QT_NO_BEARERMANAGEMENT-
1227 if (networkSession) {
networkSessionDescription
TRUEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEnever evaluated
0-126
1228 const QNetworkConfiguration::BearerType bearerType = networkSession->configuration().bearerType();-
1229 if (bearerType == QNetworkConfiguration::Bearer2G)
bearerType == ...tion::Bearer2GDescription
TRUEnever evaluated
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
0-126
1230 timeout = 800;
never executed: timeout = 800;
0
1231 else if (bearerType == QNetworkConfiguration::BearerCDMA2000)
bearerType == ...BearerCDMA2000Description
TRUEnever evaluated
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
0-126
1232 timeout = 500;
never executed: timeout = 500;
0
1233 else if (bearerType == QNetworkConfiguration::BearerWCDMA)
bearerType == ...n::BearerWCDMADescription
TRUEnever evaluated
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
0-126
1234 timeout = 500;
never executed: timeout = 500;
0
1235 else if (bearerType == QNetworkConfiguration::BearerHSPA)
bearerType == ...on::BearerHSPADescription
TRUEnever evaluated
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
0-126
1236 timeout = 400;
never executed: timeout = 400;
0
1237 }
executed 126 times by 3 tests: end of block
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
126
1238#endif-
1239 delayedConnectionTimer.start(timeout);-
1240 if (delayIpv4)
delayIpv4Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
4-122
1241 channels[1].ensureConnection();
executed 122 times by 2 tests: channels[1].ensureConnection();
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
122
1242 else-
1243 channels[0].ensureConnection();
executed 4 times by 2 tests: channels[0].ensureConnection();
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
4
1244 } else {-
1245 networkLayerState = IPv4or6;-
1246 channels[0].networkLayerPreference = QAbstractSocket::AnyIPProtocol;-
1247 channels[0].ensureConnection();-
1248 }
never executed: end of block
0
1249}-
1250-
1251void QHttpNetworkConnectionPrivate::networkLayerDetected(QAbstractSocket::NetworkLayerProtocol protocol)-
1252{-
1253 for (int i = 0 ; i < channelCount; ++i) {
i < channelCountDescription
TRUEevaluated 744 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
124-744
1254 if ((channels[i].networkLayerPreference != protocol) && (channels[i].state == QHttpNetworkConnectionChannel::ConnectingState)) {
(channels[i].n...e != protocol)Description
TRUEevaluated 620 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
(channels[i].s...nnectingState)Description
TRUEnever evaluated
FALSEevaluated 620 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
0-620
1255 channels[i].close();-
1256 }
never executed: end of block
0
1257 }
executed 744 times by 2 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
744
1258}
executed 124 times by 2 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
124
1259-
1260void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel()-
1261{-
1262 if (delayIpv4)
delayIpv4Description
TRUEnever evaluated
FALSEnever evaluated
0
1263 channels[0].ensureConnection();
never executed: channels[0].ensureConnection();
0
1264 else-
1265 channels[1].ensureConnection();
never executed: channels[1].ensureConnection();
0
1266}-
1267-
1268#ifndef QT_NO_BEARERMANAGEMENT-
1269QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt,-
1270 QHttpNetworkConnection::ConnectionType connectionType,-
1271 QObject *parent, QSharedPointer<QNetworkSession> networkSession)-
1272 : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent)-
1273{-
1274 Q_D(QHttpNetworkConnection);-
1275 d->networkSession = qMove(networkSession);-
1276 d->init();-
1277}
executed 575 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
575
1278-
1279QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName,-
1280 quint16 port, bool encrypt, QObject *parent,-
1281 QSharedPointer<QNetworkSession> networkSession,-
1282 QHttpNetworkConnection::ConnectionType connectionType)-
1283 : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt,-
1284 connectionType)), parent)-
1285{-
1286 Q_D(QHttpNetworkConnection);-
1287 d->networkSession = qMove(networkSession);-
1288 d->init();-
1289}
executed 8 times by 1 test: end of block
Executed by:
  • tst_QHttpNetworkConnection
8
1290#else-
1291QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt,-
1292 QHttpNetworkConnection::ConnectionType connectionType, QObject *parent)-
1293 : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt , connectionType)), parent)-
1294{-
1295 Q_D(QHttpNetworkConnection);-
1296 d->init();-
1297}-
1298-
1299QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName,-
1300 quint16 port, bool encrypt, QObject *parent,-
1301 QHttpNetworkConnection::ConnectionType connectionType)-
1302 : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt,-
1303 connectionType)), parent)-
1304{-
1305 Q_D(QHttpNetworkConnection);-
1306 d->init();-
1307}-
1308#endif-
1309-
1310QHttpNetworkConnection::~QHttpNetworkConnection()-
1311{-
1312}-
1313-
1314QString QHttpNetworkConnection::hostName() const-
1315{-
1316 Q_D(const QHttpNetworkConnection);-
1317 return d->hostName;
executed 22 times by 1 test: return d->hostName;
Executed by:
  • tst_QHttpNetworkConnection
22
1318}-
1319-
1320quint16 QHttpNetworkConnection::port() const-
1321{-
1322 Q_D(const QHttpNetworkConnection);-
1323 return d->port;
executed 22 times by 1 test: return d->port;
Executed by:
  • tst_QHttpNetworkConnection
22
1324}-
1325-
1326QHttpNetworkReply* QHttpNetworkConnection::sendRequest(const QHttpNetworkRequest &request)-
1327{-
1328 Q_D(QHttpNetworkConnection);-
1329 return d->queueRequest(request);
executed 1646 times by 8 tests: return d->queueRequest(request);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1646
1330}-
1331-
1332bool QHttpNetworkConnection::isSsl() const-
1333{-
1334 Q_D(const QHttpNetworkConnection);-
1335 return d->encrypt;
executed 22 times by 1 test: return d->encrypt;
Executed by:
  • tst_QHttpNetworkConnection
22
1336}-
1337-
1338QHttpNetworkConnectionChannel *QHttpNetworkConnection::channels() const-
1339{-
1340 return d_func()->channels;
never executed: return d_func()->channels;
0
1341}-
1342-
1343#ifndef QT_NO_NETWORKPROXY-
1344void QHttpNetworkConnection::setCacheProxy(const QNetworkProxy &networkProxy)-
1345{-
1346 Q_D(QHttpNetworkConnection);-
1347 d->networkProxy = networkProxy;-
1348 // update the authenticator-
1349 if (!d->networkProxy.user().isEmpty()) {
!d->networkPro...er().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 551 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-551
1350 for (int i = 0; i < d->channelCount; ++i) {
i < d->channelCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
1351 d->channels[i].proxyAuthenticator.setUser(d->networkProxy.user());-
1352 d->channels[i].proxyAuthenticator.setPassword(d->networkProxy.password());-
1353 }
never executed: end of block
0
1354 }
never executed: end of block
0
1355}
executed 551 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
551
1356-
1357QNetworkProxy QHttpNetworkConnection::cacheProxy() const-
1358{-
1359 Q_D(const QHttpNetworkConnection);-
1360 return d->networkProxy;
executed 700 times by 8 tests: return d->networkProxy;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
700
1361}-
1362-
1363void QHttpNetworkConnection::setTransparentProxy(const QNetworkProxy &networkProxy)-
1364{-
1365 Q_D(QHttpNetworkConnection);-
1366 for (int i = 0; i < d->channelCount; ++i)
i < d->channelCountDescription
TRUEevaluated 3251 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 551 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
551-3251
1367 d->channels[i].setProxy(networkProxy);
executed 3251 times by 8 tests: d->channels[i].setProxy(networkProxy);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
3251
1368}
executed 551 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
551
1369-
1370QNetworkProxy QHttpNetworkConnection::transparentProxy() const-
1371{-
1372 Q_D(const QHttpNetworkConnection);-
1373 return d->channels[0].proxy;
executed 700 times by 8 tests: return d->channels[0].proxy;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
700
1374}-
1375#endif-
1376-
1377QHttpNetworkConnection::ConnectionType QHttpNetworkConnection::connectionType()-
1378{-
1379 Q_D(QHttpNetworkConnection);-
1380 return d->connectionType;
executed 227 times by 4 tests: return d->connectionType;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
227
1381}-
1382-
1383void QHttpNetworkConnection::setConnectionType(ConnectionType type)-
1384{-
1385 Q_D(QHttpNetworkConnection);-
1386 d->connectionType = type;-
1387}
executed 91 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
91
1388-
1389// SSL support below-
1390#ifndef QT_NO_SSL-
1391void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config)-
1392{-
1393 Q_D(QHttpNetworkConnection);-
1394 if (!d->encrypt)
!d->encryptDescription
TRUEnever evaluated
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-57
1395 return;
never executed: return;
0
1396-
1397 // set the config on all channels-
1398 for (int i = 0; i < d->channelCount; ++i)
i < d->channelCountDescription
TRUEevaluated 287 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
57-287
1399 d->channels[i].setSslConfiguration(config);
executed 287 times by 2 tests: d->channels[i].setSslConfiguration(config);
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
287
1400}
executed 57 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
57
1401-
1402QSharedPointer<QSslContext> QHttpNetworkConnection::sslContext()-
1403{-
1404 Q_D(QHttpNetworkConnection);-
1405 return d->sslContext;
executed 274 times by 3 tests: return d->sslContext;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
274
1406}-
1407-
1408void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context)-
1409{-
1410 Q_D(QHttpNetworkConnection);-
1411 d->sslContext = qMove(context);-
1412}
executed 95 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
95
1413-
1414void QHttpNetworkConnection::ignoreSslErrors(int channel)-
1415{-
1416 Q_D(QHttpNetworkConnection);-
1417 if (!d->encrypt)
!d->encryptDescription
TRUEnever evaluated
FALSEevaluated 34 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-34
1418 return;
never executed: return;
0
1419-
1420 if (channel == -1) { // ignore for all channels
channel == -1Description
TRUEevaluated 34 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-34
1421 for (int i = 0; i < d->channelCount; ++i) {
i < d->channelCountDescription
TRUEevaluated 174 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 34 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
34-174
1422 d->channels[i].ignoreSslErrors();-
1423 }
executed 174 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
174
1424-
1425 } else {
executed 34 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
34
1426 d->channels[channel].ignoreSslErrors();-
1427 }
never executed: end of block
0
1428}-
1429-
1430void QHttpNetworkConnection::ignoreSslErrors(const QList<QSslError> &errors, int channel)-
1431{-
1432 Q_D(QHttpNetworkConnection);-
1433 if (!d->encrypt)
!d->encryptDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-6
1434 return;
never executed: return;
0
1435-
1436 if (channel == -1) { // ignore for all channels
channel == -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-6
1437 for (int i = 0; i < d->channelCount; ++i) {
i < d->channelCountDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
6-36
1438 d->channels[i].ignoreSslErrors(errors);-
1439 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
36
1440-
1441 } else {
executed 6 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
6
1442 d->channels[channel].ignoreSslErrors(errors);-
1443 }
never executed: end of block
0
1444}-
1445-
1446#endif //QT_NO_SSL-
1447-
1448void QHttpNetworkConnection::preConnectFinished()-
1449{-
1450 d_func()->preConnectRequests--;-
1451}
never executed: end of block
0
1452-
1453#ifndef QT_NO_NETWORKPROXY-
1454// only called from QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired, not-
1455// from QHttpNetworkConnectionChannel::handleAuthenticationChallenge-
1456// e.g. it is for SOCKS proxies which require authentication.-
1457void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth)-
1458{-
1459 // Also pause the connection because socket notifiers may fire while an user-
1460 // dialog is displaying-
1461 pauseConnection();-
1462 QHttpNetworkReply *reply;-
1463#ifndef QT_NO_SSL-
1464 if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY) {
connectionType...ectionTypeSPDYDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 39 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-39
1465 // we choose the reply to emit the proxyAuth signal from somewhat arbitrarily,-
1466 // but that does not matter because the signal will ultimately be emitted-
1467 // by the QNetworkAccessManager.-
1468 Q_ASSERT(chan->spdyRequestsToSend.count() > 0);-
1469 reply = chan->spdyRequestsToSend.cbegin().value().second;-
1470 } else { // HTTP
executed 3 times by 1 test: end of block
Executed by:
  • tst_Spdy
3
1471#endif // QT_NO_SSL-
1472 reply = chan->reply;-
1473#ifndef QT_NO_SSL-
1474 }
executed 39 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
39
1475#endif // QT_NO_SSL-
1476-
1477 Q_ASSERT(reply);-
1478 emit reply->proxyAuthenticationRequired(proxy, auth);-
1479 resumeConnection();-
1480 int i = indexOf(chan->socket);-
1481 copyCredentials(i, auth, true);-
1482}
executed 42 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
42
1483#endif-
1484-
1485-
1486QT_END_NAMESPACE-
1487-
1488#include "moc_qhttpnetworkconnection_p.cpp"-
1489-
1490#endif // QT_NO_HTTP-
Source codeSwitch to Preprocessed file

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