qhttpnetworkreply.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkreply.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qhttpnetworkreply_p.h"-
41#include "qhttpnetworkconnection_p.h"-
42-
43#ifndef QT_NO_HTTP-
44-
45#ifndef QT_NO_SSL-
46# include <QtNetwork/qsslkey.h>-
47# include <QtNetwork/qsslcipher.h>-
48# include <QtNetwork/qsslconfiguration.h>-
49#endif-
50-
51#ifndef QT_NO_COMPRESS-
52#include <zlib.h>-
53#endif-
54-
55QT_BEGIN_NAMESPACE-
56-
57QHttpNetworkReply::QHttpNetworkReply(const QUrl &url, QObject *parent)-
58 : QObject(*new QHttpNetworkReplyPrivate(url), parent)-
59{-
60}
executed 2205 times by 14 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_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2205
61-
62QHttpNetworkReply::~QHttpNetworkReply()-
63{-
64 Q_D(QHttpNetworkReply);-
65 if (d->connection) {
d->connectionDescription
TRUEevaluated 1567 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 467 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
467-1567
66 d->connection->d_func()->removeReply(this);-
67 }
executed 1566 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
1566
68-
69#ifndef QT_NO_COMPRESS-
70 if (d->autoDecompress && d->isCompressed() && d->inflateStrm)
d->autoDecompressDescription
TRUEevaluated 48 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
FALSEevaluated 1985 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
d->isCompressed()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 41 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
d->inflateStrmDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-1985
71 inflateEnd(d->inflateStrm);
executed 7 times by 1 test: inflateEnd(d->inflateStrm);
Executed by:
  • tst_QNetworkReply
7
72#endif-
73}
executed 2033 times by 14 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_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2033
74-
75QUrl QHttpNetworkReply::url() const-
76{-
77 return d_func()->url;
never executed: return d_func()->url;
0
78}-
79void QHttpNetworkReply::setUrl(const QUrl &url)-
80{-
81 Q_D(QHttpNetworkReply);-
82 d->url = url;-
83}
never executed: end of block
0
84-
85QUrl QHttpNetworkReply::redirectUrl() const-
86{-
87 return d_func()->redirectUrl;
executed 5 times by 1 test: return d_func()->redirectUrl;
Executed by:
  • tst_QNetworkReply
5
88}-
89-
90void QHttpNetworkReply::setRedirectUrl(const QUrl &url)-
91{-
92 Q_D(QHttpNetworkReply);-
93 d->redirectUrl = url;-
94}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
5
95-
96bool QHttpNetworkReply::isHttpRedirect(int statusCode)-
97{-
98 return (statusCode == 301 || statusCode == 302 || statusCode == 303
executed 23 times by 1 test: return (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 305 || statusCode == 307);
Executed by:
  • tst_QNetworkReply
23
99 || statusCode == 305 || statusCode == 307);
executed 23 times by 1 test: return (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 305 || statusCode == 307);
Executed by:
  • tst_QNetworkReply
23
100}-
101-
102qint64 QHttpNetworkReply::contentLength() const-
103{-
104 return d_func()->contentLength();
executed 1571 times by 7 tests: return d_func()->contentLength();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
1571
105}-
106-
107void QHttpNetworkReply::setContentLength(qint64 length)-
108{-
109 Q_D(QHttpNetworkReply);-
110 d->setContentLength(length);-
111}
executed 22 times by 1 test: end of block
Executed by:
  • tst_Spdy
22
112-
113QList<QPair<QByteArray, QByteArray> > QHttpNetworkReply::header() const-
114{-
115 return d_func()->fields;
executed 1332 times by 12 tests: return d_func()->fields;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1332
116}-
117-
118QByteArray QHttpNetworkReply::headerField(const QByteArray &name, const QByteArray &defaultValue) const-
119{-
120 return d_func()->headerField(name, defaultValue);
executed 2209 times by 13 tests: return d_func()->headerField(name, defaultValue);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2209
121}-
122-
123void QHttpNetworkReply::setHeaderField(const QByteArray &name, const QByteArray &data)-
124{-
125 Q_D(QHttpNetworkReply);-
126 d->setHeaderField(name, data);-
127}
executed 449 times by 1 test: end of block
Executed by:
  • tst_Spdy
449
128-
129void QHttpNetworkReply::parseHeader(const QByteArray &header)-
130{-
131 Q_D(QHttpNetworkReply);-
132 d->parseHeader(header);-
133}
executed 7 times by 1 test: end of block
Executed by:
  • tst_qhttpnetworkreply - unknown status
7
134-
135QHttpNetworkRequest QHttpNetworkReply::request() const-
136{-
137 return d_func()->request;
executed 1068 times by 4 tests: return d_func()->request;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
1068
138}-
139-
140void QHttpNetworkReply::setRequest(const QHttpNetworkRequest &request)-
141{-
142 Q_D(QHttpNetworkReply);-
143 d->request = request;-
144 d->ssl = request.isSsl();-
145}
executed 1753 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
1753
146-
147int QHttpNetworkReply::statusCode() const-
148{-
149 return d_func()->statusCode;
executed 3843 times by 12 tests: return d_func()->statusCode;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
3843
150}-
151-
152void QHttpNetworkReply::setStatusCode(int code)-
153{-
154 Q_D(QHttpNetworkReply);-
155 d->statusCode = code;-
156}
executed 107 times by 1 test: end of block
Executed by:
  • tst_Spdy
