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

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