access/qhttpnetworkreply.cpp

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

Generated by Squish Coco Non-Commercial