107
157-
158QString QHttpNetworkReply::errorString() const-
159{-
160 return d_func()->errorString;
never executed: return d_func()->errorString;
0
161}-
162-
163QString QHttpNetworkReply::reasonPhrase() const-
164{-
165 return d_func()->reasonPhrase;
executed 814 times by 7 tests: return d_func()->reasonPhrase;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
814
166}-
167-
168void QHttpNetworkReply::setErrorString(const QString &error)-
169{-
170 Q_D(QHttpNetworkReply);-
171 d->errorString = error;-
172}
never executed: end of block
0
173-
174int QHttpNetworkReply::majorVersion() const-
175{-
176 return d_func()->majorVersion;
executed 3 times by 1 test: return d_func()->majorVersion;
Executed by:
  • tst_qhttpsocketengine - unknown status
3
177}-
178-
179int QHttpNetworkReply::minorVersion() const-
180{-
181 return d_func()->minorVersion;
executed 3 times by 1 test: return d_func()->minorVersion;
Executed by:
  • tst_qhttpsocketengine - unknown status
3
182}-
183-
184qint64 QHttpNetworkReply::bytesAvailable() const-
185{-
186 Q_D(const QHttpNetworkReply);-
187 if (d->connection)
d->connectionDescription
TRUEevaluated 12636 times by 1 test
Evaluated by:
  • tst_QHttpNetworkConnection
FALSEnever evaluated
0-12636
188 return d->connection->d_func()->uncompressedBytesAvailable(*this);
executed 12636 times by 1 test: return d->connection->d_func()->uncompressedBytesAvailable(*this);
Executed by:
  • tst_QHttpNetworkConnection
12636
189 else-
190 return -1;
never executed: return -1;
0
191}-
192-
193qint64 QHttpNetworkReply::bytesAvailableNextBlock() const-
194{-
195 Q_D(const QHttpNetworkReply);-
196 if (d->connection)
d->connectionDescription
TRUEnever evaluated
FALSEnever evaluated
0
197 return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
never executed: return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
0
198 else-
199 return -1;
never executed: return -1;
0
200}-
201-
202bool QHttpNetworkReply::readAnyAvailable() const-
203{-
204 Q_D(const QHttpNetworkReply);-
205 return (d->responseData.bufferCount() > 0);
executed 19841 times by 6 tests: return (d->responseData.bufferCount() > 0);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
19841
206}-
207-
208QByteArray QHttpNetworkReply::readAny()-
209{-
210 Q_D(QHttpNetworkReply);-
211 if (d->responseData.bufferCount() == 0)
d->responseDat...erCount() == 0Description
TRUEnever evaluated
FALSEevaluated 6517 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
0-6517
212 return QByteArray();
never executed: return QByteArray();
0
213-
214 // we'll take the last buffer, so schedule another read from http-
215 if (d->downstreamLimited && d->responseData.bufferCount() == 1 && !isFinished())
d->downstreamLimitedDescription
TRUEevaluated 211 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 6306 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
d->responseDat...erCount() == 1Description
TRUEevaluated 192 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QNetworkReply
!isFinished()Description
TRUEevaluated 189 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-6306
216 d->connection->d_func()->readMoreLater(this);
executed 189 times by 1 test: d->connection->d_func()->readMoreLater(this);
Executed by:
  • tst_QNetworkReply
189
217 return d->responseData.read();
executed 6517 times by 5 tests: return d->responseData.read();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
  • tst_Spdy
6517
218}-
219-
220QByteArray QHttpNetworkReply::readAll()-
221{-
222 Q_D(QHttpNetworkReply);-
223 return d->responseData.readAll();
executed 76 times by 1 test: return d->responseData.readAll();
Executed by:
  • tst_QNetworkReply
76
224}-
225-
226QByteArray QHttpNetworkReply::read(qint64 amount)-
227{-
228 Q_D(QHttpNetworkReply);-
229 return d->responseData.read(amount);
executed 40 times by 1 test: return d->responseData.read(amount);
Executed by:
  • tst_QNetworkReply
40
230}-
231-
232-
233qint64 QHttpNetworkReply::sizeNextBlock()-
234{-
235 Q_D(QHttpNetworkReply);-
236 return d->responseData.sizeNextBlock();
executed 462 times by 1 test: return d->responseData.sizeNextBlock();
Executed by:
  • tst_QNetworkReply
462
237}-
238-
239void QHttpNetworkReply::setDownstreamLimited(bool dsl)-
240{-
241 Q_D(QHttpNetworkReply);-
242 d->downstreamLimited = dsl;-
243 d->connection->d_func()->readMoreLater(this);-
244}
executed 20 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
20
245-
246void QHttpNetworkReply::setReadBufferSize(qint64 size)-
247{-
248 Q_D(QHttpNetworkReply);-
249 d->readBufferMaxSize = size;-
250}
executed 18 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
18
251-
252bool QHttpNetworkReply::supportsUserProvidedDownloadBuffer()-
253{-
254 Q_D(QHttpNetworkReply);-
255 return (!d->isChunked() && !d->autoDecompress && d->bodyLength > 0 && d->statusCode == 200);
executed 1084 times by 6 tests: return (!d->isChunked() && !d->autoDecompress && d->bodyLength > 0 && d->statusCode == 200);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
1084
256}-
257-
258void QHttpNetworkReply::setUserProvidedDownloadBuffer(char* b)-
259{-
260 Q_D(QHttpNetworkReply);-
261 if (supportsUserProvidedDownloadBuffer())
supportsUserPr...wnloadBuffer()Description
TRUEevaluated 364 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEnever evaluated
0-364
262 d->userProvidedDownloadBuffer = b;
executed 364 times by 3 tests: d->userProvidedDownloadBuffer = b;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
364
263}
executed 364 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
364
264-
265char* QHttpNetworkReply::userProvidedDownloadBuffer()-
266{-
267 Q_D(QHttpNetworkReply);-
268 return d->userProvidedDownloadBuffer;
never executed: return d->userProvidedDownloadBuffer;
0
269}-
270-
271void QHttpNetworkReply::abort()-
272{-
273 Q_D(QHttpNetworkReply);-
274 d->state = QHttpNetworkReplyPrivate::Aborted;-
275}
executed 18 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
18
276-
277bool QHttpNetworkReply::isAborted() const-
278{-
279 return d_func()->state == QHttpNetworkReplyPrivate::Aborted;
executed 25 times by 3 tests: return d_func()->state == QHttpNetworkReplyPrivate::Aborted;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
25
280}-
281-
282bool QHttpNetworkReply::isFinished() const-
283{-
284 return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState;
executed 1301307 times by 3 tests: return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QXmlInputSource
1301307
285}-
286-
287bool QHttpNetworkReply::isPipeliningUsed() const-
288{-
289 return d_func()->pipeliningUsed;
executed 911 times by 7 tests: return d_func()->pipeliningUsed;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
911
290}-
291-
292bool QHttpNetworkReply::isSpdyUsed() const-
293{-
294 return d_func()->spdyUsed;
executed 794 times by 6 tests: return d_func()->spdyUsed;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
794
295}-
296-
297void QHttpNetworkReply::setSpdyWasUsed(bool spdy)-
298{-
299 d_func()->spdyUsed = spdy;-
300}
executed 199 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
199
301-
302bool QHttpNetworkReply::isRedirecting() const-
303{-
304 return d_func()->isRedirecting();
executed 7 times by 1 test: return d_func()->isRedirecting();
Executed by:
  • tst_QNetworkReply
7
305}-
306-
307QHttpNetworkConnection* QHttpNetworkReply::connection()-
308{-
309 return d_func()->connection;
executed 10 times by 1 test: return d_func()->connection;
Executed by:
  • tst_QHttpNetworkConnection
10
310}-
311-
312-
313QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)-
314 : QHttpNetworkHeaderPrivate(newUrl)-
315 , state(NothingDoneState)-
316 , ssl(false)-
317 , statusCode(100),-
318 majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0),-
319 chunkedTransferEncoding(false),-
320 connectionCloseEnabled(true),-
321 forceConnectionCloseEnabled(false),-
322 lastChunkRead(false),-
323 currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0),-
324 windowSizeDownload(65536), // 64K initial window size according to SPDY standard-
325 windowSizeUpload(65536), // 64K initial window size according to SPDY standard-
326 currentlyReceivedDataInWindow(0),-
327 currentlyUploadedDataInWindow(0),-
328 totallyUploadedData(0),-
329 connection(0),-
330 autoDecompress(false), responseData(), requestIsPrepared(false)-
331 ,pipeliningUsed(false), spdyUsed(false), downstreamLimited(false)-
332 ,userProvidedDownloadBuffer(0)-
333#ifndef QT_NO_COMPRESS-
334 ,inflateStrm(0)-
335#endif-
336-
337{-
338 QString scheme = newUrl.scheme();-
339 if (scheme == QLatin1String("preconnect-http")
scheme == QLat...connect-http")Description
TRUEnever evaluated
FALSEevaluated 2205 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-2205
340 || scheme == QLatin1String("preconnect-https"))
scheme == QLat...onnect-https")Description
TRUEnever evaluated
FALSEevaluated 2205 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-2205
341 // make sure we do not close the socket after preconnecting-
342 connectionCloseEnabled = false;
never executed: connectionCloseEnabled = false;
0
343}
executed 2205 times by 14 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_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2205
344-
345QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate()-
346{-
347#ifndef QT_NO_COMPRESS-
348 if (inflateStrm)
inflateStrmDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2026 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
7-2026
349 delete inflateStrm;
executed 7 times by 1 test: delete inflateStrm;
Executed by:
  • tst_QNetworkReply
7
350#endif-
351}
executed 2033 times by 14 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_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2033
352-
353void QHttpNetworkReplyPrivate::clearHttpLayerInformation()-
354{-
355 state = NothingDoneState;-
356 statusCode = 100;-
357 bodyLength = 0;-
358 contentRead = 0;-
359 totalProgress = 0;-
360 currentChunkSize = 0;-
361 currentChunkRead = 0;-
362 lastChunkRead = false;-
363 connectionCloseEnabled = true;-
364#ifndef QT_NO_COMPRESS-
365 if (autoDecompress && inflateStrm)
autoDecompressDescription
TRUEnever evaluated
FALSEevaluated 2308 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
inflateStrmDescription
TRUEnever evaluated
FALSEnever evaluated
0-2308
366 inflateEnd(inflateStrm);
never executed: inflateEnd(inflateStrm);
0
367#endif-
368 fields.clear();-
369}
executed 2308 times by 13 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_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2308
370-
371// TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all-
372void QHttpNetworkReplyPrivate::clear()-
373{-
374 connection = 0;-
375 connectionChannel = 0;-
376 autoDecompress = false;-
377 clearHttpLayerInformation();-
378}
executed 1789 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
1789
379-
380// QHttpNetworkReplyPrivate-
381qint64 QHttpNetworkReplyPrivate::bytesAvailable() const-
382{-
383 return (state != ReadingDataState ? 0 : fragment.size());
never executed: return (state != ReadingDataState ? 0 : fragment.size());
0
384}-
385-
386bool QHttpNetworkReplyPrivate::isCompressed()-
387{-
388 QByteArray encoding = headerField("content-encoding");-
389 return qstricmp(encoding.constData(), "gzip") == 0 || qstricmp(encoding.constData(), "deflate") == 0;
executed 3635 times by 8 tests: return qstricmp(encoding.constData(), "gzip") == 0 || qstricmp(encoding.constData(), "deflate") == 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
3635
390}-
391-
392void QHttpNetworkReplyPrivate::removeAutoDecompressHeader()-
393{-
394 // The header "Content-Encoding = gzip" is retained.-
395 // Content-Length is removed since the actual one sent by the server is for compressed data-
396 QByteArray name("content-length");-
397 QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(),-
398 end = fields.end();-
399 while (it != end) {
it != endDescription
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
2-29
400 if (qstricmp(name.constData(), it->first.constData()) == 0) {
qstricmp(name....stData()) == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QNetworkReply
5-24
401 fields.erase(it);-
402 break;
executed 5 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
5
403 }-
404 ++it;-
405 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
24
406-
407}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
7
408-
409bool QHttpNetworkReplyPrivate::findChallenge(bool forProxy, QByteArray &challenge) const-
410{-
411 challenge.clear();-
412 // find out the type of authentication protocol requested.-
413 QByteArray header = forProxy ? "proxy-authenticate" : "www-authenticate";
forProxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
414 // pick the best protocol (has to match parsing in QAuthenticatorPrivate)-
415 QList<QByteArray> challenges = headerFieldValues(header);-
416 for (int i = 0; i<challenges.size(); i++) {
i<challenges.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
417 QByteArray line = challenges.at(i);-
418 // todo use qstrincmp-
419 if (!line.toLower().startsWith("negotiate"))
!line.toLower(...h("negotiate")Description
TRUEnever evaluated
FALSEnever evaluated
0
420 challenge = line;
never executed: challenge = line;
0
421 }
never executed: end of block
0
422 return !challenge.isEmpty();
never executed: return !challenge.isEmpty();
0
423}-
424-
425QAuthenticatorPrivate::Method QHttpNetworkReplyPrivate::authenticationMethod(bool isProxy) const-
426{-
427 // The logic is same as the one used in void QAuthenticatorPrivate::parseHttpResponse()-
428 QAuthenticatorPrivate::Method method = QAuthenticatorPrivate::None;-
429 QByteArray header = isProxy ? "proxy-authenticate" : "www-authenticate";
isProxyDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 302 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
54-302
430 QList<QByteArray> challenges = headerFieldValues(header);-
431 for (int i = 0; i<challenges.size(); i++) {
i<challenges.size()Description
TRUEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 356 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
355-356
432 QByteArray line = challenges.at(i).trimmed().toLower();-
433 if (method < QAuthenticatorPrivate::Basic
method < QAuth...Private::BasicDescription
TRUEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-355
434 && line.startsWith("basic")) {
line.startsWith("basic")Description
TRUEevaluated 286 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
69-286
435 method = QAuthenticatorPrivate::Basic;-
436 } else if (method < QAuthenticatorPrivate::Ntlm
executed 286 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
method < QAuth...rPrivate::NtlmDescription
TRUEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-286
437 && line.startsWith("ntlm")) {
line.startsWith("ntlm")Description
TRUEnever evaluated
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
0-69
438 method = QAuthenticatorPrivate::Ntlm;-
439 } else if (method < QAuthenticatorPrivate::DigestMd5
never executed: end of block
method < QAuth...ate::DigestMd5Description
TRUEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEnever evaluated
0-69
440 && line.startsWith("digest")) {
line.startsWith("digest")Description
TRUEevaluated 67 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
2-67
441 method = QAuthenticatorPrivate::DigestMd5;-
442 }
executed 67 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
67
443 }
executed 355 times by 2 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
355
444 return method;
executed 356 times by 2 tests: return method;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
356
445}-
446-
447qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)-
448{-
449 if (fragment.isEmpty()) {
fragment.isEmpty()Description
TRUEevaluated 2272 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_QNetworkReply
46-2272
450 // reserve bytes for the status line. This is better than always append() which reallocs the byte array-
451 fragment.reserve(32);-
452 }
executed 2272 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2272
453-
454 qint64 bytes = 0;-
455 char c;-
456 qint64 haveRead = 0;-
457-
458 do {-
459 haveRead = socket->read(&c, 1);-
460 if (haveRead == -1)
haveRead == -1Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 53098 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
24-53098
461 return -1; // unexpected EOF
executed 24 times by 1 test: return -1;
Executed by:
  • tst_QNetworkReply
24
462 else if (haveRead == 0)
haveRead == 0Description
TRUEevaluated 106 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 52992 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
106-52992
463 break; // read more later
executed 106 times by 2 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
106
464 else if (haveRead == 1 && fragment.size() == 0 && (c == 11 || c == '\n' || c == '\r' || c == ' ' || c == 31))
haveRead == 1Description
TRUEevaluated 52992 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
fragment.size() == 0Description
TRUEevaluated 2230 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 50762 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
c == 11Description
TRUEnever evaluated
FALSEevaluated 2230 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
c == '\n'Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2210 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
c == '\r'Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2190 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
c == ' 'Description
TRUEnever evaluated
FALSEevaluated 2190 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
c == 31Description
TRUEnever evaluated
FALSEevaluated 2190 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-52992
465 continue; // Ignore all whitespace that was trailing froma previous request on that socket
executed 40 times by 1 test: continue;
Executed by:
  • tst_QNetworkReply
40
466-
467 bytes++;-
468-
469 // allow both CRLF & LF (only) line endings-
470 if (c == '\n') {
c == '\n'Description
TRUEevaluated 2160 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 50792 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2160-50792
471 // remove the CR at the end-
472 if (fragment.endsWith('\r')) {
fragment.endsWith('\r')Description
TRUEevaluated 2152 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
8-2152
473 fragment.truncate(fragment.length()-1);-
474 }
executed 2152 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2152
475 bool ok = parseStatus(fragment);-
476 state = ReadingHeaderState;-
477 fragment.clear();-
478 if (!ok) {
!okDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2140 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
20-2140
479 return -1;
executed 20 times by 1 test: return -1;
Executed by:
  • tst_QNetworkReply
20
480 }-
481 break;
executed 2140 times by 12 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2140
482 } else {-
483 fragment.append(c);-
484 }
executed 50792 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
50792
485-
486 // is this a valid reply?-
487 if (fragment.length() >= 5 && !fragment.startsWith("HTTP/"))
fragment.length() >= 5Description
TRUEevaluated 42032 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 8760 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
!fragment.startsWith("HTTP/")Description
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qhttpsocketengine - unknown status
FALSEevaluated 42004 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
28-42032
488 {-
489 fragment.clear();-
490 return -1;
executed 28 times by 2 tests: return -1;
Executed by:
  • tst_QNetworkReply
  • tst_qhttpsocketengine - unknown status
28
491 }-
492 } while (haveRead == 1);
executed 50764 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
haveRead == 1Description
TRUEevaluated 50804 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-50804
493-
494 return bytes;
executed 2246 times by 12 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2246
495}-
496-
497bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status)-
498{-
499 // from RFC 2616:-
500 // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF-
501 // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT-
502 // that makes: 'HTTP/n.n xxx Message'-
503 // byte count: 0123456789012-
504-
505 static const int minLength = 11;-
506 static const int dotPos = 6;-
507 static const int spacePos = 8;-
508 static const char httpMagic[] = "HTTP/";-
509-
510 if (status.length() < minLength
status.length() < minLengthDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2152 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
8-2152
511 || !status.startsWith(httpMagic)
!status.startsWith(httpMagic)Description
TRUEnever evaluated
FALSEevaluated 2152 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-2152
512 || status.at(dotPos) != '.'
status.at(dotPos) != '.'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 2148 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
4-2148
513 || status.at(spacePos) != ' ') {
status.at(spacePos) != ' 'Description
TRUEnever evaluated
FALSEevaluated 2148 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-2148
514 // I don't know how to parse this status line-
515 return false;
executed 12 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
12
516 }-
517-
518 // optimize for the valid case: defer checking until the end-
519 majorVersion = status.at(dotPos - 1) - '0';-
520 minorVersion = status.at(dotPos + 1) - '0';-
521-
522 int i = spacePos;-
523 int j = status.indexOf(' ', i + 1); // j == -1 || at(j) == ' ' so j+1 == 0 && j+1 <= length()-
524 const QByteArray code = status.mid(i + 1, j - i - 1);-
525-
526 bool ok;-
527 statusCode = code.toInt(&ok);-
528 reasonPhrase = QString::fromLatin1(status.constData() + j + 1);-
529-
530 return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9;
executed 2148 times by 12 tests: return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2148
531}-
532-
533qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket)-
534{-
535 if (fragment.isEmpty()) {
fragment.isEmpty()Description
TRUEevaluated 2145 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 70 times by 1 test
Evaluated by:
  • tst_QNetworkReply
70-2145
536 // according to http://dev.opera.com/articles/view/mama-http-headers/ the average size of the header-
537 // block is 381 bytes.-
538 // reserve bytes. This is better than always append() which reallocs the byte array.-
539 fragment.reserve(512);-
540 }
executed 2145 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2145
541-
542 qint64 bytes = 0;-
543 char c = 0;-
544 bool allHeaders = false;-
545 qint64 haveRead = 0;-
546 do {-
547 haveRead = socket->read(&c, 1);-
548 if (haveRead == 0) {
haveRead == 0Description
TRUEevaluated 71 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 468289 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
71-468289
549 // read more later-
550 break;
executed 71 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
71
551 } else if (haveRead == -1) {
haveRead == -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 468283 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
6-468283
552 // connection broke down-
553 return -1;
executed 6 times by 1 test: return -1;
Executed by:
  • tst_QNetworkReply
6
554 } else {-
555 fragment.append(c);-
556 bytes++;-
557-
558 if (c == '\n') {
c == '\n'Description
TRUEevaluated 16682 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 451601 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
16682-451601
559 // check for possible header endings. As per HTTP rfc,-
560 // the header endings will be marked by CRLFCRLF. But-
561 // we will allow CRLFCRLF, CRLFLF, LFCRLF, LFLF-
562 if (fragment.endsWith("\n\r\n")
fragment.endsWith("\n\r\n")Description
TRUEevaluated 1800 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 14882 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1800-14882
563 || fragment.endsWith("\n\n"))
fragment.endsWith("\n\n")Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qhttpnetworkreply - unknown status
FALSEevaluated 14877 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
5-14877
564 allHeaders = true;
executed 1805 times by 13 tests: allHeaders = true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1805
565-
566 // there is another case: We have no headers. Then the fragment equals just the line ending-
567 if ((fragment.length() == 2 && fragment.endsWith("\r\n"))
fragment.length() == 2Description
TRUEevaluated 328 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 16354 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
fragment.endsWith("\r\n")Description
TRUEevaluated 328 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-16354
568 || (fragment.length() == 1 && fragment.endsWith("\n")))
fragment.length() == 1Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 16349 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
fragment.endsWith("\n")Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-16349
569 allHeaders = true;
executed 333 times by 7 tests: allHeaders = true;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
333
570 }
executed 16682 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
16682
571 }
executed 468283 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
468283
572 } while (!allHeaders && haveRead > 0);
!allHeadersDescription
TRUEevaluated 466145 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 2138 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
haveRead > 0Description
TRUEevaluated 466145 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-466145
573-
574 // we received all headers now parse them-
575 if (allHeaders) {
allHeadersDescription
TRUEevaluated 2138 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 71 times by 1 test
Evaluated by:
  • tst_QNetworkReply
71-2138
576 parseHeader(fragment);-
577 state = ReadingDataState;-
578 fragment.clear(); // next fragment-
579 bodyLength = contentLength(); // cache the length-
580-
581 // cache isChunked() since it is called often-
582 chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked");-
583-
584 // cache isConnectionCloseEnabled since it is called often-
585 QByteArray connectionHeaderField = headerField("connection");-
586 // check for explicit indication of close or the implicit connection close of HTTP/1.0-
587 connectionCloseEnabled = (connectionHeaderField.toLower().contains("close") ||
connectionHead...tains("close")Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 2129 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
9-2129
588 headerField("proxy-connection").toLower().contains("close")) ||
headerField("p...tains("close")Description
TRUEevaluated 225 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1904 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
225-1904
589 (majorVersion == 1 && minorVersion == 0 &&
majorVersion == 1Description
TRUEevaluated 1900 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qhttpnetworkreply - unknown status
minorVersion == 0Description
TRUEevaluated 480 times by 8 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 1420 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
4-1900
590 (connectionHeaderField.isEmpty() && !headerField("proxy-connection").toLower().contains("keep-alive")));
connectionHead...ield.isEmpty()Description
TRUEevaluated 465 times by 8 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QNetworkReply
!headerField("...("keep-alive")Description
TRUEevaluated 419 times by 8 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qhttpsocketengine - unknown status
15-465
591-
592#ifndef QT_NO_COMPRESS-
593 if (autoDecompress && isCompressed()) {
autoDecompressDescription
TRUEevaluated 1615 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 523 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
isCompressed()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1608 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
7-1615
594 // allocate inflate state-
595 if (!inflateStrm)
!inflateStrmDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-7
596 inflateStrm = new z_stream;
executed 7 times by 1 test: inflateStrm = new z_stream;
Executed by:
  • tst_QNetworkReply
7
597 int ret = initializeInflateStream();-
598 if (ret != Z_OK)
ret != 0Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-7
599 return -1;
never executed: return -1;
0
600 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
7
601#endif-
602-
603 }
executed 2138 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2138
604 return bytes;
executed 2209 times by 13 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2209
605}-
606-
607void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)-
608{-
609 // see rfc2616, sec 4 for information about HTTP/1.1 headers.-
610 // allows relaxed parsing here, accepts both CRLF & LF line endings-
611 int i = 0;-
612 while (i < header.count()) {
i < header.count()Description
TRUEevaluated 16694 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_qhttpnetworkreply - unknown status
7-16694
613 int j = header.indexOf(':', i); // field-name-
614 if (j == -1)
j == -1Description
TRUEevaluated 2138 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 14556 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2138-14556
615 break;
executed 2138 times by 13 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2138
616 const QByteArray field = header.mid(i, j - i).trimmed();-
617 j++;-
618 // any number of LWS is allowed before and after the value-
619 QByteArray value;-
620 do {-
621 i = header.indexOf('\n', j);-
622 if (i == -1)
i == -1Description
TRUEnever evaluated
FALSEevaluated 14562 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-14562
623 break;
never executed: break;
0
624 if (!value.isEmpty())
!value.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qhttpnetworkreply - unknown status
FALSEevaluated 14561 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
1-14561
625 value += ' ';
executed 1 time by 1 test: value += ' ';
Executed by:
  • tst_qhttpnetworkreply - unknown status
1
626 // check if we have CRLF or only LF-
627 bool hasCR = (i && header[i-1] == '\r');
iDescription
TRUEevaluated 14562 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
header[i-1] == '\r'Description
TRUEevaluated 14555 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qhttpnetworkreply - unknown status
0-14562
628 int length = i -(hasCR ? 1: 0) - j;
hasCRDescription
TRUEevaluated 14555 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qhttpnetworkreply - unknown status
7-14555
629 value += header.mid(j, length).trimmed();-
630 j = ++i;-
631 } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t'));
executed 14562 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
i < header.count()Description
TRUEevaluated 14555 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_qhttpnetworkreply - unknown status
header.at(i) == ' 'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qhttpnetworkreply - unknown status
FALSEevaluated 14549 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
header.at(i) == '\t'Description
TRUEnever evaluated
FALSEevaluated 14549 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-14562
632 if (i == -1)
i == -1Description
TRUEnever evaluated
FALSEevaluated 14556 times by 13 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
0-14556
633 break; // something is wrong
never executed: break;
0
634-
635 fields.append(qMakePair(field, value));-
636 }
executed 14556 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
14556
637}
executed 2145 times by 13 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qhttpnetworkreply - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
2145
638-
639bool QHttpNetworkReplyPrivate::isChunked()-
640{-
641 return chunkedTransferEncoding;
executed 16719 times by 7 tests: return chunkedTransferEncoding;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
16719
642}-
643-
644bool QHttpNetworkReplyPrivate::isConnectionCloseEnabled()-
645{-
646 return connectionCloseEnabled || forceConnectionCloseEnabled;
executed 3308 times by 8 tests: return connectionCloseEnabled || forceConnectionCloseEnabled;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
3308
647}-
648-
649// note this function can only be used for non-chunked, non-compressed with-
650// known content length-
651qint64 QHttpNetworkReplyPrivate::readBodyVeryFast(QAbstractSocket *socket, char *b)-
652{-
653 // This first read is to flush the buffer inside the socket-
654 qint64 haveRead = 0;-
655 haveRead = socket->read(b, bodyLength - contentRead);-
656 if (haveRead == -1) {
haveRead == -1Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 2655 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
2-2655
657 return -1;
executed 2 times by 2 tests: return -1;
Executed by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
2
658 }-
659 contentRead += haveRead;-
660-
661 if (contentRead == bodyLength) {
contentRead == bodyLengthDescription
TRUEevaluated 346 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 2309 times by 2 tests
Evaluated by:
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
346-2309
662 state = AllDoneState;-
663 }
executed 346 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
346
664-
665 return haveRead;
executed 2655 times by 3 tests: return haveRead;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
2655
666}-
667-
668// note this function can only be used for non-chunked, non-compressed with-
669// known content length-
670qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QByteDataBuffer *rb)-
671{-
672-
673 qint64 toBeRead = qMin(socket->bytesAvailable(), bodyLength - contentRead);-
674 if (readBufferMaxSize)
readBufferMaxSizeDescription
TRUEevaluated 453 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 14233 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
453-14233
675 toBeRead = qMin(toBeRead, readBufferMaxSize);
executed 453 times by 1 test: toBeRead = qMin(toBeRead, readBufferMaxSize);
Executed by:
  • tst_QNetworkReply
453
676-
677 if (!toBeRead)
!toBeReadDescription
TRUEevaluated 6882 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
FALSEevaluated 7804 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
6882-7804
678 return 0;
executed 6882 times by 3 tests: return 0;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
6882
679-
680 QByteArray bd;-
681 bd.resize(toBeRead);-
682 qint64 haveRead = socket->read(bd.data(), toBeRead);-
683 if (haveRead == -1) {
haveRead == -1Description
TRUEnever evaluated
FALSEevaluated 7804 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
0-7804
684 bd.clear();-
685 return 0; // ### error checking here;
never executed: return 0;
0
686 }-
687 bd.resize(haveRead);-
688-
689 rb->append(bd);-
690-
691 if (contentRead + haveRead == bodyLength) {
contentRead + ... == bodyLengthDescription
TRUEevaluated 968 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
FALSEevaluated 6836 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
968-6836
692 state = AllDoneState;-
693 }
executed 968 times by 3 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
968
694-
695 contentRead += haveRead;-
696 return haveRead;
executed 7804 times by 3 tests: return haveRead;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkReply
7804
697}-
698-
699-
700qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuffer *out)-
701{-
702 qint64 bytes = 0;-
703-
704#ifndef QT_NO_COMPRESS-
705 // for gzip we'll allocate a temporary one that we then decompress-
706 QByteDataBuffer *tempOutDataBuffer = (autoDecompress ? new QByteDataBuffer : out);
autoDecompressDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 457 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
15-457
707#else-
708 QByteDataBuffer *tempOutDataBuffer = out;-
709#endif-
710-
711-
712 if (isChunked()) {
isChunked()Description
TRUEevaluated 443 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 29 times by 1 test
Evaluated by:
  • tst_QNetworkReply
29-443
713 // chunked transfer encoding (rfc 2616, sec 3.6)-
714 bytes += readReplyBodyChunked(socket, tempOutDataBuffer);-
715 } else if (bodyLength > 0) {
executed 443 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
bodyLength > 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QNetworkReply
9-443
716 // we have a Content-Length-
717 bytes += readReplyBodyRaw(socket, tempOutDataBuffer, bodyLength - contentRead);-
718 if (contentRead + bytes == bodyLength)
contentRead + ... == bodyLengthDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-5
719 state = AllDoneState;
executed 4 times by 1 test: state = AllDoneState;
Executed by:
  • tst_QNetworkReply
4
720 } else {
executed 9 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
9
721 // no content length. just read what's possible-
722 bytes += readReplyBodyRaw(socket, tempOutDataBuffer, socket->bytesAvailable());-
723 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
20
724-
725#ifndef QT_NO_COMPRESS-
726 // This is true if there is compressed encoding and we're supposed to use it.-
727 if (autoDecompress) {
autoDecompressDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 457 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
15-457
728 qint64 uncompressRet = uncompressBodyData(tempOutDataBuffer, out);-
729 delete tempOutDataBuffer;-
730 if (uncompressRet < 0)
uncompressRet < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QNetworkReply
1-14
731 return -1;
executed 1 time by 1 test: return -1;
Executed by:
  • tst_QNetworkReply
1
732 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
14
733#endif-
734-
735 contentRead += bytes;-
736 return bytes;
executed 471 times by 4 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
471
737}-
738-
739#ifndef QT_NO_COMPRESS-
740int QHttpNetworkReplyPrivate::initializeInflateStream()-
741{-
742 inflateStrm->zalloc = Z_NULL;-
743 inflateStrm->zfree = Z_NULL;-
744 inflateStrm->opaque = Z_NULL;-
745 inflateStrm->avail_in = 0;-
746 inflateStrm->next_in = Z_NULL;-
747 // "windowBits can also be greater than 15 for optional gzip decoding.-
748 // Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"-
749 // http://www.zlib.net/manual.html-
750 int ret = inflateInit2(inflateStrm, MAX_WBITS+32);-
751 Q_ASSERT(ret == Z_OK);-
752 return ret;
executed 7 times by 1 test: return ret;
Executed by:
  • tst_QNetworkReply
7
753}-
754-
755qint64 QHttpNetworkReplyPrivate::uncompressBodyData(QByteDataBuffer *in, QByteDataBuffer *out)-
756{-
757 if (!inflateStrm) { // happens when called from the SPDY protocol handler
!inflateStrmDescription
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-15
758 inflateStrm = new z_stream;-
759 initializeInflateStream();-
760 }
never executed: end of block
0
761-
762 if (!inflateStrm)
!inflateStrmDescription
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-15
763 return -1;
never executed: return -1;
0
764-
765 bool triedRawDeflate = false;-
766 for (int i = 0; i < in->bufferCount(); i++) {
i < in->bufferCount()Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QNetworkReply
10-17
767 QByteArray &bIn = (*in)[i];-
768-
769 inflateStrm->avail_in = bIn.size();-
770 inflateStrm->next_in = reinterpret_cast<Bytef*>(bIn.data());-
771-
772 do {-
773 QByteArray bOut;-
774 // make a wild guess about the uncompressed size.-
775 bOut.reserve(inflateStrm->avail_in * 3 + 512);-
776 inflateStrm->avail_out = bOut.capacity();-
777 inflateStrm->next_out = reinterpret_cast<Bytef*>(bOut.data());-
778-
779 int ret = inflate(inflateStrm, Z_NO_FLUSH);-
780 //All negative return codes are errors, in the context of HTTP compression, Z_NEED_DICT is also an error.-
781 // in the case where we get Z_DATA_ERROR this could be because we received raw deflate compressed data.-
782 if (ret == Z_DATA_ERROR && !triedRawDeflate) {
ret == (-3)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
!triedRawDeflateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
1-59
783 inflateEnd(inflateStrm);-
784 triedRawDeflate = true;-
785 inflateStrm->zalloc = Z_NULL;-
786 inflateStrm->zfree = Z_NULL;-
787 inflateStrm->opaque = Z_NULL;-
788 inflateStrm->avail_in = 0;-
789 inflateStrm->next_in = Z_NULL;-
790 int ret = inflateInit2(inflateStrm, -MAX_WBITS);-
791 if (ret != Z_OK) {
ret != 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1
792 return -1;
never executed: return -1;
0
793 } else {-
794 inflateStrm->avail_in = bIn.size();-
795 inflateStrm->next_in = reinterpret_cast<Bytef*>(bIn.data());-
796 continue;
executed 1 time by 1 test: continue;
Executed by:
  • tst_QNetworkReply
1
797 }-
798 } else if (ret < 0 || ret == Z_NEED_DICT) {
ret < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
ret == 2Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-59
799 return -1;
executed 1 time by 1 test: return -1;
Executed by:
  • tst_QNetworkReply
1
800 }-
801 bOut.resize(bOut.capacity() - inflateStrm->avail_out);-
802 out->append(bOut);-
803 if (ret == Z_STREAM_END)
ret == 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QNetworkReply
4-55
804 return out->byteAmount();
executed 4 times by 1 test: return out->byteAmount();
Executed by:
  • tst_QNetworkReply
4
805 } while (inflateStrm->avail_in > 0);
executed 55 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
inflateStrm->avail_in > 0Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QNetworkReply
12-55
806 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
12
807-
808 return out->byteAmount();
executed 10 times by 1 test: return out->byteAmount();
Executed by:
  • tst_QNetworkReply
10
809}-
810#endif-
811-
812qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QAbstractSocket *socket, QByteDataBuffer *out, qint64 size)-
813{-
814 // FIXME get rid of this function and just use readBodyFast and give it socket->bytesAvailable()-
815 qint64 bytes = 0;-
816 Q_ASSERT(socket);-
817 Q_ASSERT(out);-
818-
819 int toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, socket->bytesAvailable()));-
820-
821 if (readBufferMaxSize)
readBufferMaxSizeDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 208 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
9-208
822 toBeRead = qMin<qint64>(toBeRead, readBufferMaxSize);
executed 9 times by 1 test: toBeRead = qMin<qint64>(toBeRead, readBufferMaxSize);
Executed by:
  • tst_QNetworkReply
9
823-
824 while (toBeRead > 0) {
toBeRead > 0Description
TRUEevaluated 187 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 217 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
187-217
825 QByteArray byteData;-
826 byteData.resize(toBeRead);-
827 qint64 haveRead = socket->read(byteData.data(), byteData.size());-
828 if (haveRead <= 0) {
haveRead <= 0Description
TRUEnever evaluated
FALSEevaluated 187 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-187
829 // ### error checking here-
830 byteData.clear();-
831 return bytes;
never executed: return bytes;
0
832 }-
833-
834 byteData.resize(haveRead);-
835 out->append(byteData);-
836 bytes += haveRead;-
837 size -= haveRead;-
838-
839 toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, socket->bytesAvailable()));-
840 }
executed 187 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
187
841 return bytes;
executed 217 times by 4 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
217
842-
843}-
844-
845qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QAbstractSocket *socket, QByteDataBuffer *out)-
846{-
847 qint64 bytes = 0;-
848 while (socket->bytesAvailable()) {
socket->bytesAvailable()Description
TRUEevaluated 409 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 222 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
222-409
849-
850 if (readBufferMaxSize && (bytes > readBufferMaxSize))
readBufferMaxSizeDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 396 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
(bytes > readBufferMaxSize)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QNetworkReply
3-396
851 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QNetworkReply
3
852-
853 if (!lastChunkRead && currentChunkRead >= currentChunkSize) {
!lastChunkReadDescription
TRUEevaluated 406 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
currentChunkRe...rrentChunkSizeDescription
TRUEevaluated 361 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 45 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-406
854 // For the first chunk and when we're done with a chunk-
855 currentChunkSize = 0;-
856 currentChunkRead = 0;-
857 if (bytes) {
bytesDescription
TRUEevaluated 127 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 234 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
127-234
858 // After a chunk-
859 char crlf[2];-
860 // read the "\r\n" after the chunk-
861 qint64 haveRead = socket->read(crlf, 2);-
862 // FIXME: This code is slightly broken and not optimal. What if the 2 bytes are not available yet?!-
863 // For nice reasons (the toLong in getChunkSize accepting \n at the beginning-
864 // it right now still works, but we should definitely fix this.-
865-
866 if (haveRead != 2)
haveRead != 2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 126 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
1-126
867 return bytes; // FIXME
executed 1 time by 1 test: return bytes;
Executed by:
  • tst_QNetworkReply
1
868 bytes += haveRead;-
869 }
executed 126 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
126
870 // Note that chunk size gets stored in currentChunkSize, what is returned is the bytes read-
871 bytes += getChunkSize(socket, &currentChunkSize);-
872 if (currentChunkSize == -1)
currentChunkSize == -1Description
TRUEevaluated 97 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 263 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
97-263
873 break;
executed 97 times by 4 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
97
874 }
executed 263 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
263
875 // if the chunk size is 0, end of the stream-
876 if (currentChunkSize == 0 || lastChunkRead) {
currentChunkSize == 0Description
TRUEevaluated 120 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 188 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
lastChunkReadDescription
TRUEnever evaluated
FALSEevaluated 188 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-188
877 lastChunkRead = true;-
878 // try to read the "\r\n" after the chunk-
879 char crlf[2];-
880 qint64 haveRead = socket->read(crlf, 2);-
881 if (haveRead > 0)
haveRead > 0Description
TRUEevaluated 120 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-120
882 bytes += haveRead;
executed 120 times by 4 tests: bytes += haveRead;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
120
883-
884 if ((haveRead == 2 && crlf[0] == '\r' && crlf[1] == '\n') || (haveRead == 1 && crlf[0] == '\n'))
haveRead == 2Description
TRUEevaluated 120 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
crlf[0] == '\r'Description
TRUEevaluated 120 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
crlf[1] == '\n'Description
TRUEevaluated 120 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
haveRead == 1Description
TRUEnever evaluated
FALSEnever evaluated
crlf[0] == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
0-120
885 state = AllDoneState;
executed 120 times by 4 tests: state = AllDoneState;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
120
886 else if (haveRead == 1 && crlf[0] == '\r')
haveRead == 1Description
TRUEnever evaluated
FALSEnever evaluated
crlf[0] == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
0
887 break; // Still waiting for the last \n
never executed: break;
0
888 else if (haveRead > 0) {
haveRead > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
889 // If we read something else then CRLF, we need to close the channel.-
890 forceConnectionCloseEnabled = true;-
891 state = AllDoneState;-
892 }
never executed: end of block
0
893 break;
executed 120 times by 4 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
120
894 }-
895-
896 // otherwise, try to begin reading this chunk / to read what is missing for this chunk-
897 qint64 haveRead = readReplyBodyRaw (socket, out, currentChunkSize - currentChunkRead);-
898 currentChunkRead += haveRead;-
899 bytes += haveRead;-
900-
901 // ### error checking here-
902-
903 }
executed 188 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
188
904 return bytes;
executed 442 times by 4 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
442
905}-
906-
907qint64 QHttpNetworkReplyPrivate::getChunkSize(QAbstractSocket *socket, qint64 *chunkSize)-
908{-
909 qint64 bytes = 0;-
910 char crlf[2];-
911 *chunkSize = -1;-
912-
913 int bytesAvailable = socket->bytesAvailable();-
914 // FIXME rewrite to permanent loop without bytesAvailable-
915 while (bytesAvailable > bytes) {
bytesAvailable > bytesDescription
TRUEevaluated 664 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 97 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
97-664
916 qint64 sniffedBytes = socket->peek(crlf, 2);-
917 int fragmentSize = fragment.size();-
918-
919 // check the next two bytes for a "\r\n", skip blank lines-
920 if ((fragmentSize && sniffedBytes == 2 && crlf[0] == '\r' && crlf[1] == '\n')
fragmentSizeDescription
TRUEevaluated 401 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 263 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
sniffedBytes == 2Description
TRUEevaluated 388 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
crlf[0] == '\r'Description
TRUEevaluated 263 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 125 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
crlf[1] == '\n'Description
TRUEevaluated 263 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-401
921 ||(fragmentSize > 1 && fragment.endsWith('\r') && crlf[0] == '\n'))
fragmentSize > 1Description
TRUEevaluated 73 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 328 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
fragment.endsWith('\r')Description
TRUEnever evaluated
FALSEevaluated 73 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
crlf[0] == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
0-328
922 {-
923 bytes += socket->read(crlf, 1); // read the \r or \n-
924 if (crlf[0] == '\r')
crlf[0] == '\r'Description
TRUEevaluated 263 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-263
925 bytes += socket->read(crlf, 1); // read the \n
executed 263 times by 4 tests: bytes += socket->read(crlf, 1);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
263
926 bool ok = false;-
927 // ignore the chunk-extension-
928 fragment = fragment.mid(0, fragment.indexOf(';')).trimmed();-
929 *chunkSize = fragment.toLong(&ok, 16);-
930 fragment.clear();-
931 break; // size done
executed 263 times by 4 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
263
932 } else {-
933 // read the fragment to the buffer-
934 char c = 0;-
935 qint64 haveRead = socket->read(&c, 1);-
936 if (haveRead < 0) {
haveRead < 0Description
TRUEnever evaluated
FALSEevaluated 401 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
0-401
937 return -1; // FIXME
never executed: return -1;
0
938 }-
939 bytes += haveRead;-
940 fragment.append(c);-
941 }
executed 401 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
401
942 }-
943-
944 return bytes;
executed 360 times by 4 tests: return bytes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
360
945}-
946-
947bool QHttpNetworkReplyPrivate::isRedirecting() const-
948{-
949 // We're in the process of redirecting - if the HTTP status code says so and-
950 // followRedirect is switched on-
951 return (QHttpNetworkReply::isHttpRedirect(statusCode)
executed 7 times by 1 test: return (QHttpNetworkReply::isHttpRedirect(statusCode) && request.isFollowRedirects());
Executed by:
  • tst_QNetworkReply
7
952 && request.isFollowRedirects());
executed 7 times by 1 test: return (QHttpNetworkReply::isHttpRedirect(statusCode) && request.isFollowRedirects());
Executed by:
  • tst_QNetworkReply
7
953}-
954-
955bool QHttpNetworkReplyPrivate::shouldEmitSignals()-
956{-
957 // for 401 & 407 don't emit the data signals. Content along with these-
958 // responses are sent only if the authentication fails.-
959 return (statusCode != 401 && statusCode != 407);
executed 18943 times by 7 tests: return (statusCode != 401 && statusCode != 407);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
18943
960}-
961-
962bool QHttpNetworkReplyPrivate::expectContent()-
963{-
964 // check whether we can expect content after the headers (rfc 2616, sec4.4)-
965 if ((statusCode >= 100 && statusCode < 200)
statusCode >= 100Description
TRUEevaluated 1622 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
statusCode < 200Description
TRUEnever evaluated
FALSEevaluated 1622 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
0-1622
966 || statusCode == 204 || statusCode == 304)
statusCode == 204Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 1618 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
statusCode == 304Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 1609 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
4-1618
967 return false;
executed 13 times by 3 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
13
968 if (request.operation() == QHttpNetworkRequest::Head)
request.operat...kRequest::HeadDescription
TRUEevaluated 107 times by 2 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
FALSEevaluated 1502 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_Spdy
107-1502
969 return false; // no body expected for HEAD request
executed 107 times by 2 tests: return false;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
107
970 qint64 expectedContentLength = contentLength();-
971 if (expectedContentLength == 0)
expectedContentLength == 0Description
TRUEevaluated 31 times by 2 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
FALSEevaluated 1471 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
31-1471
972 return false;
executed 31 times by 2 tests: return false;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
31
973 if (expectedContentLength == -1 && bodyLength == 0) {
expectedContentLength == -1Description
TRUEevaluated 147 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 1324 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
bodyLength == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 146 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
1-1324
974 // The content-length header was stripped, but its value was 0.-
975 // This would be the case for an explicitly zero-length compressed response.-
976 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QNetworkReply
1
977 }-
978 return true;
executed 1470 times by 6 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
1470
979}-
980-
981void QHttpNetworkReplyPrivate::eraseData()-
982{-
983 compressedData.clear();-
984 responseData.clear();-
985}
executed 323 times by 4 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_Spdy
323
986-
987-
988// SSL support below-
989#ifndef QT_NO_SSL-
990-
991QSslConfiguration QHttpNetworkReply::sslConfiguration() const-
992{-
993 Q_D(const QHttpNetworkReply);-
994-
995 if (!d->connectionChannel)
!d->connectionChannelDescription
TRUEnever evaluated
FALSEevaluated 526 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
0-526
996 return QSslConfiguration();
never executed: return QSslConfiguration();
0
997-
998 QSslSocket *sslSocket = qobject_cast<QSslSocket*>(d->connectionChannel->socket);-
999 if (!sslSocket)
!sslSocketDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 524 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
2-524
1000 return QSslConfiguration();
executed 2 times by 1 test: return QSslConfiguration();
Executed by:
  • tst_Spdy
2
1001-
1002 return sslSocket->sslConfiguration();
executed 524 times by 2 tests: return sslSocket->sslConfiguration();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
524
1003}-
1004-
1005void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config)-
1006{-
1007 Q_D(QHttpNetworkReply);-
1008 if (d->connection)
d->connectionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1009 d->connection->setSslConfiguration(config);
never executed: d->connection->setSslConfiguration(config);
0
1010}
never executed: end of block
0
1011-
1012void QHttpNetworkReply::ignoreSslErrors()-
1013{-
1014 Q_D(QHttpNetworkReply);-
1015 if (d->connection)
d->connectionDescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
0-32
1016 d->connection->ignoreSslErrors();
executed 32 times by 2 tests: d->connection->ignoreSslErrors();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
32
1017}
executed 32 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
32
1018-
1019void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)-
1020{-
1021 Q_D(QHttpNetworkReply);-
1022 if (d->connection)
d->connectionDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
0-6
1023 d->connection->ignoreSslErrors(errors);
executed 6 times by 1 test: d->connection->ignoreSslErrors(errors);
Executed by:
  • tst_QNetworkReply
6
1024}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
6
1025-
1026-
1027#endif //QT_NO_SSL-
1028-
1029-
1030QT_END_NAMESPACE-
1031-
1032#endif // QT_NO_HTTP-
Source codeSwitch to Preprocessed file

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