access/qhttpnetworkreply.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13QHttpNetworkReply::QHttpNetworkReply(const QUrl &url, QObject *parent) -
14 : QObject(*new QHttpNetworkReplyPrivate(url), parent) -
15{ -
16}
executed: }
Execution Count:721
721
17 -
18QHttpNetworkReply::~QHttpNetworkReply() -
19{ -
20 QHttpNetworkReplyPrivate * const d = d_func(); -
21 if (d->connection) {
evaluated: d->connection
TRUEFALSE
yes
Evaluation Count:618
yes
Evaluation Count:95
95-618
22 d->connection->d_func()->removeReply(this); -
23 }
executed: }
Execution Count:618
618
24 -
25 -
26 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
27 inflateEnd(d->inflateStrm);
executed: inflateEnd(d->inflateStrm);
Execution Count:10
10
28 -
29}
executed: }
Execution Count:713
713
30 -
31QUrl QHttpNetworkReply::url() const -
32{ -
33 return d_func()->url;
never executed: return d_func()->url;
0
34} -
35void QHttpNetworkReply::setUrl(const QUrl &url) -
36{ -
37 QHttpNetworkReplyPrivate * const d = d_func(); -
38 d->url = url; -
39}
never executed: }
0
40 -
41qint64 QHttpNetworkReply::contentLength() const -
42{ -
43 return d_func()->contentLength();
executed: return d_func()->contentLength();
Execution Count:1334
1334
44} -
45 -
46void QHttpNetworkReply::setContentLength(qint64 length) -
47{ -
48 QHttpNetworkReplyPrivate * const d = d_func(); -
49 d->setContentLength(length); -
50}
never executed: }
0
51 -
52QList<QPair<QByteArray, QByteArray> > QHttpNetworkReply::header() const -
53{ -
54 return d_func()->fields;
executed: return d_func()->fields;
Execution Count:983
983
55} -
56 -
57QByteArray QHttpNetworkReply::headerField(const QByteArray &name, const QByteArray &defaultValue) const -
58{ -
59 return d_func()->headerField(name, defaultValue);
executed: return d_func()->headerField(name, defaultValue);
Execution Count:689
689
60} -
61 -
62void QHttpNetworkReply::setHeaderField(const QByteArray &name, const QByteArray &data) -
63{ -
64 QHttpNetworkReplyPrivate * const d = d_func(); -
65 d->setHeaderField(name, data); -
66}
never executed: }
0
67 -
68void QHttpNetworkReply::parseHeader(const QByteArray &header) -
69{ -
70 QHttpNetworkReplyPrivate * const d = d_func(); -
71 d->parseHeader(header); -
72}
never executed: }
0
73 -
74QHttpNetworkRequest QHttpNetworkReply::request() const -
75{ -
76 return d_func()->request;
executed: return d_func()->request;
Execution Count:604
604
77} -
78 -
79void QHttpNetworkReply::setRequest(const QHttpNetworkRequest &request) -
80{ -
81 QHttpNetworkReplyPrivate * const d = d_func(); -
82 d->request = request; -
83 d->ssl = request.isSsl(); -
84}
executed: }
Execution Count:694
694
85 -
86int QHttpNetworkReply::statusCode() const -
87{ -
88 return d_func()->statusCode;
executed: return d_func()->statusCode;
Execution Count:2203
2203
89} -
90 -
91void QHttpNetworkReply::setStatusCode(int code) -
92{ -
93 QHttpNetworkReplyPrivate * const d = d_func(); -
94 d->statusCode = code; -
95}
never executed: }
0
96 -
97QString QHttpNetworkReply::errorString() const -
98{ -
99 return d_func()->errorString;
never executed: return d_func()->errorString;
0
100} -
101 -
102QString QHttpNetworkReply::reasonPhrase() const -
103{ -
104 return d_func()->reasonPhrase;
executed: return d_func()->reasonPhrase;
Execution Count:646
646
105} -
106 -
107void QHttpNetworkReply::setErrorString(const QString &error) -
108{ -
109 QHttpNetworkReplyPrivate * const d = d_func(); -
110 d->errorString = error; -
111}
never executed: }
0
112 -
113int QHttpNetworkReply::majorVersion() const -
114{ -
115 return d_func()->majorVersion;
never executed: return d_func()->majorVersion;
0
116} -
117 -
118int QHttpNetworkReply::minorVersion() const -
119{ -
120 return d_func()->minorVersion;
never executed: return d_func()->minorVersion;
0
121} -
122 -
123qint64 QHttpNetworkReply::bytesAvailable() const -
124{ -
125 const QHttpNetworkReplyPrivate * const d = d_func(); -
126 if (d->connection)
never evaluated: d->connection
0
127 return d->connection->d_func()->uncompressedBytesAvailable(*this);
never executed: return d->connection->d_func()->uncompressedBytesAvailable(*this);
0
128 else -
129 return -1;
never executed: return -1;
0
130} -
131 -
132qint64 QHttpNetworkReply::bytesAvailableNextBlock() const -
133{ -
134 const QHttpNetworkReplyPrivate * const d = d_func(); -
135 if (d->connection)
never evaluated: d->connection
0
136 return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
never executed: return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
0
137 else -
138 return -1;
never executed: return -1;
0
139} -
140 -
141bool QHttpNetworkReply::readAnyAvailable() const -
142{ -
143 const QHttpNetworkReplyPrivate * const d = d_func(); -
144 return (d->responseData.bufferCount() > 0);
executed: return (d->responseData.bufferCount() > 0);
Execution Count:19274
19274
145} -
146 -
147QByteArray QHttpNetworkReply::readAny() -
148{ -
149 QHttpNetworkReplyPrivate * const d = d_func(); -
150 if (d->responseData.bufferCount() == 0)
partially evaluated: d->responseData.bufferCount() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6137
0-6137
151 return QByteArray();
never executed: return QByteArray();
0
152 -
153 -
154 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
155 d->connection->d_func()->readMoreLater(this);
executed: d->connection->d_func()->readMoreLater(this);
Execution Count:1158
1158
156 return d->responseData.read();
executed: return d->responseData.read();
Execution Count:6137
6137
157} -
158 -
159QByteArray QHttpNetworkReply::readAll() -
160{ -
161 QHttpNetworkReplyPrivate * const d = d_func(); -
162 return d->responseData.readAll();
executed: return d->responseData.readAll();
Execution Count:63
63
163} -
164 -
165QByteArray QHttpNetworkReply::read(qint64 amount) -
166{ -
167 QHttpNetworkReplyPrivate * const d = d_func(); -
168 return d->responseData.read(amount);
executed: return d->responseData.read(amount);
Execution Count:595
595
169} -
170 -
171 -
172qint64 QHttpNetworkReply::sizeNextBlock() -
173{ -
174 QHttpNetworkReplyPrivate * const d = d_func(); -
175 return d->responseData.sizeNextBlock();
executed: return d->responseData.sizeNextBlock();
Execution Count:2955
2955
176} -
177 -
178void QHttpNetworkReply::setDownstreamLimited(bool dsl) -
179{ -
180 QHttpNetworkReplyPrivate * const d = d_func(); -
181 d->downstreamLimited = dsl; -
182 d->connection->d_func()->readMoreLater(this); -
183}
executed: }
Execution Count:10
10
184 -
185void QHttpNetworkReply::setReadBufferSize(qint64 size) -
186{ -
187 QHttpNetworkReplyPrivate * const d = d_func(); -
188 d->readBufferMaxSize = size; -
189}
executed: }
Execution Count:11
11
190 -
191bool QHttpNetworkReply::supportsUserProvidedDownloadBuffer() -
192{ -
193 QHttpNetworkReplyPrivate * const d = d_func(); -
194 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
195} -
196 -
197void QHttpNetworkReply::setUserProvidedDownloadBuffer(char* b) -
198{ -
199 QHttpNetworkReplyPrivate * const d = d_func(); -
200 if (supportsUserProvidedDownloadBuffer())
partially evaluated: supportsUserProvidedDownloadBuffer()
TRUEFALSE
yes
Evaluation Count:334
no
Evaluation Count:0
0-334
201 d->userProvidedDownloadBuffer = b;
executed: d->userProvidedDownloadBuffer = b;
Execution Count:334
334
202}
executed: }
Execution Count:334
334
203 -
204char* QHttpNetworkReply::userProvidedDownloadBuffer() -
205{ -
206 QHttpNetworkReplyPrivate * const d = d_func(); -
207 return d->userProvidedDownloadBuffer;
never executed: return d->userProvidedDownloadBuffer;
0
208} -
209 -
210bool QHttpNetworkReply::isFinished() const -
211{ -
212 return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState;
executed: return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState;
Execution Count:30
30
213} -
214 -
215bool QHttpNetworkReply::isPipeliningUsed() const -
216{ -
217 return d_func()->pipeliningUsed;
executed: return d_func()->pipeliningUsed;
Execution Count:638
638
218} -
219 -
220QHttpNetworkConnection* QHttpNetworkReply::connection() -
221{ -
222 return d_func()->connection;
never executed: return d_func()->connection;
0
223} -
224 -
225 -
226QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) -
227 : QHttpNetworkHeaderPrivate(newUrl) -
228 , state(NothingDoneState) -
229 , ssl(false) -
230 , statusCode(100), -
231 majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), -
232 chunkedTransferEncoding(false), -
233 connectionCloseEnabled(true), -
234 forceConnectionCloseEnabled(false), -
235 lastChunkRead(false), -
236 currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0), connection(0), -
237 autoDecompress(false), responseData(), requestIsPrepared(false) -
238 ,pipeliningUsed(false), downstreamLimited(false) -
239 ,userProvidedDownloadBuffer(0) -
240 -
241 ,inflateStrm(0) -
242 -
243 -
244{ -
245}
executed: }
Execution Count:721
721
246 -
247QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate() -
248{ -
249 -
250 if (inflateStrm)
evaluated: inflateStrm
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:703
10-703
251 delete inflateStrm;
executed: delete inflateStrm;
Execution Count:10
10
252 -
253}
executed: }
Execution Count:713
713
254 -
255void QHttpNetworkReplyPrivate::clearHttpLayerInformation() -
256{ -
257 state = NothingDoneState; -
258 statusCode = 100; -
259 bodyLength = 0; -
260 contentRead = 0; -
261 totalProgress = 0; -
262 currentChunkSize = 0; -
263 currentChunkRead = 0; -
264 lastChunkRead = false; -
265 connectionCloseEnabled = true; -
266 -
267 if (autoDecompress && inflateStrm)
partially evaluated: autoDecompress
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
never evaluated: inflateStrm
0-911
268 inflateEnd(inflateStrm);
never executed: inflateEnd(inflateStrm);
0
269 -
270 fields.clear(); -
271}
executed: }
Execution Count:911
911
272 -
273 -
274void QHttpNetworkReplyPrivate::clear() -
275{ -
276 connection = 0; -
277 connectionChannel = 0; -
278 autoDecompress = false; -
279 clearHttpLayerInformation(); -
280}
executed: }
Execution Count:904
904
281 -
282 -
283qint64 QHttpNetworkReplyPrivate::bytesAvailable() const -
284{ -
285 return (state != ReadingDataState ? 0 : fragment.size());
never executed: return (state != ReadingDataState ? 0 : fragment.size());
0
286} -
287 -
288bool QHttpNetworkReplyPrivate::isCompressed() -
289{ -
290 QByteArray encoding = headerField("content-encoding"); -
291 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
292} -
293 -
294void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() -
295{ -
296 -
297 -
298 QByteArray name("content-length"); -
299 QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(), -
300 end = fields.end(); -
301 while (it != end) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:2
2-55
302 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
303 fields.erase(it); -
304 break;
executed: break;
Execution Count:8
8
305 } -
306 ++it; -
307 }
executed: }
Execution Count:47
47
308 -
309}
executed: }
Execution Count:10
10
310 -
311bool QHttpNetworkReplyPrivate::findChallenge(bool forProxy, QByteArray &challenge) const -
312{ -
313 challenge.clear(); -
314 -
315 QByteArray header = forProxy ? "proxy-authenticate" : "www-authenticate";
never evaluated: forProxy
0
316 -
317 QList<QByteArray> challenges = headerFieldValues(header); -
318 for (int i = 0; i<challenges.size(); i++) {
never evaluated: i<challenges.size()
0
319 QByteArray line = challenges.at(i); -
320 -
321 if (!line.toLower().startsWith("negotiate"))
never evaluated: !line.toLower().startsWith("negotiate")
0
322 challenge = line;
never executed: challenge = line;
0
323 }
never executed: }
0
324 return !challenge.isEmpty();
never executed: return !challenge.isEmpty();
0
325} -
326 -
327QAuthenticatorPrivate::Method QHttpNetworkReplyPrivate::authenticationMethod(bool isProxy) const -
328{ -
329 -
330 QAuthenticatorPrivate::Method method = QAuthenticatorPrivate::None; -
331 QByteArray header = isProxy ? "proxy-authenticate" : "www-authenticate";
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:277
58-277
332 QList<QByteArray> challenges = headerFieldValues(header); -
333 for (int i = 0; i<challenges.size(); i++) {
evaluated: i<challenges.size()
TRUEFALSE
yes
Evaluation Count:334
yes
Evaluation Count:335
334-335
334 QByteArray line = challenges.at(i).trimmed().toLower(); -
335 if (method < QAuthenticatorPrivate::Basic
partially evaluated: method < QAuthenticatorPrivate::Basic
TRUEFALSE
yes
Evaluation Count:334
no
Evaluation Count:0
0-334
336 && line.startsWith("basic")) {
evaluated: line.startsWith("basic")
TRUEFALSE
yes
Evaluation Count:270
yes
Evaluation Count:64
64-270
337 method = QAuthenticatorPrivate::Basic; -
338 } else if (method < QAuthenticatorPrivate::Ntlm
partially evaluated: method < QAuthenticatorPrivate::Ntlm
TRUEFALSE
yes
Evaluation Count:64
no
Evaluation Count:0
executed: }
Execution Count:270
0-270
339 && line.startsWith("ntlm")) {
partially evaluated: line.startsWith("ntlm")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:64
0-64
340 method = QAuthenticatorPrivate::Ntlm; -
341 } else if (method < QAuthenticatorPrivate::DigestMd5
partially evaluated: method < QAuthenticatorPrivate::DigestMd5
TRUEFALSE
yes
Evaluation Count:64
no
Evaluation Count:0
never executed: }
0-64
342 && line.startsWith("digest")) {
evaluated: line.startsWith("digest")
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:2
2-62
343 method = QAuthenticatorPrivate::DigestMd5; -
344 }
executed: }
Execution Count:62
62
345 } -
346 return method;
executed: return method;
Execution Count:335
335
347} -
348 -
349qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) -
350{ -
351 if (fragment.isEmpty()) {
evaluated: fragment.isEmpty()
TRUEFALSE
yes
Evaluation Count:879
yes
Evaluation Count:42
42-879
352 -
353 fragment.reserve(32); -
354 }
executed: }
Execution Count:879
879
355 -
356 qint64 bytes = 0; -
357 char c; -
358 qint64 haveRead = 0; -
359 -
360 do { -
361 haveRead = socket->read(&c, 1); -
362 if (haveRead == -1)
evaluated: haveRead == -1
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:19074
18-19074
363 return -1;
executed: return -1;
Execution Count:18
18
364 else if (haveRead == 0)
evaluated: haveRead == 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:19031
43-19031
365 break;
executed: break;
Execution Count:43
43
366 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
367 continue;
executed: continue;
Execution Count:30
30
368 -
369 bytes++; -
370 -
371 -
372 if (c == '\n') {
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:841
yes
Evaluation Count:18160
841-18160
373 -
374 if (fragment.endsWith('\r')) {
evaluated: fragment.endsWith('\r')
TRUEFALSE
yes
Evaluation Count:833
yes
Evaluation Count:8
8-833
375 fragment.truncate(fragment.length()-1); -
376 }
executed: }
Execution Count:833
833
377 bool ok = parseStatus(fragment); -
378 state = ReadingHeaderState; -
379 fragment.clear(); -
380 if (!ok) {
evaluated: !ok
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:826
15-826
381 return -1;
executed: return -1;
Execution Count:15
15
382 } -
383 break;
executed: break;
Execution Count:826
826
384 } else { -
385 fragment.append(c); -
386 }
executed: }
Execution Count:18160
18160
387 -
388 -
389 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
390 { -
391 fragment.clear(); -
392 return -1;
executed: return -1;
Execution Count:19
19
393 } -
394 } while (haveRead == 1);
partially evaluated: haveRead == 1
TRUEFALSE
yes
Evaluation Count:18171
no
Evaluation Count:0
executed: }
Execution Count:18141
0-18171
395 -
396 return bytes;
executed: return bytes;
Execution Count:869
869
397} -
398 -
399bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) -
400{ -
401 -
402 -
403 -
404 -
405 -
406 -
407 static const int minLength = 11; -
408 static const int dotPos = 6; -
409 static const int spacePos = 8; -
410 static const char httpMagic[] = "HTTP/"; -
411 -
412 if (status.length() < minLength
evaluated: status.length() < minLength
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:835
6-835
413 || !status.startsWith(httpMagic)
partially evaluated: !status.startsWith(httpMagic)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:835
0-835
414 || status.at(dotPos) != '.'
evaluated: status.at(dotPos) != '.'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:832
3-832
415 || status.at(spacePos) != ' ') {
partially evaluated: status.at(spacePos) != ' '
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:832
0-832
416 -
417 return false;
executed: return false;
Execution Count:9
9
418 } -
419 -
420 -
421 majorVersion = status.at(dotPos - 1) - '0'; -
422 minorVersion = status.at(dotPos + 1) - '0'; -
423 -
424 int i = spacePos; -
425 int j = status.indexOf(' ', i + 1); -
426 const QByteArray code = status.mid(i + 1, j - i - 1); -
427 -
428 bool ok; -
429 statusCode = code.toInt(&ok); -
430 reasonPhrase = QString::fromLatin1(status.constData() + j + 1); -
431 -
432 return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9;
executed: return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9;
Execution Count:832
832
433} -
434 -
435qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) -
436{ -
437 if (fragment.isEmpty()) {
evaluated: fragment.isEmpty()
TRUEFALSE
yes
Evaluation Count:827
yes
Evaluation Count:70
70-827
438 -
439 -
440 -
441 fragment.reserve(512); -
442 }
executed: }
Execution Count:827
827
443 -
444 qint64 bytes = 0; -
445 char c = 0; -
446 bool allHeaders = false; -
447 qint64 haveRead = 0; -
448 do { -
449 haveRead = socket->read(&c, 1); -
450 if (haveRead == 0) {
evaluated: haveRead == 0
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:182792
71-182792
451 -
452 break;
executed: break;
Execution Count:71
71
453 } else if (haveRead == -1) {
evaluated: haveRead == -1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:182787
5-182787
454 -
455 return -1;
executed: return -1;
Execution Count:5
5
456 } else { -
457 fragment.append(c); -
458 bytes++; -
459 -
460 if (c == '\n') {
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:6361
yes
Evaluation Count:176426
6361-176426
461 -
462 -
463 -
464 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
465 || fragment.endsWith("\r\n\n")
partially evaluated: fragment.endsWith("\r\n\n")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5569
0-5569
466 || fragment.endsWith("\n\n"))
evaluated: fragment.endsWith("\n\n")
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5566
3-5566
467 allHeaders = true;
executed: allHeaders = true;
Execution Count:795
795
468 -
469 -
470 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
471 || (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
472 allHeaders = true;
executed: allHeaders = true;
Execution Count:26
26
473 }
executed: }
Execution Count:6361
6361
474 }
executed: }
Execution Count:182787
182787
475 } 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
476 -
477 -
478 if (allHeaders) {
evaluated: allHeaders
TRUEFALSE
yes
Evaluation Count:821
yes
Evaluation Count:71
71-821
479 parseHeader(fragment); -
480 state = ReadingDataState; -
481 fragment.clear(); -
482 bodyLength = contentLength(); -
483 -
484 -
485 chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked"); -
486 -
487 -
488 QByteArray connectionHeaderField = headerField("connection"); -
489 -
490 connectionCloseEnabled = (connectionHeaderField.toLower().contains("close") ||
evaluated: connectionHeaderField.toLower().contains("close")
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:814
7-814
491 headerField("proxy-connection").toLower().contains("close")) ||
evaluated: headerField("proxy-connection").toLower().contains("close")
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:747
67-747
492 (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
493 (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
494 -
495 -
496 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
497 -
498 if (!inflateStrm)
partially evaluated: !inflateStrm
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
499 inflateStrm = new z_stream;
executed: inflateStrm = new z_stream;
Execution Count:10
10
500 inflateStrm->zalloc = 0; -
501 inflateStrm->zfree = 0; -
502 inflateStrm->opaque = 0; -
503 inflateStrm->avail_in = 0; -
504 inflateStrm->next_in = 0; -
505 -
506 -
507 -
508 int ret = inflateInit2_((inflateStrm), (15 +32), "1.2.3.4", sizeof(z_stream)); -
509 if (ret != 0)
partially evaluated: ret != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
510 return -1;
never executed: return -1;
0
511 }
executed: }
Execution Count:10
10
512 -
513 -
514 }
executed: }
Execution Count:821
821
515 return bytes;
executed: return bytes;
Execution Count:892
892
516} -
517 -
518void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) -
519{ -
520 -
521 -
522 const QByteArrayMatcher lf("\n"); -
523 const QByteArrayMatcher colon(":"); -
524 int i = 0; -
525 while (i < header.count()) {
partially evaluated: i < header.count()
TRUEFALSE
yes
Evaluation Count:6361
no
Evaluation Count:0
0-6361
526 int j = colon.indexIn(header, i); -
527 if (j == -1)
evaluated: j == -1
TRUEFALSE
yes
Evaluation Count:821
yes
Evaluation Count:5540
821-5540
528 break;
executed: break;
Execution Count:821
821
529 const QByteArray field = header.mid(i, j - i).trimmed(); -
530 j++; -
531 -
532 QByteArray value; -
533 do { -
534 i = lf.indexIn(header, j); -
535 if (i == -1)
partially evaluated: i == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5540
0-5540
536 break;
never executed: break;
0
537 if (!value.isEmpty())
partially evaluated: !value.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5540
0-5540
538 value += ' ';
never executed: value += ' ';
0
539 -
540 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
541 int length = i -(hasCR ? 1: 0) - j;
evaluated: hasCR
TRUEFALSE
yes
Evaluation Count:5535
yes
Evaluation Count:5
5-5535
542 value += header.mid(j, length).trimmed(); -
543 j = ++i; -
544 } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t'));
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
executed: }
Execution Count:5540
0-5540
545 if (i == -1)
partially evaluated: i == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5540
0-5540
546 break;
never executed: break;
0
547 -
548 fields.append(qMakePair(field, value)); -
549 }
executed: }
Execution Count:5540
5540
550}
executed: }
Execution Count:821
821
551 -
552bool QHttpNetworkReplyPrivate::isChunked() -
553{ -
554 return chunkedTransferEncoding;
executed: return chunkedTransferEncoding;
Execution Count:13029
13029
555} -
556 -
557bool QHttpNetworkReplyPrivate::isConnectionCloseEnabled() -
558{ -
559 return connectionCloseEnabled || forceConnectionCloseEnabled;
executed: return connectionCloseEnabled || forceConnectionCloseEnabled;
Execution Count:1648
1648
560} -
561 -
562 -
563 -
564qint64 QHttpNetworkReplyPrivate::readBodyVeryFast(QAbstractSocket *socket, char *b) -
565{ -
566 -
567 qint64 haveRead = 0; -
568 haveRead = socket->read(b, bodyLength - contentRead); -
569 if (haveRead == -1) {
evaluated: haveRead == -1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5136
2-5136
570 return -1;
executed: return -1;
Execution Count:2
2
571 } -
572 contentRead += haveRead; -
573 -
574 if (contentRead == bodyLength) {
evaluated: contentRead == bodyLength
TRUEFALSE
yes
Evaluation Count:316
yes
Evaluation Count:4820
316-4820
575 state = AllDoneState; -
576 }
executed: }
Execution Count:316
316
577 -
578 return haveRead;
executed: return haveRead;
Execution Count:5136
5136
579} -
580 -
581 -
582 -
583qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QByteDataBuffer *rb) -
584{ -
585 -
586 qint64 toBeRead = qMin(socket->bytesAvailable(), bodyLength - contentRead); -
587 if (readBufferMaxSize)
evaluated: readBufferMaxSize
TRUEFALSE
yes
Evaluation Count:2237
yes
Evaluation Count:9003
2237-9003
588 toBeRead = qMin(toBeRead, readBufferMaxSize);
executed: toBeRead = qMin(toBeRead, readBufferMaxSize);
Execution Count:2237
2237
589 -
590 if (!toBeRead)
evaluated: !toBeRead
TRUEFALSE
yes
Evaluation Count:5065
yes
Evaluation Count:6175
5065-6175
591 return 0;
executed: return 0;
Execution Count:5065
5065
592 -
593 QByteArray bd; -
594 bd.resize(toBeRead); -
595 qint64 haveRead = socket->read(bd.data(), toBeRead); -
596 if (haveRead == -1) {
partially evaluated: haveRead == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6175
0-6175
597 bd.clear(); -
598 return 0;
never executed: return 0;
0
599 } -
600 bd.resize(haveRead); -
601 -
602 rb->append(bd); -
603 -
604 if (contentRead + haveRead == bodyLength) {
evaluated: contentRead + haveRead == bodyLength
TRUEFALSE
yes
Evaluation Count:262
yes
Evaluation Count:5913
262-5913
605 state = AllDoneState; -
606 }
executed: }
Execution Count:262
262
607 -
608 contentRead += haveRead; -
609 return haveRead;
executed: return haveRead;
Execution Count:6175
6175
610} -
611 -
612 -
613qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuffer *out) -
614{ -
615 qint64 bytes = 0; -
616 -
617 -
618 -
619 QByteDataBuffer *tempOutDataBuffer = (autoDecompress ? new QByteDataBuffer : out);
evaluated: autoDecompress
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:381
60-381
620 -
621 -
622 -
623 -
624 -
625 if (isChunked()) {
evaluated: isChunked()
TRUEFALSE
yes
Evaluation Count:373
yes
Evaluation Count:68
68-373
626 -
627 bytes += readReplyBodyChunked(socket, tempOutDataBuffer); -
628 } else if (bodyLength > 0) {
executed: }
Execution Count:373
evaluated: bodyLength > 0
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:14
14-373
629 -
630 bytes += readReplyBodyRaw(socket, tempOutDataBuffer, bodyLength - contentRead); -
631 if (contentRead + bytes == bodyLength)
evaluated: contentRead + bytes == bodyLength
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:47
7-47
632 state = AllDoneState;
executed: state = AllDoneState;
Execution Count:7
7
633 } else {
executed: }
Execution Count:54
54
634 -
635 bytes += readReplyBodyRaw(socket, tempOutDataBuffer, socket->bytesAvailable()); -
636 }
executed: }
Execution Count:14
14
637 -
638 -
639 -
640 if (autoDecompress) {
evaluated: autoDecompress
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:381
60-381
641 qint64 uncompressRet = uncompressBodyData(tempOutDataBuffer, out); -
642 delete tempOutDataBuffer; -
643 if (uncompressRet < 0)
evaluated: uncompressRet < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:59
1-59
644 return -1;
executed: return -1;
Execution Count:1
1
645 }
executed: }
Execution Count:59
59
646 -
647 -
648 contentRead += bytes; -
649 return bytes;
executed: return bytes;
Execution Count:440
440
650} -
651 -
652 -
653qint64 QHttpNetworkReplyPrivate::uncompressBodyData(QByteDataBuffer *in, QByteDataBuffer *out) -
654{ -
655 if (!inflateStrm)
partially evaluated: !inflateStrm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
0-60
656 return -1;
never executed: return -1;
0
657 -
658 bool triedRawDeflate = false; -
659 for (int i = 0; i < in->bufferCount(); i++) {
evaluated: i < in->bufferCount()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:52
43-52
660 QByteArray &bIn = (*in)[i]; -
661 -
662 inflateStrm->avail_in = bIn.size(); -
663 inflateStrm->next_in = reinterpret_cast<Bytef*>(bIn.data()); -
664 -
665 do { -
666 QByteArray bOut; -
667 -
668 bOut.reserve(inflateStrm->avail_in * 3 + 512); -
669 inflateStrm->avail_out = bOut.capacity(); -
670 inflateStrm->next_out = reinterpret_cast<Bytef*>(bOut.data()); -
671 -
672 int ret = inflate(inflateStrm, 0); -
673 -
674 -
675 if (ret == (-3) && !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
676 inflateEnd(inflateStrm); -
677 triedRawDeflate = true; -
678 inflateStrm->zalloc = 0; -
679 inflateStrm->zfree = 0; -
680 inflateStrm->opaque = 0; -
681 inflateStrm->avail_in = 0; -
682 inflateStrm->next_in = 0; -
683 int ret = inflateInit2_((inflateStrm), (-15), "1.2.3.4", sizeof(z_stream)); -
684 if (ret != 0) {
partially evaluated: ret != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
685 return -1;
never executed: return -1;
0
686 } else { -
687 inflateStrm->avail_in = bIn.size(); -
688 inflateStrm->next_in = reinterpret_cast<Bytef*>(bIn.data()); -
689 continue;
executed: continue;
Execution Count:1
1
690 } -
691 } else if (ret < 0 || ret == 2) {
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
692 return -1;
executed: return -1;
Execution Count:1
1
693 } -
694 bOut.resize(bOut.capacity() - inflateStrm->avail_out); -
695 out->append(bOut); -
696 if (ret == 1)
evaluated: ret == 1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:111
7-111
697 return out->byteAmount();
executed: return out->byteAmount();
Execution Count:7
7
698 } 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
699 }
executed: }
Execution Count:35
35
700 -
701 return out->byteAmount();
executed: return out->byteAmount();
Execution Count:52
52
702} -
703 -
704 -
705qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QAbstractSocket *socket, QByteDataBuffer *out, qint64 size) -
706{ -
707 -
708 qint64 bytes = 0; -
709 qt_noop(); -
710 qt_noop(); -
711 -
712 int toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, socket->bytesAvailable())); -
713 -
714 if (readBufferMaxSize)
evaluated: readBufferMaxSize
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:194
10-194
715 toBeRead = qMin<qint64>(toBeRead, readBufferMaxSize);
executed: toBeRead = qMin<qint64>(toBeRead, readBufferMaxSize);
Execution Count:10
10
716 -
717 while (toBeRead > 0) {
evaluated: toBeRead > 0
TRUEFALSE
yes
Evaluation Count:162
yes
Evaluation Count:204
162-204
718 QByteArray byteData; -
719 byteData.resize(toBeRead); -
720 qint64 haveRead = socket->read(byteData.data(), byteData.size()); -
721 if (haveRead <= 0) {
partially evaluated: haveRead <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:162
0-162
722 -
723 byteData.clear(); -
724 return bytes;
never executed: return bytes;
0
725 } -
726 -
727 byteData.resize(haveRead); -
728 out->append(byteData); -
729 bytes += haveRead; -
730 size -= haveRead; -
731 -
732 toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, socket->bytesAvailable())); -
733 }
executed: }
Execution Count:162
162
734 return bytes;
executed: return bytes;
Execution Count:204
204
735 -
736} -
737 -
738qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QAbstractSocket *socket, QByteDataBuffer *out) -
739{ -
740 qint64 bytes = 0; -
741 while (socket->bytesAvailable()) {
evaluated: socket->bytesAvailable()
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:156
156-353
742 -
743 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
744 break;
executed: break;
Execution Count:2
2
745 -
746 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
747 -
748 currentChunkSize = 0; -
749 currentChunkRead = 0; -
750 if (bytes) {
evaluated: bytes
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:228
110-228
751 -
752 char crlf[2]; -
753 -
754 qint64 haveRead = socket->read(crlf, 2); -
755 -
756 -
757 -
758 -
759 if (haveRead != 2)
evaluated: haveRead != 2
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:109
1-109
760 return bytes;
executed: return bytes;
Execution Count:1
1
761 bytes += haveRead; -
762 }
executed: }
Execution Count:109
109
763 -
764 bytes += getChunkSize(socket, &currentChunkSize); -
765 if (currentChunkSize == -1)
evaluated: currentChunkSize == -1
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:238
99-238
766 break;
executed: break;
Execution Count:99
99
767 }
executed: }
Execution Count:238
238
768 -
769 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
770 lastChunkRead = true; -
771 -
772 char crlf[2]; -
773 qint64 haveRead = socket->read(crlf, 2); -
774 if (haveRead > 0)
partially evaluated: haveRead > 0
TRUEFALSE
yes
Evaluation Count:115
no
Evaluation Count:0
0-115
775 bytes += haveRead;
executed: bytes += haveRead;
Execution Count:115
115
776 -
777 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
778 state = AllDoneState;
executed: state = AllDoneState;
Execution Count:115
115
779 else if (haveRead == 1 && crlf[0] == '\r')
never evaluated: haveRead == 1
never evaluated: crlf[0] == '\r'
0
780 break;
never executed: break;
0
781 else if (haveRead > 0) {
never evaluated: haveRead > 0
0
782 -
783 forceConnectionCloseEnabled = true; -
784 state = AllDoneState; -
785 }
never executed: }
0
786 break;
executed: break;
Execution Count:115
115
787 } -
788 -
789 -
790 qint64 haveRead = readReplyBodyRaw (socket, out, currentChunkSize - currentChunkRead); -
791 currentChunkRead += haveRead; -
792 bytes += haveRead; -
793 -
794 -
795 -
796 }
executed: }
Execution Count:136
136
797 return bytes;
executed: return bytes;
Execution Count:372
372
798} -
799 -
800qint64 QHttpNetworkReplyPrivate::getChunkSize(QAbstractSocket *socket, qint64 *chunkSize) -
801{ -
802 qint64 bytes = 0; -
803 char crlf[2]; -
804 *chunkSize = -1; -
805 -
806 int bytesAvailable = socket->bytesAvailable(); -
807 -
808 while (bytesAvailable > bytes) {
evaluated: bytesAvailable > bytes
TRUEFALSE
yes
Evaluation Count:555
yes
Evaluation Count:99
99-555
809 qint64 sniffedBytes = socket->peek(crlf, 2); -
810 int fragmentSize = fragment.size(); -
811 -
812 -
813 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
814 ||(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
815 { -
816 bytes += socket->read(crlf, 1); -
817 if (crlf[0] == '\r')
partially evaluated: crlf[0] == '\r'
TRUEFALSE
yes
Evaluation Count:238
no
Evaluation Count:0
0-238
818 bytes += socket->read(crlf, 1);
executed: bytes += socket->read(crlf, 1);
Execution Count:238
238
819 bool ok = false; -
820 -
821 fragment = fragment.mid(0, fragment.indexOf(';')).trimmed(); -
822 *chunkSize = fragment.toLong(&ok, 16); -
823 fragment.clear(); -
824 break;
executed: break;
Execution Count:238
238
825 } else { -
826 -
827 char c = 0; -
828 qint64 haveRead = socket->read(&c, 1); -
829 if (haveRead < 0) {
partially evaluated: haveRead < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:317
0-317
830 return -1;
never executed: return -1;
0
831 } -
832 bytes += haveRead; -
833 fragment.append(c); -
834 }
executed: }
Execution Count:317
317
835 } -
836 -
837 return bytes;
executed: return bytes;
Execution Count:337
337
838} -
839 -
840bool QHttpNetworkReplyPrivate::shouldEmitSignals() -
841{ -
842 -
843 -
844 return (statusCode != 401 && statusCode != 407);
executed: return (statusCode != 401 && statusCode != 407);
Execution Count:15307
15307
845} -
846 -
847bool QHttpNetworkReplyPrivate::expectContent() -
848{ -
849 -
850 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
851 || 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
852 return false;
executed: return false;
Execution Count:14
14
853 if (request.operation() == QHttpNetworkRequest::Head)
evaluated: request.operation() == QHttpNetworkRequest::Head
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:749
36-749
854 return false;
executed: return false;
Execution Count:36
36
855 qint64 expectedContentLength = contentLength(); -
856 if (expectedContentLength == 0)
evaluated: expectedContentLength == 0
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:725
24-725
857 return false;
executed: return false;
Execution Count:24
24
858 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
859 -
860 -
861 return false;
executed: return false;
Execution Count:1
1
862 } -
863 return true;
executed: return true;
Execution Count:724
724
864} -
865 -
866void QHttpNetworkReplyPrivate::eraseData() -
867{ -
868 compressedData.clear(); -
869 responseData.clear(); -
870}
executed: }
Execution Count:305
305
871 -
872 -
873 -
874 -
875 -
876QSslConfiguration QHttpNetworkReply::sslConfiguration() const -
877{ -
878 const QHttpNetworkReplyPrivate * const d = d_func(); -
879 -
880 if (!d->connectionChannel)
partially evaluated: !d->connectionChannel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-159
881 return QSslConfiguration();
never executed: return QSslConfiguration();
0
882 -
883 QSslSocket *sslSocket = qobject_cast<QSslSocket*>(d->connectionChannel->socket); -
884 if (!sslSocket)
partially evaluated: !sslSocket
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-159
885 return QSslConfiguration();
never executed: return QSslConfiguration();
0
886 -
887 return sslSocket->sslConfiguration();
executed: return sslSocket->sslConfiguration();
Execution Count:159
159
888} -
889 -
890void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config) -
891{ -
892 QHttpNetworkReplyPrivate * const d = d_func(); -
893 if (d->connection)
never evaluated: d->connection
0
894 d->connection->setSslConfiguration(config);
never executed: d->connection->setSslConfiguration(config);
0
895}
never executed: }
0
896 -
897void QHttpNetworkReply::ignoreSslErrors() -
898{ -
899 QHttpNetworkReplyPrivate * const d = d_func(); -
900 if (d->connection)
partially evaluated: d->connection
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
901 d->connection->ignoreSslErrors();
executed: d->connection->ignoreSslErrors();
Execution Count:21
21
902}
executed: }
Execution Count:21
21
903 -
904void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors) -
905{ -
906 QHttpNetworkReplyPrivate * const d = d_func(); -
907 if (d->connection)
partially evaluated: d->connection
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
908 d->connection->ignoreSslErrors(errors);
executed: d->connection->ignoreSslErrors(errors);
Execution Count:6
6
909}
executed: }
Execution Count:6
6
910 -
911 -
912 -
913 -
914 -
915 -
916 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial