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:682
682
17 -
18QHttpNetworkReply::~QHttpNetworkReply() -
19{ -
20 QHttpNetworkReplyPrivate * const d = d_func(); -
21 if (d->connection) {
evaluated: d->connection
TRUEFALSE
yes
Evaluation Count:593
yes
Evaluation Count:81
81-593
22 d->connection->d_func()->removeReply(this); -
23 }
executed: }
Execution Count:593
593
24 -
25 -
26 if (d->autoDecompress && d->isCompressed() && d->inflateStrm)
evaluated: d->autoDecompress
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:643
evaluated: d->isCompressed()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:24
partially evaluated: d->inflateStrm
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-643
27 inflateEnd(d->inflateStrm);
executed: inflateEnd(d->inflateStrm);
Execution Count:7
7
28 -
29}
executed: }
Execution Count:674
674
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:1282
1282
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:944
944
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:649
649
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:655
655
85 -
86int QHttpNetworkReply::statusCode() const -
87{ -
88 return d_func()->statusCode;
executed: return d_func()->statusCode;
Execution Count:2085
2085
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:607
607
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:18025
18025
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:5938
0-5938
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:1044
yes
Evaluation Count:4894
evaluated: d->responseData.bufferCount() == 1
TRUEFALSE
yes
Evaluation Count:1020
yes
Evaluation Count:24
24-4894
155 d->connection->d_func()->readMoreLater(this);
executed: d->connection->d_func()->readMoreLater(this);
Execution Count:1020
1020
156 return d->responseData.read();
executed: return d->responseData.read();
Execution Count:5938
5938
157} -
158 -
159QByteArray QHttpNetworkReply::readAll() -
160{ -
161 QHttpNetworkReplyPrivate * const d = d_func(); -
162 return d->responseData.readAll();
executed: return d->responseData.readAll();
Execution Count:49
49
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:304
304
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:2386
2386
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:866
866
195} -
196 -
197void QHttpNetworkReply::setUserProvidedDownloadBuffer(char* b) -
198{ -
199 QHttpNetworkReplyPrivate * const d = d_func(); -
200 if (supportsUserProvidedDownloadBuffer())
partially evaluated: supportsUserProvidedDownloadBuffer()
TRUEFALSE
yes
Evaluation Count:327
no
Evaluation Count:0
0-327
201 d->userProvidedDownloadBuffer = b;
executed: d->userProvidedDownloadBuffer = b;
Execution Count:327
327
202}
executed: }
Execution Count:327
327
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:31
31
213} -
214 -
215bool QHttpNetworkReply::isPipeliningUsed() const -
216{ -
217 return d_func()->pipeliningUsed;
executed: return d_func()->pipeliningUsed;
Execution Count:599
599
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:682
682
246 -
247QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate() -
248{ -
249 -
250 if (inflateStrm)
evaluated: inflateStrm
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:667
7-667
251 delete inflateStrm;
executed: delete inflateStrm;
Execution Count:7
7
252 -
253}
executed: }
Execution Count:674
674
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:871
never evaluated: inflateStrm
0-871
268 inflateEnd(inflateStrm);
never executed: inflateEnd(inflateStrm);
0
269 -
270 fields.clear(); -
271}
executed: }
Execution Count:871
871
272 -
273 -
274void QHttpNetworkReplyPrivate::clear() -
275{ -
276 connection = 0; -
277 connectionChannel = 0; -
278 autoDecompress = false; -
279 clearHttpLayerInformation(); -
280}
executed: }
Execution Count:864
864
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:1538
1538
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:34
yes
Evaluation Count:2
2-34
302 if (qstricmp(name.constData(), it->first.constData()) == 0) {
evaluated: qstricmp(name.constData(), it->first.constData()) == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:29
5-29
303 fields.erase(it); -
304 break;
executed: break;
Execution Count:5
5
305 } -
306 ++it; -
307 }
executed: }
Execution Count:29
29
308 -
309}
executed: }
Execution Count:7
7
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:840
yes
Evaluation Count:41
41-840
352 -
353 fragment.reserve(32); -
354 }
executed: }
Execution Count:840
840
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:18385
18-18385
363 return -1;
executed: return -1;
Execution Count:18
18
364 else if (haveRead == 0)
evaluated: haveRead == 0
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:18343
42-18343
365 break;
executed: break;
Execution Count:42
42
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:18343
no
Evaluation Count:0
evaluated: fragment.size() == 0
TRUEFALSE
yes
Evaluation Count:854
yes
Evaluation Count:17489
partially evaluated: c == 11
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:854
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:839
evaluated: c == '\r'
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:824
partially evaluated: c == ' '
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:824
partially evaluated: c == 31
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:824
0-18343
367 continue;
executed: continue;
Execution Count:30
30
368 -
369 bytes++; -
370 -
371 -
372 if (c == '\n') {
evaluated: c == '\n'
TRUEFALSE
yes
Evaluation Count:802
yes
Evaluation Count:17511
802-17511
373 -
374 if (fragment.endsWith('\r')) {
evaluated: fragment.endsWith('\r')
TRUEFALSE
yes
Evaluation Count:794
yes
Evaluation Count:8
8-794
375 fragment.truncate(fragment.length()-1); -
376 }
executed: }
Execution Count:794
794
377 bool ok = parseStatus(fragment); -
378 state = ReadingHeaderState; -
379 fragment.clear(); -
380 if (!ok) {
evaluated: !ok
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:787
15-787
381 return -1;
executed: return -1;
Execution Count:15
15
382 } -
383 break;
executed: break;
Execution Count:787
787
384 } else { -
385 fragment.append(c); -
386 }
executed: }
Execution Count:17511
17511
387 -
388 -
389 if (fragment.length() >= 5 && !fragment.startsWith("HTTP/"))
evaluated: fragment.length() >= 5
TRUEFALSE
yes
Evaluation Count:14215
yes
Evaluation Count:3296
evaluated: !fragment.startsWith("HTTP/")
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:14196
19-14215
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:17522
no
Evaluation Count:0
executed: }
Execution Count:17492
0-17522
395 -
396 return bytes;
executed: return bytes;
Execution Count:829
829
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:796
6-796
413 || !status.startsWith(httpMagic)
partially evaluated: !status.startsWith(httpMagic)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:796
0-796
414 || status.at(dotPos) != '.'
evaluated: status.at(dotPos) != '.'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:793
3-793
415 || status.at(spacePos) != ' ') {
partially evaluated: status.at(spacePos) != ' '
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:793
0-793
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:793
793
433} -
434 -
435qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) -
436{ -
437 if (fragment.isEmpty()) {
evaluated: fragment.isEmpty()
TRUEFALSE
yes
Evaluation Count:788
yes
Evaluation Count:70
70-788
438 -
439 -
440 -
441 fragment.reserve(512); -
442 }
executed: }
Execution Count:788
788
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:173293
71-173293
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:173288
5-173288
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:6043
yes
Evaluation Count:167245
6043-167245
461 -
462 -
463 -
464 if (fragment.endsWith("\r\n\r\n")
evaluated: fragment.endsWith("\r\n\r\n")
TRUEFALSE
yes
Evaluation Count:753
yes
Evaluation Count:5290
753-5290
465 || fragment.endsWith("\r\n\n")
partially evaluated: fragment.endsWith("\r\n\n")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5290
0-5290
466 || fragment.endsWith("\n\n"))
evaluated: fragment.endsWith("\n\n")
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5287
3-5287
467 allHeaders = true;
executed: allHeaders = true;
Execution Count:756
756
468 -
469 -
470 if ((fragment.length() == 2 && fragment.endsWith("\r\n"))
evaluated: fragment.length() == 2
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:6022
partially evaluated: fragment.endsWith("\r\n")
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-6022
471 || (fragment.length() == 1 && fragment.endsWith("\n")))
evaluated: fragment.length() == 1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6017
partially evaluated: fragment.endsWith("\n")
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-6017
472 allHeaders = true;
executed: allHeaders = true;
Execution Count:26
26
473 }
executed: }
Execution Count:6043
6043
474 }
executed: }
Execution Count:173288
173288
475 } while (!allHeaders && haveRead > 0);
evaluated: !allHeaders
TRUEFALSE
yes
Evaluation Count:172506
yes
Evaluation Count:782
partially evaluated: haveRead > 0
TRUEFALSE
yes
Evaluation Count:172506
no
Evaluation Count:0
0-172506
476 -
477 -
478 if (allHeaders) {
evaluated: allHeaders
TRUEFALSE
yes
Evaluation Count:782
yes
Evaluation Count:71
71-782
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:775
7-775
491 headerField("proxy-connection").toLower().contains("close")) ||
evaluated: headerField("proxy-connection").toLower().contains("close")
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:708
67-708
492 (majorVersion == 1 && minorVersion == 0 &&
partially evaluated: majorVersion == 1
TRUEFALSE
yes
Evaluation Count:708
no
Evaluation Count:0
evaluated: minorVersion == 0
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:552
0-708
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:750
yes
Evaluation Count:32
evaluated: isCompressed()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:743
7-750
497 -
498 if (!inflateStrm)
partially evaluated: !inflateStrm
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
499 inflateStrm = new z_stream;
executed: inflateStrm = new z_stream;
Execution Count:7
7
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:7
0-7
510 return -1;
never executed: return -1;
0
511 }
executed: }
Execution Count:7
7
512 -
513 -
514 }
executed: }
Execution Count:782
782
515 return bytes;
executed: return bytes;
Execution Count:853
853
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:6043
no
Evaluation Count:0
0-6043
526 int j = colon.indexIn(header, i); -
527 if (j == -1)
evaluated: j == -1
TRUEFALSE
yes
Evaluation Count:782
yes
Evaluation Count:5261
782-5261
528 break;
executed: break;
Execution Count:782
782
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:5261
0-5261
536 break;
never executed: break;
0
537 if (!value.isEmpty())
partially evaluated: !value.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5261
0-5261
538 value += ' ';
never executed: value += ' ';
0
539 -
540 bool hasCR = (i && header[i-1] == '\r');
partially evaluated: i
TRUEFALSE
yes
Evaluation Count:5261
no
Evaluation Count:0
evaluated: header[i-1] == '\r'
TRUEFALSE
yes
Evaluation Count:5256
yes
Evaluation Count:5
0-5261
541 int length = i -(hasCR ? 1: 0) - j;
evaluated: hasCR
TRUEFALSE
yes
Evaluation Count:5256
yes
Evaluation Count:5
5-5256
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:5261
no
Evaluation Count:0
partially evaluated: header.at(i) == ' '
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5261
partially evaluated: header.at(i) == '\t'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5261
executed: }
Execution Count:5261
0-5261
545 if (i == -1)
partially evaluated: i == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5261
0-5261
546 break;
never executed: break;
0
547 -
548 fields.append(qMakePair(field, value)); -
549 }
executed: }
Execution Count:5261
5261
550}
executed: }
Execution Count:782
782
551 -
552bool QHttpNetworkReplyPrivate::isChunked() -
553{ -
554 return chunkedTransferEncoding;
executed: return chunkedTransferEncoding;
Execution Count:12510
12510
555} -
556 -
557bool QHttpNetworkReplyPrivate::isConnectionCloseEnabled() -
558{ -
559 return connectionCloseEnabled || forceConnectionCloseEnabled;
executed: return connectionCloseEnabled || forceConnectionCloseEnabled;
Execution Count:1568
1568
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:5938
2-5938
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:308
yes
Evaluation Count:5630
308-5630
575 state = AllDoneState; -
576 }
executed: }
Execution Count:308
308
577 -
578 return haveRead;
executed: return haveRead;
Execution Count:5938
5938
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:1812
yes
Evaluation Count:9156
1812-9156
588 toBeRead = qMin(toBeRead, readBufferMaxSize);
executed: toBeRead = qMin(toBeRead, readBufferMaxSize);
Execution Count:1812
1812
589 -
590 if (!toBeRead)
evaluated: !toBeRead
TRUEFALSE
yes
Evaluation Count:4941
yes
Evaluation Count:6027
4941-6027
591 return 0;
executed: return 0;
Execution Count:4941
4941
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:6027
0-6027
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:244
yes
Evaluation Count:5783
244-5783
605 state = AllDoneState; -
606 }
executed: }
Execution Count:244
244
607 -
608 contentRead += haveRead; -
609 return haveRead;
executed: return haveRead;
Execution Count:6027
6027
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:26
yes
Evaluation Count:307
26-307
620 -
621 -
622 -
623 -
624 -
625 if (isChunked()) {
evaluated: isChunked()
TRUEFALSE
yes
Evaluation Count:299
yes
Evaluation Count:34
34-299
626 -
627 bytes += readReplyBodyChunked(socket, tempOutDataBuffer); -
628 } else if (bodyLength > 0) {
executed: }
Execution Count:299
evaluated: bodyLength > 0
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:14
14-299
629 -
630 bytes += readReplyBodyRaw(socket, tempOutDataBuffer, bodyLength - contentRead); -
631 if (contentRead + bytes == bodyLength)
evaluated: contentRead + bytes == bodyLength
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:16
4-16
632 state = AllDoneState;
executed: state = AllDoneState;
Execution Count:4
4
633 } else {
executed: }
Execution Count:20
20
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:26
yes
Evaluation Count:307
26-307
641 qint64 uncompressRet = uncompressBodyData(tempOutDataBuffer, out); -
642 delete tempOutDataBuffer; -
643 if (uncompressRet < 0)
evaluated: uncompressRet < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:25
1-25
644 return -1;
executed: return -1;
Execution Count:1
1
645 }
executed: }
Execution Count:25
25
646 -
647 -
648 contentRead += bytes; -
649 return bytes;
executed: return bytes;
Execution Count:332
332
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:26
0-26
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:24
yes
Evaluation Count:21
21-24
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:76
evaluated: !triedRawDeflate
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-76
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:76
partially evaluated: ret == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:76
0-76
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:4
yes
Evaluation Count:72
4-72
697 return out->byteAmount();
executed: return out->byteAmount();
Execution Count:4
4
698 } while (inflateStrm->avail_in > 0);
executed: }
Execution Count:72
evaluated: inflateStrm->avail_in > 0
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:19
19-72
699 }
executed: }
Execution Count:19
19
700 -
701 return out->byteAmount();
executed: return out->byteAmount();
Execution Count:21
21
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:138
10-138
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:132
yes
Evaluation Count:148
132-148
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:132
0-132
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:132
132
734 return bytes;
executed: return bytes;
Execution Count:148
148
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:316
yes
Evaluation Count:97
97-316
742 -
743 if (readBufferMaxSize && (bytes > readBufferMaxSize))
evaluated: readBufferMaxSize
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:303
evaluated: (bytes > readBufferMaxSize)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-303
744 break;
executed: break;
Execution Count:2
2
745 -
746 if (!lastChunkRead && currentChunkRead >= currentChunkSize) {
partially evaluated: !lastChunkRead
TRUEFALSE
yes
Evaluation Count:314
no
Evaluation Count:0
evaluated: currentChunkRead >= currentChunkSize
TRUEFALSE
yes
Evaluation Count:312
yes
Evaluation Count:2
0-314
747 -
748 currentChunkSize = 0; -
749 currentChunkRead = 0; -
750 if (bytes) {
evaluated: bytes
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:202
110-202
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:95
yes
Evaluation Count:216
95-216
766 break;
executed: break;
Execution Count:95
95
767 }
executed: }
Execution Count:216
216
768 -
769 if (currentChunkSize == 0 || lastChunkRead) {
evaluated: currentChunkSize == 0
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:114
partially evaluated: lastChunkRead
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
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:104
no
Evaluation Count:0
0-104
775 bytes += haveRead;
executed: bytes += haveRead;
Execution Count:104
104
776 -
777 if ((haveRead == 2 && crlf[0] == '\r' && crlf[1] == '\n') || (haveRead == 1 && crlf[0] == '\n'))
partially evaluated: haveRead == 2
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
partially evaluated: crlf[0] == '\r'
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
partially evaluated: crlf[1] == '\n'
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
never evaluated: haveRead == 1
never evaluated: crlf[0] == '\n'
0-104
778 state = AllDoneState;
executed: state = AllDoneState;
Execution Count:104
104
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:104
104
787 } -
788 -
789 -
790 qint64 haveRead = readReplyBodyRaw (socket, out, currentChunkSize - currentChunkRead); -
791 currentChunkRead += haveRead; -
792 bytes += haveRead; -
793 -
794 -
795 -
796 }
executed: }
Execution Count:114
114
797 return bytes;
executed: return bytes;
Execution Count:298
298
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:476
yes
Evaluation Count:95
95-476
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:260
yes
Evaluation Count:216
partially evaluated: sniffedBytes == 2
TRUEFALSE
yes
Evaluation Count:260
no
Evaluation Count:0
evaluated: crlf[0] == '\r'
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:44
partially evaluated: crlf[1] == '\n'
TRUEFALSE
yes
Evaluation Count:216
no
Evaluation Count:0
0-260
814 ||(fragmentSize > 1 && fragment.endsWith('\r') && crlf[0] == '\n'))
evaluated: fragmentSize > 1
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:238
partially evaluated: fragment.endsWith('\r')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
never evaluated: crlf[0] == '\n'
0-238
815 { -
816 bytes += socket->read(crlf, 1); -
817 if (crlf[0] == '\r')
partially evaluated: crlf[0] == '\r'
TRUEFALSE
yes
Evaluation Count:216
no
Evaluation Count:0
0-216
818 bytes += socket->read(crlf, 1);
executed: bytes += socket->read(crlf, 1);
Execution Count:216
216
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:216
216
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:260
0-260
830 return -1;
never executed: return -1;
0
831 } -
832 bytes += haveRead; -
833 fragment.append(c); -
834 }
executed: }
Execution Count:260
260
835 } -
836 -
837 return bytes;
executed: return bytes;
Execution Count:311
311
838} -
839 -
840bool QHttpNetworkReplyPrivate::shouldEmitSignals() -
841{ -
842 -
843 -
844 return (statusCode != 401 && statusCode != 407);
executed: return (statusCode != 401 && statusCode != 407);
Execution Count:14898
14898
845} -
846 -
847bool QHttpNetworkReplyPrivate::expectContent() -
848{ -
849 -
850 if ((statusCode >= 100 && statusCode < 200)
partially evaluated: statusCode >= 100
TRUEFALSE
yes
Evaluation Count:761
no
Evaluation Count:0
partially evaluated: statusCode < 200
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:761
0-761
851 || statusCode == 204 || statusCode == 304)
evaluated: statusCode == 204
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:758
evaluated: statusCode == 304
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:747
3-758
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:711
36-711
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:687
24-687
857 return false;
executed: return false;
Execution Count:24
24
858 if (expectedContentLength == -1 && bodyLength == 0) {
evaluated: expectedContentLength == -1
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:557
evaluated: bodyLength == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:129
1-557
859 -
860 -
861 return false;
executed: return false;
Execution Count:1
1
862 } -
863 return true;
executed: return true;
Execution Count:686
686
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:109
0-109
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:109
0-109
885 return QSslConfiguration();
never executed: return QSslConfiguration();
0
886 -
887 return sslSocket->sslConfiguration();
executed: return sslSocket->sslConfiguration();
Execution Count:109
109
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