access/qhttpnetworkconnection.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6; -
13 -
14 -
15const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3; -
16 -
17 -
18const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2; -
19 -
20 -
21QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt) -
22: state(RunningState), -
23 networkLayerState(Unknown), -
24 hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true), -
25 channelCount(defaultChannelCount) -
26 -
27 , networkProxy(QNetworkProxy::NoProxy) -
28 -
29{ -
30 channels = new QHttpNetworkConnectionChannel[channelCount]; -
31}
executed: }
Execution Count:507
507
32 -
33QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt) -
34: state(RunningState), networkLayerState(Unknown), -
35 hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true), -
36 channelCount(channelCount) -
37 -
38 , networkProxy(QNetworkProxy::NoProxy) -
39 -
40{ -
41 channels = new QHttpNetworkConnectionChannel[channelCount]; -
42}
never executed: }
0
43 -
44 -
45 -
46QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() -
47{ -
48 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:3042
yes
Evaluation Count:507
507-3042
49 if (channels[i].socket) {
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:531
yes
Evaluation Count:2511
531-2511
50 channels[i].socket->close(); -
51 delete channels[i].socket; -
52 }
executed: }
Execution Count:531
531
53 }
executed: }
Execution Count:3042
3042
54 delete []channels; -
55}
executed: }
Execution Count:507
507
56 -
57void QHttpNetworkConnectionPrivate::init() -
58{ -
59 QHttpNetworkConnection * const q = q_func(); -
60 for (int i = 0; i < channelCount; i++) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:3042
yes
Evaluation Count:507
507-3042
61 channels[i].setConnection(this->q_func()); -
62 channels[i].ssl = encrypt; -
63 -
64 -
65 channels[i].networkSession = networkSession; -
66 -
67 }
executed: }
Execution Count:3042
3042
68 -
69 delayedConnectionTimer.setSingleShot(true); -
70 QObject::connect(&delayedConnectionTimer, "2""timeout()", q, "1""_q_connectDelayedChannel()"); -
71}
executed: }
Execution Count:507
507
72 -
73void QHttpNetworkConnectionPrivate::pauseConnection() -
74{ -
75 state = PausedState; -
76 -
77 -
78 for (int i = 0; i < channelCount; i++) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:1380
yes
Evaluation Count:230
230-1380
79 if (channels[i].socket) {
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:253
yes
Evaluation Count:1127
253-1127
80 -
81 if (encrypt)
evaluated: encrypt
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:182
71-182
82 QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
executed: QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
Execution Count:71
71
83 else -
84 -
85 QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
executed: QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
Execution Count:182
182
86 } -
87 }
executed: }
Execution Count:1380
1380
88}
executed: }
Execution Count:230
230
89 -
90void QHttpNetworkConnectionPrivate::resumeConnection() -
91{ -
92 state = RunningState; -
93 -
94 for (int i = 0; i < channelCount; i++) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:1380
yes
Evaluation Count:230
230-1380
95 if (channels[i].socket) {
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:253
yes
Evaluation Count:1127
253-1127
96 -
97 if (encrypt)
evaluated: encrypt
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:182
71-182
98 QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
executed: QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
Execution Count:71
71
99 else -
100 -
101 QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);
executed: QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);
Execution Count:182
182
102 -
103 -
104 if (channels[i].state == QHttpNetworkConnectionChannel::WritingState)
partially evaluated: channels[i].state == QHttpNetworkConnectionChannel::WritingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:253
0-253
105 QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
never executed: QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
0
106 }
executed: }
Execution Count:253
253
107 }
executed: }
Execution Count:1380
1380
108 -
109 -
110 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); -
111}
executed: }
Execution Count:230
230
112 -
113int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const -
114{ -
115 for (int i = 0; i < channelCount; ++i)
partially evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:6476
no
Evaluation Count:0
0-6476
116 if (channels[i].socket == socket)
evaluated: channels[i].socket == socket
TRUEFALSE
yes
Evaluation Count:3157
yes
Evaluation Count:3319
3157-3319
117 return i;
executed: return i;
Execution Count:3157
3157
118 -
119 QMessageLogger("access/qhttpnetworkconnection.cpp", 178, __PRETTY_FUNCTION__).fatal("Called with unknown socket object."); -
120 return 0;
never executed: return 0;
0
121} -
122 -
123 -
124 -
125 -
126 -
127bool QHttpNetworkConnectionPrivate::shouldEmitChannelError(QAbstractSocket *socket) -
128{ -
129 QHttpNetworkConnection * const q = q_func(); -
130 -
131 bool emitError = true; -
132 int i = indexOf(socket); -
133 int otherSocket = (i == 0 ? 1 : 0);
partially evaluated: i == 0
TRUEFALSE
yes
Evaluation Count:47
no
Evaluation Count:0
0-47
134 -
135 -
136 if (delayedConnectionTimer.isActive()) {
partially evaluated: delayedConnectionTimer.isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
137 delayedConnectionTimer.stop(); -
138 channels[otherSocket].ensureConnection(); -
139 }
never executed: }
0
140 -
141 if (channelCount == 1) {
partially evaluated: channelCount == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
142 if (networkLayerState == QHttpNetworkConnectionPrivate::InProgress)
never evaluated: networkLayerState == QHttpNetworkConnectionPrivate::InProgress
0
143 networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
never executed: networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
0
144 channels[0].close(); -
145 emitError = true; -
146 } else {
never executed: }
0
147 if (networkLayerState == QHttpNetworkConnectionPrivate::InProgress) {
partially evaluated: networkLayerState == QHttpNetworkConnectionPrivate::InProgress
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
148 if (channels[otherSocket].isSocketBusy() && (channels[otherSocket].state != QHttpNetworkConnectionChannel::ClosingState)) {
never evaluated: channels[otherSocket].isSocketBusy()
never evaluated: (channels[otherSocket].state != QHttpNetworkConnectionChannel::ClosingState)
0
149 -
150 channels[i].close(); -
151 emitError = false; -
152 }
never executed: }
0
153 else { -
154 -
155 networkLayerState = QHttpNetworkConnectionPrivate::Unknown; -
156 channels[i].close(); -
157 emitError = true; -
158 }
never executed: }
0
159 } else { -
160 if (((networkLayerState == QHttpNetworkConnectionPrivate::IPv4) && (channels[i].networkLayerPreference != QAbstractSocket::IPv4Protocol))
partially evaluated: (networkLayerState == QHttpNetworkConnectionPrivate::IPv4)
TRUEFALSE
yes
Evaluation Count:47
no
Evaluation Count:0
partially evaluated: (channels[i].networkLayerPreference != QAbstractSocket::IPv4Protocol)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
161 || ((networkLayerState == QHttpNetworkConnectionPrivate::IPv6) && (channels[i].networkLayerPreference != QAbstractSocket::IPv6Protocol))) {
partially evaluated: (networkLayerState == QHttpNetworkConnectionPrivate::IPv6)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
never evaluated: (channels[i].networkLayerPreference != QAbstractSocket::IPv6Protocol)
0-47
162 -
163 channels[i].close(); -
164 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
165 emitError = false; -
166 }
never executed: }
0
167 if (networkLayerState == QHttpNetworkConnectionPrivate::Unknown)
partially evaluated: networkLayerState == QHttpNetworkConnectionPrivate::Unknown
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
168 QMessageLogger("access/qhttpnetworkconnection.cpp", 227, __PRETTY_FUNCTION__).warning() << "We got a connection error when networkLayerState is Unknown";
never executed: QMessageLogger("access/qhttpnetworkconnection.cpp", 227, __PRETTY_FUNCTION__).warning() << "We got a connection error when networkLayerState is Unknown";
0
169 }
executed: }
Execution Count:47
47
170 } -
171 return emitError;
executed: return emitError;
Execution Count:47
47
172} -
173 -
174 -
175qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const -
176{ -
177 return reply.d_func()->responseData.byteAmount();
never executed: return reply.d_func()->responseData.byteAmount();
0
178} -
179 -
180qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const -
181{ -
182 return reply.d_func()->responseData.sizeNextBlock();
never executed: return reply.d_func()->responseData.sizeNextBlock();
0
183} -
184 -
185void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) -
186{ -
187 QHttpNetworkRequest &request = messagePair.first; -
188 QHttpNetworkReply *reply = messagePair.second; -
189 -
190 -
191 QByteArray value; -
192 -
193 QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); -
194 if (uploadByteDevice) {
evaluated: uploadByteDevice
TRUEFALSE
yes
Evaluation Count:179
yes
Evaluation Count:509
179-509
195 if (request.contentLength() != -1 && uploadByteDevice->size() != -1) {
evaluated: request.contentLength() != -1
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:67
evaluated: uploadByteDevice->size() != -1
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:1
1-112
196 -
197 request.setContentLength(qMin(uploadByteDevice->size(), request.contentLength())); -
198 } else if (request.contentLength() == -1 && uploadByteDevice->size() != -1) {
executed: }
Execution Count:111
evaluated: request.contentLength() == -1
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1
partially evaluated: uploadByteDevice->size() != -1
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-111
199 -
200 request.setContentLength(uploadByteDevice->size()); -
201 } else if (request.contentLength() != -1 && uploadByteDevice->size() == -1) {
executed: }
Execution Count:67
partially evaluated: request.contentLength() != -1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: uploadByteDevice->size() == -1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-67
202 -
203 } else if (request.contentLength() == -1 && uploadByteDevice->size() == -1) {
executed: }
Execution Count:1
never evaluated: request.contentLength() == -1
never evaluated: uploadByteDevice->size() == -1
0-1
204 QMessageLogger("access/qhttpnetworkconnection.cpp", 263, __PRETTY_FUNCTION__).fatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given"); -
205 }
never executed: }
0
206 } -
207 -
208 -
209 if (networkProxy.type() == QNetworkProxy::HttpCachingProxy) {
evaluated: networkProxy.type() == QNetworkProxy::HttpCachingProxy
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:680
8-680
210 value = request.headerField("proxy-connection"); -
211 if (value.isEmpty())
partially evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
212 request.setHeaderField("Proxy-Connection", "Keep-Alive");
executed: request.setHeaderField("Proxy-Connection", "Keep-Alive");
Execution Count:8
8
213 } else {
executed: }
Execution Count:8
8
214 -
215 value = request.headerField("connection"); -
216 if (value.isEmpty())
partially evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:680
no
Evaluation Count:0
0-680
217 request.setHeaderField("Connection", "Keep-Alive");
executed: request.setHeaderField("Connection", "Keep-Alive");
Execution Count:680
680
218 -
219 }
executed: }
Execution Count:680
680
220 -
221 -
222 -
223 -
224 -
225 -
226 -
227 value = request.headerField("accept-encoding"); -
228 if (value.isEmpty()) {
partially evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:688
no
Evaluation Count:0
0-688
229 -
230 request.setHeaderField("Accept-Encoding", "gzip, deflate"); -
231 request.d->autoDecompress = true; -
232 -
233 -
234 -
235 -
236 }
executed: }
Execution Count:688
688
237 -
238 -
239 -
240 -
241 -
242 value = request.headerField("accept-language"); -
243 if (value.isEmpty()) {
partially evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:688
no
Evaluation Count:0
0-688
244 QString systemLocale = QLocale::system().name().replace(QChar::fromLatin1('_'),QChar::fromLatin1('-')); -
245 QString acceptLanguage; -
246 if (systemLocale == QLatin1String("C"))
partially evaluated: systemLocale == QLatin1String("C")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:688
0-688
247 acceptLanguage = QString::fromLatin1("en,*");
never executed: acceptLanguage = QString::fromLatin1("en,*");
0
248 else if (systemLocale.startsWith(QLatin1String("en-")))
partially evaluated: systemLocale.startsWith(QLatin1String("en-"))
TRUEFALSE
yes
Evaluation Count:688
no
Evaluation Count:0
0-688
249 acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);
executed: acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);
Execution Count:688
688
250 else -
251 acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale);
never executed: acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale);
0
252 request.setHeaderField("Accept-Language", acceptLanguage.toLatin1()); -
253 }
executed: }
Execution Count:688
688
254 -
255 -
256 value = request.headerField("user-agent"); -
257 if (value.isEmpty())
evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:684
yes
Evaluation Count:4
4-684
258 request.setHeaderField("User-Agent", "Mozilla/5.0");
executed: request.setHeaderField("User-Agent", "Mozilla/5.0");
Execution Count:684
684
259 -
260 value = request.headerField("host"); -
261 if (value.isEmpty()) {
evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:687
yes
Evaluation Count:1
1-687
262 QHostAddress add; -
263 QByteArray host; -
264 if (add.setAddress(hostName)) {
evaluated: add.setAddress(hostName)
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:657
30-657
265 if (add.protocol() == QAbstractSocket::IPv6Protocol)
evaluated: add.protocol() == QAbstractSocket::IPv6Protocol
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:29
1-29
266 host = "[" + hostName.toLatin1() + "]";
executed: host = "[" + hostName.toLatin1() + "]";
Execution Count:1
1
267 else -
268 host = hostName.toLatin1();
executed: host = hostName.toLatin1();
Execution Count:29
29
269 -
270 } else { -
271 host = QUrl::toAce(hostName); -
272 }
executed: }
Execution Count:657
657
273 -
274 int port = request.url().port(); -
275 if (port != -1) {
evaluated: port != -1
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:539
148-539
276 host += ':'; -
277 host += QByteArray::number(port); -
278 }
executed: }
Execution Count:148
148
279 -
280 request.setHeaderField("Host", host); -
281 }
executed: }
Execution Count:687
687
282 -
283 reply->d_func()->requestIsPrepared = true; -
284}
executed: }
Execution Count:688
688
285 -
286 -
287 -
288 -
289void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket, -
290 QHttpNetworkReply *reply, -
291 QNetworkReply::NetworkError errorCode) -
292{ -
293 QHttpNetworkConnection * const q = q_func(); -
294 -
295 int i = 0; -
296 if (socket)
evaluated: socket
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
297 i = indexOf(socket);
executed: i = indexOf(socket);
Execution Count:4
4
298 -
299 if (reply) {
partially evaluated: reply
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
300 -
301 reply->d_func()->errorString = errorDetail(errorCode, socket); -
302 reply->finishedWithError(errorCode, reply->d_func()->errorString); -
303 -
304 reply->d_func()->eraseData(); -
305 -
306 -
307 channels[i].close(); -
308 channels[i].reply = 0; -
309 channels[i].request = QHttpNetworkRequest(); -
310 if (socket)
evaluated: socket
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
311 channels[i].requeueCurrentlyPipelinedRequests();
executed: channels[i].requeueCurrentlyPipelinedRequests();
Execution Count:4
4
312 -
313 -
314 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
315 }
executed: }
Execution Count:5
5
316}
executed: }
Execution Count:5
5
317 -
318void QHttpNetworkConnectionPrivate::copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy) -
319{ -
320 qt_noop(); -
321 -
322 -
323 if (!isProxy && channels[fromChannel].authMethod == QAuthenticatorPrivate::Ntlm)
evaluated: !isProxy
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:59
partially evaluated: channels[fromChannel].authMethod == QAuthenticatorPrivate::Ntlm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:124
0-124
324 return;
never executed: return;
0
325 if (isProxy && channels[fromChannel].proxyAuthMethod == QAuthenticatorPrivate::Ntlm)
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:124
partially evaluated: channels[fromChannel].proxyAuthMethod == QAuthenticatorPrivate::Ntlm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:59
0-124
326 return;
never executed: return;
0
327 -
328 -
329 -
330 QAuthenticator* otherAuth = 0; -
331 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:1098
yes
Evaluation Count:183
183-1098
332 if (i == fromChannel)
evaluated: i == fromChannel
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:915
183-915
333 continue;
executed: continue;
Execution Count:183
183
334 if (isProxy)
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:295
yes
Evaluation Count:620
295-620
335 otherAuth = &channels[i].proxyAuthenticator;
executed: otherAuth = &channels[i].proxyAuthenticator;
Execution Count:295
295
336 else -
337 otherAuth = &channels[i].authenticator;
executed: otherAuth = &channels[i].authenticator;
Execution Count:620
620
338 -
339 if (otherAuth->user().compare(auth->user()))
evaluated: otherAuth->user().compare(auth->user())
TRUEFALSE
yes
Evaluation Count:700
yes
Evaluation Count:215
215-700
340 otherAuth->setUser(auth->user());
executed: otherAuth->setUser(auth->user());
Execution Count:700
700
341 if (otherAuth->password().compare(auth->password()))
evaluated: otherAuth->password().compare(auth->password())
TRUEFALSE
yes
Evaluation Count:710
yes
Evaluation Count:205
205-710
342 otherAuth->setPassword(auth->password());
executed: otherAuth->setPassword(auth->password());
Execution Count:710
710
343 }
executed: }
Execution Count:915
915
344}
executed: }
Execution Count:183
183
345 -
346 -
347 -
348bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, -
349 bool isProxy, bool &resend) -
350{ -
351 qt_noop(); -
352 qt_noop(); -
353 -
354 resend = false; -
355 -
356 QList<QPair<QByteArray, QByteArray> > fields = reply->header(); -
357 -
358 -
359 QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy); -
360 if (authMethod != QAuthenticatorPrivate::None) {
evaluated: authMethod != QAuthenticatorPrivate::None
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:3
3-332
361 int i = indexOf(socket); -
362 -
363 QAuthenticator* auth = 0; -
364 if (isProxy) {
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:275
57-275
365 auth = &channels[i].proxyAuthenticator; -
366 channels[i].proxyAuthMethod = authMethod; -
367 } else {
executed: }
Execution Count:57
57
368 auth = &channels[i].authenticator; -
369 channels[i].authMethod = authMethod; -
370 }
executed: }
Execution Count:275
275
371 -
372 if (auth->isNull())
partially evaluated: auth->isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:332
0-332
373 auth->detach();
never executed: auth->detach();
0
374 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth); -
375 priv->parseHttpResponse(fields, isProxy); -
376 -
377 if (priv->phase == QAuthenticatorPrivate::Done) {
evaluated: priv->phase == QAuthenticatorPrivate::Done
TRUEFALSE
yes
Evaluation Count:163
yes
Evaluation Count:169
163-169
378 pauseConnection(); -
379 if (!isProxy) {
evaluated: !isProxy
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:29
29-134
380 if (channels[i].authenticationCredentialsSent) {
evaluated: channels[i].authenticationCredentialsSent
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:88
46-88
381 auth->detach(); -
382 priv = QAuthenticatorPrivate::getPrivate(*auth); -
383 priv->hasFailed = true; -
384 priv->phase = QAuthenticatorPrivate::Done; -
385 channels[i].authenticationCredentialsSent = false; -
386 }
executed: }
Execution Count:46
46
387 reply->authenticationRequired(reply->request(), auth); -
388 -
389 } else {
executed: }
Execution Count:134
134
390 if (channels[i].proxyCredentialsSent) {
evaluated: channels[i].proxyCredentialsSent
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:27
2-27
391 auth->detach(); -
392 priv = QAuthenticatorPrivate::getPrivate(*auth); -
393 priv->hasFailed = true; -
394 priv->phase = QAuthenticatorPrivate::Done; -
395 channels[i].proxyCredentialsSent = false; -
396 }
executed: }
Execution Count:2
2
397 reply->proxyAuthenticationRequired(networkProxy, auth); -
398 -
399 }
executed: }
Execution Count:29
29
400 resumeConnection(); -
401 -
402 if (priv->phase != QAuthenticatorPrivate::Done) {
evaluated: priv->phase != QAuthenticatorPrivate::Done
TRUEFALSE
yes
Evaluation Count:132
yes
Evaluation Count:31
31-132
403 -
404 copyCredentials(i, auth, isProxy); -
405 }
executed: }
Execution Count:132
132
406 } else if (priv->phase == QAuthenticatorPrivate::Start) {
partially evaluated: priv->phase == QAuthenticatorPrivate::Start
TRUEFALSE
yes
Evaluation Count:169
no
Evaluation Count:0
executed: }
Execution Count:163
0-169
407 -
408 -
409 -
410 reply->cacheCredentials(reply->request(), auth); -
411 }
executed: }
Execution Count:169
169
412 -
413 -
414 -
415 -
416 if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
evaluated: priv->phase == QAuthenticatorPrivate::Done
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:301
partially evaluated: !reply->request().withCredentials()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:301
0-301
417 -
418 auth = 0; -
419 if (isProxy)
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:28
3-28
420 channels[i].proxyAuthenticator = QAuthenticator();
executed: channels[i].proxyAuthenticator = QAuthenticator();
Execution Count:3
3
421 else -
422 channels[i].authenticator = QAuthenticator();
executed: channels[i].authenticator = QAuthenticator();
Execution Count:28
28
423 -
424 -
425 channels[i].reply->headerChanged(); -
426 channels[i].reply->readyRead(); -
427 QNetworkReply::NetworkError errorCode = -
428 isProxy
evaluated: isProxy
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:28
3-28
429 ? QNetworkReply::ProxyAuthenticationRequiredError -
430 : QNetworkReply::AuthenticationRequiredError; -
431 reply->d_func()->errorString = errorDetail(errorCode, socket); -
432 reply->finishedWithError(errorCode, reply->d_func()->errorString); -
433 -
434 return true;
executed: return true;
Execution Count:31
31
435 } -
436 -
437 resend = true; -
438 return true;
executed: return true;
Execution Count:301
301
439 } -
440 return false;
executed: return false;
Execution Count:3
3
441} -
442 -
443void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request) -
444{ -
445 qt_noop(); -
446 -
447 int i = indexOf(socket); -
448 -
449 -
450 if (channels[i].authMethod != QAuthenticatorPrivate::None) {
evaluated: channels[i].authMethod != QAuthenticatorPrivate::None
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:691
157-691
451 if (!(channels[i].authMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 401)) {
partially evaluated: channels[i].authMethod == QAuthenticatorPrivate::Ntlm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:157
never evaluated: channels[i].lastStatus != 401
0-157
452 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator); -
453 if (priv && priv->method != QAuthenticatorPrivate::None) {
partially evaluated: priv
TRUEFALSE
yes
Evaluation Count:157
no
Evaluation Count:0
evaluated: priv->method != QAuthenticatorPrivate::None
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:16
0-157
454 QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false)); -
455 request.setHeaderField("Authorization", response); -
456 channels[i].authenticationCredentialsSent = true; -
457 }
executed: }
Execution Count:141
141
458 }
executed: }
Execution Count:157
157
459 }
executed: }
Execution Count:157
157
460 -
461 -
462 if (channels[i].proxyAuthMethod != QAuthenticatorPrivate::None) {
evaluated: channels[i].proxyAuthMethod != QAuthenticatorPrivate::None
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:805
43-805
463 if (!(channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 407)) {
partially evaluated: channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
never evaluated: channels[i].lastStatus != 407
0-43
464 QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].proxyAuthenticator); -
465 if (priv && priv->method != QAuthenticatorPrivate::None) {
partially evaluated: priv
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
evaluated: priv->method != QAuthenticatorPrivate::None
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:2
0-43
466 QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false)); -
467 request.setHeaderField("Proxy-Authorization", response); -
468 channels[i].proxyCredentialsSent = true; -
469 }
executed: }
Execution Count:41
41
470 }
executed: }
Execution Count:43
43
471 }
executed: }
Execution Count:43
43
472}
executed: }
Execution Count:848
848
473 -
474QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetworkRequest &request) -
475{ -
476 QHttpNetworkConnection * const q = q_func(); -
477 -
478 -
479 QHttpNetworkReply *reply = new QHttpNetworkReply(request.url()); -
480 reply->setRequest(request); -
481 reply->d_func()->connection = q; -
482 reply->d_func()->connectionChannel = &channels[0]; -
483 HttpMessagePair pair = qMakePair(request, reply); -
484 -
485 switch (request.priority()) { -
486 case QHttpNetworkRequest::HighPriority: -
487 highPriorityQueue.prepend(pair); -
488 break;
never executed: break;
0
489 case QHttpNetworkRequest::NormalPriority: -
490 case QHttpNetworkRequest::LowPriority: -
491 lowPriorityQueue.prepend(pair); -
492 break;
executed: break;
Execution Count:694
694
493 } -
494 -
495 -
496 -
497 -
498 -
499 if (networkLayerState == Unknown) {
evaluated: networkLayerState == Unknown
TRUEFALSE
yes
Evaluation Count:507
yes
Evaluation Count:187
187-507
500 startHostInfoLookup(); -
501 } else if ( networkLayerState == IPv4 || networkLayerState == IPv6 ) {
partially evaluated: networkLayerState == IPv4
TRUEFALSE
yes
Evaluation Count:187
no
Evaluation Count:0
never evaluated: networkLayerState == IPv6
executed: }
Execution Count:507
0-507
502 _q_startNextRequest(); -
503 }
executed: }
Execution Count:187
187
504 return reply;
executed: return reply;
Execution Count:694
694
505} -
506 -
507void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) -
508{ -
509 QHttpNetworkConnection * const q = q_func(); -
510 -
511 QHttpNetworkRequest request = pair.first; -
512 switch (request.priority()) { -
513 case QHttpNetworkRequest::HighPriority: -
514 highPriorityQueue.prepend(pair); -
515 break;
never executed: break;
0
516 case QHttpNetworkRequest::NormalPriority: -
517 case QHttpNetworkRequest::LowPriority: -
518 lowPriorityQueue.prepend(pair); -
519 break;
never executed: break;
0
520 } -
521 -
522 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
523}
never executed: }
0
524 -
525bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket) -
526{ -
527 int i = 0; -
528 if (socket)
evaluated: socket
TRUEFALSE
yes
Evaluation Count:711
yes
Evaluation Count:1
1-711
529 i = indexOf(socket);
executed: i = indexOf(socket);
Execution Count:711
711
530 -
531 if (!highPriorityQueue.isEmpty()) {
partially evaluated: !highPriorityQueue.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:712
0-712
532 -
533 HttpMessagePair messagePair = highPriorityQueue.takeLast(); -
534 if (!messagePair.second->d_func()->requestIsPrepared)
never evaluated: !messagePair.second->d_func()->requestIsPrepared
0
535 prepareRequest(messagePair);
never executed: prepareRequest(messagePair);
0
536 channels[i].request = messagePair.first; -
537 channels[i].reply = messagePair.second; -
538 return true;
never executed: return true;
0
539 } -
540 -
541 if (!lowPriorityQueue.isEmpty()) {
evaluated: !lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:678
yes
Evaluation Count:34
34-678
542 -
543 HttpMessagePair messagePair = lowPriorityQueue.takeLast(); -
544 if (!messagePair.second->d_func()->requestIsPrepared)
partially evaluated: !messagePair.second->d_func()->requestIsPrepared
TRUEFALSE
yes
Evaluation Count:678
no
Evaluation Count:0
0-678
545 prepareRequest(messagePair);
executed: prepareRequest(messagePair);
Execution Count:678
678
546 channels[i].request = messagePair.first; -
547 channels[i].reply = messagePair.second; -
548 return true;
executed: return true;
Execution Count:678
678
549 } -
550 return false;
executed: return false;
Execution Count:34
34
551} -
552 -
553QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest() -
554{ -
555 if (!highPriorityQueue.isEmpty())
partially evaluated: !highPriorityQueue.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
556 return highPriorityQueue.last().first;
never executed: return highPriorityQueue.last().first;
0
557 if (!lowPriorityQueue.isEmpty())
partially evaluated: !lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
558 return lowPriorityQueue.last().first;
executed: return lowPriorityQueue.last().first;
Execution Count:15
15
559 return QHttpNetworkRequest();
never executed: return QHttpNetworkRequest();
0
560} -
561 -
562 -
563void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket) -
564{ -
565 -
566 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
partially evaluated: highPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:1175
no
Evaluation Count:0
evaluated: lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1164
0-1175
567 return;
executed: return;
Execution Count:11
11
568 -
569 int i = indexOf(socket); -
570 -
571 -
572 if (channels[i].reply == 0)
partially evaluated: channels[i].reply == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1164
0-1164
573 return;
never executed: return;
0
574 -
575 if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)) {
evaluated: ! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1150
14-1150
576 return;
executed: return;
Execution Count:14
14
577 } -
578 -
579 if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported)
evaluated: channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported
TRUEFALSE
yes
Evaluation Count:355
yes
Evaluation Count:795
355-795
580 return;
executed: return;
Execution Count:355
355
581 -
582 -
583 if (!channels[i].request.isPipeliningAllowed())
evaluated: !channels[i].request.isPipeliningAllowed()
TRUEFALSE
yes
Evaluation Count:791
yes
Evaluation Count:4
4-791
584 return;
executed: return;
Execution Count:791
791
585 -
586 -
587 if (channels[i].request.operation() != QHttpNetworkRequest::Get)
partially evaluated: channels[i].request.operation() != QHttpNetworkRequest::Get
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
588 return;
never executed: return;
0
589 -
590 -
591 if (socket->state() != QAbstractSocket::ConnectedState)
partially evaluated: socket->state() != QAbstractSocket::ConnectedState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
592 return;
never executed: return;
0
593 -
594 -
595 if (channels[i].resendCurrent)
partially evaluated: channels[i].resendCurrent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
596 return;
never executed: return;
0
597 -
598 -
599 -
600 if (!channels[i].authenticator.isNull()
partially evaluated: !channels[i].authenticator.isNull()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
601 && (!channels[i].authenticator.user().isEmpty()
partially evaluated: !channels[i].authenticator.user().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
602 || !channels[i].authenticator.password().isEmpty()))
partially evaluated: !channels[i].authenticator.password().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
603 return;
never executed: return;
0
604 if (!channels[i].proxyAuthenticator.isNull()
partially evaluated: !channels[i].proxyAuthenticator.isNull()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
605 && (!channels[i].proxyAuthenticator.user().isEmpty()
partially evaluated: !channels[i].proxyAuthenticator.user().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
606 || !channels[i].proxyAuthenticator.password().isEmpty()))
partially evaluated: !channels[i].proxyAuthenticator.password().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
607 return;
never executed: return;
0
608 -
609 -
610 if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState
partially evaluated: channels[i].state == QHttpNetworkConnectionChannel::WaitingState
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
611 || channels[i].state == QHttpNetworkConnectionChannel::ReadingState))
never evaluated: channels[i].state == QHttpNetworkConnectionChannel::ReadingState
0
612 return;
never executed: return;
0
613 -
614 int lengthBefore; -
615 while (!highPriorityQueue.isEmpty()) {
partially evaluated: !highPriorityQueue.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
616 lengthBefore = channels[i].alreadyPipelinedRequests.length(); -
617 fillPipeline(highPriorityQueue, channels[i]); -
618 -
619 if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
never evaluated: channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength
0
620 channels[i].pipelineFlush(); -
621 return;
never executed: return;
0
622 } -
623 -
624 if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
never evaluated: lengthBefore == channels[i].alreadyPipelinedRequests.length()
0
625 break;
never executed: break;
0
626 }
never executed: }
0
627 -
628 while (!lowPriorityQueue.isEmpty()) {
evaluated: !lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
1-10
629 lengthBefore = channels[i].alreadyPipelinedRequests.length(); -
630 fillPipeline(lowPriorityQueue, channels[i]); -
631 -
632 if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) {
evaluated: channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
633 channels[i].pipelineFlush(); -
634 return;
executed: return;
Execution Count:3
3
635 } -
636 -
637 if (lengthBefore == channels[i].alreadyPipelinedRequests.length())
partially evaluated: lengthBefore == channels[i].alreadyPipelinedRequests.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
638 break;
never executed: break;
0
639 }
executed: }
Execution Count:7
7
640 -
641 -
642 channels[i].pipelineFlush(); -
643}
executed: }
Execution Count:1
1
644 -
645 -
646bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue, QHttpNetworkConnectionChannel &channel) -
647{ -
648 if (queue.isEmpty())
partially evaluated: queue.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
649 return true;
never executed: return true;
0
650 -
651 for (int i = queue.count() - 1; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
652 HttpMessagePair messagePair = queue.at(i); -
653 const QHttpNetworkRequest &request = messagePair.first; -
654 -
655 -
656 if (!request.url().userInfo().isEmpty())
partially evaluated: !request.url().userInfo().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
657 continue;
never executed: continue;
0
658 -
659 -
660 if (request.operation() != QHttpNetworkRequest::Get)
partially evaluated: request.operation() != QHttpNetworkRequest::Get
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
661 continue;
never executed: continue;
0
662 -
663 if (!request.isPipeliningAllowed())
partially evaluated: !request.isPipeliningAllowed()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
664 continue;
never executed: continue;
0
665 -
666 -
667 queue.takeAt(i); -
668 -
669 -
670 -
671 -
672 if (!messagePair.second->d_func()->requestIsPrepared)
partially evaluated: !messagePair.second->d_func()->requestIsPrepared
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
673 prepareRequest(messagePair);
executed: prepareRequest(messagePair);
Execution Count:10
10
674 channel.pipelineInto(messagePair); -
675 -
676 -
677 return false;
executed: return false;
Execution Count:10
10
678 } -
679 -
680 -
681 return true;
never executed: return true;
0
682} -
683 -
684 -
685QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail) -
686{ -
687 QString errorString; -
688 switch (errorCode) { -
689 case QNetworkReply::HostNotFoundError: -
690 if (socket)
evaluated: socket
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
691 errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
executed: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
Execution Count:2
2
692 else -
693 errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);
executed: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);
Execution Count:1
1
694 break;
executed: break;
Execution Count:3
3
695 case QNetworkReply::ConnectionRefusedError: -
696 errorString = QCoreApplication::translate("QHttp", "Connection refused"); -
697 break;
never executed: break;
0
698 case QNetworkReply::RemoteHostClosedError: -
699 errorString = QCoreApplication::translate("QHttp", "Connection closed"); -
700 break;
executed: break;
Execution Count:50
50
701 case QNetworkReply::TimeoutError: -
702 errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out"); -
703 break;
never executed: break;
0
704 case QNetworkReply::ProxyAuthenticationRequiredError: -
705 errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication"); -
706 break;
executed: break;
Execution Count:8
8
707 case QNetworkReply::AuthenticationRequiredError: -
708 errorString = QCoreApplication::translate("QHttp", "Host requires authentication"); -
709 break;
executed: break;
Execution Count:30
30
710 case QNetworkReply::ProtocolFailure: -
711 errorString = QCoreApplication::translate("QHttp", "Data corrupted"); -
712 break;
executed: break;
Execution Count:1
1
713 case QNetworkReply::ProtocolUnknownError: -
714 errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified"); -
715 break;
never executed: break;
0
716 case QNetworkReply::SslHandshakeFailedError: -
717 errorString = QCoreApplication::translate("QHttp", "SSL handshake failed"); -
718 break;
executed: break;
Execution Count:10
10
719 default: -
720 -
721 errorString = extraDetail; -
722 break;
executed: break;
Execution Count:3
3
723 } -
724 return errorString;
executed: return errorString;
Execution Count:105
105
725} -
726 -
727 -
728 -
729void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) -
730{ -
731 QHttpNetworkConnection * const q = q_func(); -
732 -
733 -
734 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:3578
yes
Evaluation Count:589
589-3578
735 -
736 if (channels[i].reply == reply) {
evaluated: channels[i].reply == reply
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:3549
29-3549
737 channels[i].reply = 0; -
738 channels[i].request = QHttpNetworkRequest(); -
739 channels[i].resendCurrent = false; -
740 -
741 if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) {
partially evaluated: !reply->isFinished()
TRUEFALSE
yes
Evaluation Count:29
no
Evaluation Count:0
partially evaluated: !channels[i].alreadyPipelinedRequests.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
742 -
743 -
744 channels[i].requeueCurrentlyPipelinedRequests(); -
745 }
never executed: }
0
746 -
747 -
748 -
749 -
750 if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished())
evaluated: reply->d_func()->isConnectionCloseEnabled()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:1
partially evaluated: !reply->isFinished()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-28
751 channels[i].close();
executed: channels[i].close();
Execution Count:29
29
752 -
753 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
754 return;
executed: return;
Execution Count:29
29
755 } -
756 -
757 -
758 for (int j = 0; j < channels[i].alreadyPipelinedRequests.length(); j++) {
evaluated: j < channels[i].alreadyPipelinedRequests.length()
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:3549
106-3549
759 if (channels[i].alreadyPipelinedRequests.at(j).second == reply) {
partially evaluated: channels[i].alreadyPipelinedRequests.at(j).second == reply
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:106
0-106
760 -
761 channels[i].alreadyPipelinedRequests.removeAt(j); -
762 -
763 channels[i].requeueCurrentlyPipelinedRequests(); -
764 -
765 -
766 -
767 -
768 -
769 if (channels[i].reply)
never evaluated: channels[i].reply
0
770 channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
never executed: channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
0
771 -
772 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
773 return;
never executed: return;
0
774 } -
775 }
executed: }
Execution Count:106
106
776 }
executed: }
Execution Count:3549
3549
777 -
778 if (!highPriorityQueue.isEmpty()) {
partially evaluated: !highPriorityQueue.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:589
0-589
779 for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
never evaluated: j >= 0
0
780 HttpMessagePair messagePair = highPriorityQueue.at(j); -
781 if (messagePair.second == reply) {
never evaluated: messagePair.second == reply
0
782 highPriorityQueue.removeAt(j); -
783 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
784 return;
never executed: return;
0
785 } -
786 }
never executed: }
0
787 }
never executed: }
0
788 -
789 if (!lowPriorityQueue.isEmpty()) {
evaluated: !lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:526
63-526
790 for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:1014
yes
Evaluation Count:57
57-1014
791 HttpMessagePair messagePair = lowPriorityQueue.at(j); -
792 if (messagePair.second == reply) {
evaluated: messagePair.second == reply
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1008
6-1008
793 lowPriorityQueue.removeAt(j); -
794 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); -
795 return;
executed: return;
Execution Count:6
6
796 } -
797 }
executed: }
Execution Count:1008
1008
798 }
executed: }
Execution Count:57
57
799}
executed: }
Execution Count:583
583
800 -
801 -
802 -
803 -
804 -
805 -
806void QHttpNetworkConnectionPrivate::_q_startNextRequest() -
807{ -
808 -
809 if (networkLayerState == Unknown || networkLayerState == InProgress)
evaluated: networkLayerState == Unknown
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3142
partially evaluated: networkLayerState == InProgress
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3142
0-3142
810 return;
executed: return;
Execution Count:1
1
811 -
812 -
813 if (state == PausedState)
partially evaluated: state == PausedState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3142
0-3142
814 return;
never executed: return;
0
815 -
816 -
817 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:18852
yes
Evaluation Count:3142
3142-18852
818 if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) {
evaluated: channels[i].resendCurrent
TRUEFALSE
yes
Evaluation Count:318
yes
Evaluation Count:18534
evaluated: (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:125
125-18534
819 channels[i].resendCurrent = false; -
820 channels[i].state = QHttpNetworkConnectionChannel::IdleState; -
821 -
822 -
823 if (!channels[i].resetUploadData())
partially evaluated: !channels[i].resetUploadData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
824 continue;
never executed: continue;
0
825 channels[i].sendRequest(); -
826 }
executed: }
Execution Count:193
193
827 }
executed: }
Execution Count:18852
18852
828 -
829 -
830 -
831 -
832 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
partially evaluated: highPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:3142
no
Evaluation Count:0
evaluated: lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:2318
yes
Evaluation Count:824
0-3142
833 return;
executed: return;
Execution Count:2318
2318
834 -
835 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:4944
yes
Evaluation Count:824
824-4944
836 if (channels[i].socket) {
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:1323
yes
Evaluation Count:3621
1323-3621
837 if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
evaluated: !channels[i].reply
TRUEFALSE
yes
Evaluation Count:207
yes
Evaluation Count:1116
evaluated: !channels[i].isSocketBusy()
TRUEFALSE
yes
Evaluation Count:161
yes
Evaluation Count:46
evaluated: channels[i].socket->state() == QAbstractSocket::ConnectedState
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:31
31-1116
838 if (dequeueRequest(channels[i].socket))
evaluated: dequeueRequest(channels[i].socket)
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:9
9-121
839 channels[i].sendRequest();
executed: channels[i].sendRequest();
Execution Count:121
121
840 }
executed: }
Execution Count:130
130
841 }
executed: }
Execution Count:1323
1323
842 }
executed: }
Execution Count:4944
4944
843 if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
partially evaluated: highPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:824
no
Evaluation Count:0
evaluated: lowPriorityQueue.isEmpty()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:761
0-824
844 return;
executed: return;
Execution Count:63
63
845 for (int i = 0; i < channelCount; i++)
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:4566
yes
Evaluation Count:761
761-4566
846 if (channels[i].socket && channels[i].socket->state() == QAbstractSocket::ConnectedState)
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:1246
yes
Evaluation Count:3320
evaluated: channels[i].socket->state() == QAbstractSocket::ConnectedState
TRUEFALSE
yes
Evaluation Count:1165
yes
Evaluation Count:81
81-3320
847 fillPipeline(channels[i].socket);
executed: fillPipeline(channels[i].socket);
Execution Count:1165
1165
848 -
849 -
850 -
851 -
852 int queuedRequest = highPriorityQueue.count() + lowPriorityQueue.count(); -
853 for (int i = 0; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:1771
yes
Evaluation Count:191
191-1771
854 bool connectChannel = false; -
855 if (channels[i].socket) {
evaluated: channels[i].socket
TRUEFALSE
yes
Evaluation Count:1241
yes
Evaluation Count:530
530-1241
856 if ((channels[i].socket->state() == QAbstractSocket::ConnectingState) || (channels[i].socket->state() == QAbstractSocket::HostLookupState))
evaluated: (channels[i].socket->state() == QAbstractSocket::ConnectingState)
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:1191
partially evaluated: (channels[i].socket->state() == QAbstractSocket::HostLookupState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1191
0-1191
857 queuedRequest--;
executed: queuedRequest--;
Execution Count:50
50
858 if ( queuedRequest <=0 )
evaluated: queuedRequest <=0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1232
9-1232
859 break;
executed: break;
Execution Count:9
9
860 if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState))
evaluated: !channels[i].reply
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:1163
evaluated: !channels[i].isSocketBusy()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:38
partially evaluated: (channels[i].socket->state() == QAbstractSocket::UnconnectedState)
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
0-1163
861 connectChannel = true;
executed: connectChannel = true;
Execution Count:31
31
862 } else {
executed: }
Execution Count:1232
1232
863 connectChannel = true; -
864 }
executed: }
Execution Count:530
530
865 -
866 if (connectChannel) {
evaluated: connectChannel
TRUEFALSE
yes
Evaluation Count:561
yes
Evaluation Count:1201
561-1201
867 if (networkLayerState == IPv4)
evaluated: networkLayerState == IPv4
TRUEFALSE
yes
Evaluation Count:560
yes
Evaluation Count:1
1-560
868 channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;
executed: channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;
Execution Count:560
560
869 else if (networkLayerState == IPv6)
partially evaluated: networkLayerState == IPv6
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
870 channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol;
executed: channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol;
Execution Count:1
1
871 channels[i].ensureConnection(); -
872 queuedRequest--; -
873 }
executed: }
Execution Count:561
561
874 -
875 if ( queuedRequest <=0 )
evaluated: queuedRequest <=0
TRUEFALSE
yes
Evaluation Count:561
yes
Evaluation Count:1201
561-1201
876 break;
executed: break;
Execution Count:561
561
877 }
executed: }
Execution Count:1201
1201
878}
executed: }
Execution Count:761
761
879 -
880 -
881void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply) -
882{ -
883 for (int i = 0 ; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:1223
yes
Evaluation Count:11
11-1223
884 if (channels[i].reply == reply) {
evaluated: channels[i].reply == reply
TRUEFALSE
yes
Evaluation Count:1157
yes
Evaluation Count:66
66-1157
885 -
886 QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection); -
887 return;
executed: return;
Execution Count:1157
1157
888 } -
889 }
executed: }
Execution Count:66
66
890}
executed: }
Execution Count:11
11
891 -
892 -
893 -
894 -
895 -
896 -
897 -
898void QHttpNetworkConnectionPrivate::startHostInfoLookup() -
899{ -
900 networkLayerState = InProgress; -
901 -
902 -
903 QString lookupHost = hostName; -
904 -
905 if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
evaluated: networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:461
46-461
906 lookupHost = networkProxy.hostName(); -
907 } else if (channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
executed: }
Execution Count:46
evaluated: channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapability
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:412
46-412
908 lookupHost = channels[0].proxy.hostName(); -
909 }
executed: }
Execution Count:49
49
910 -
911 QHostAddress temp; -
912 if (temp.setAddress(lookupHost)) {
evaluated: temp.setAddress(lookupHost)
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:408
99-408
913 if (temp.protocol() == QAbstractSocket::IPv4Protocol) {
evaluated: temp.protocol() == QAbstractSocket::IPv4Protocol
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:1
1-98
914 networkLayerState = QHttpNetworkConnectionPrivate::IPv4; -
915 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); -
916 return;
executed: return;
Execution Count:98
98
917 } else if (temp.protocol() == QAbstractSocket::IPv6Protocol) {
partially evaluated: temp.protocol() == QAbstractSocket::IPv6Protocol
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
918 networkLayerState = QHttpNetworkConnectionPrivate::IPv6; -
919 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); -
920 return;
executed: return;
Execution Count:1
1
921 } -
922 } else { -
923 int hostLookupId; -
924 bool immediateResultValid = false; -
925 QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost, -
926 this->q_func(), -
927 "1""_q_hostLookupFinished(QHostInfo)", -
928 &immediateResultValid, -
929 &hostLookupId); -
930 if (immediateResultValid) {
evaluated: immediateResultValid
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:9
9-399
931 _q_hostLookupFinished(hostInfo); -
932 }
executed: }
Execution Count:399
399
933 }
executed: }
Execution Count:408
408
934} -
935 -
936 -
937void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(QHostInfo info) -
938{ -
939 bool bIpv4 = false; -
940 bool bIpv6 = false; -
941 bool foundAddress = false; -
942 -
943 for (QForeachContainer<__typeof__(info.addresses())> _container_(info.addresses()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QHostAddress &address = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
944 if (address.protocol() == QAbstractSocket::IPv4Protocol) {
evaluated: address.protocol() == QAbstractSocket::IPv4Protocol
TRUEFALSE
yes
Evaluation Count:407
yes
Evaluation Count:1
1-407
945 if (!foundAddress) {
partially evaluated: !foundAddress
TRUEFALSE
yes
Evaluation Count:407
no
Evaluation Count:0
0-407
946 foundAddress = true; -
947 delayIpv4 = false; -
948 }
executed: }
Execution Count:407
407
949 bIpv4 = true; -
950 } else if (address.protocol() == QAbstractSocket::IPv6Protocol) {
executed: }
Execution Count:407
partially evaluated: address.protocol() == QAbstractSocket::IPv6Protocol
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-407
951 if (!foundAddress) {
partially evaluated: !foundAddress
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
952 foundAddress = true; -
953 delayIpv4 = true; -
954 }
never executed: }
0
955 bIpv6 = true; -
956 }
executed: }
Execution Count:1
1
957 } -
958 -
959 if (bIpv4 && bIpv6)
evaluated: bIpv4
TRUEFALSE
yes
Evaluation Count:407
yes
Evaluation Count:1
evaluated: bIpv6
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:406
1-407
960 startNetworkLayerStateLookup();
executed: startNetworkLayerStateLookup();
Execution Count:1
1
961 else if (bIpv4) {
evaluated: bIpv4
TRUEFALSE
yes
Evaluation Count:406
yes
Evaluation Count:1
1-406
962 networkLayerState = QHttpNetworkConnectionPrivate::IPv4; -
963 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); -
964 } else if (bIpv6) {
executed: }
Execution Count:406
partially evaluated: bIpv6
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-406
965 networkLayerState = QHttpNetworkConnectionPrivate::IPv6; -
966 QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); -
967 } else {
never executed: }
0
968 if (dequeueRequest(channels[0].socket)) {
partially evaluated: dequeueRequest(channels[0].socket)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
969 emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError); -
970 networkLayerState = QHttpNetworkConnectionPrivate::Unknown; -
971 } else {
executed: }
Execution Count:1
1
972 -
973 QMessageLogger("access/qhttpnetworkconnection.cpp", 1049, __PRETTY_FUNCTION__).warning() << "QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not dequeu request"; -
974 networkLayerState = QHttpNetworkConnectionPrivate::Unknown; -
975 }
never executed: }
0
976 } -
977} -
978 -
979 -
980 -
981 -
982 -
983 -
984void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup() -
985{ -
986 if (channelCount > 1) {
partially evaluated: channelCount > 1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
987 -
988 qt_noop(); -
989 qt_noop(); -
990 -
991 networkLayerState = InProgress; -
992 -
993 channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol; -
994 channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol; -
995 -
996 int timeout = 300; -
997 -
998 if (networkSession) {
partially evaluated: networkSession
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
999 if (networkSession->configuration().bearerType() == QNetworkConfiguration::Bearer2G)
never evaluated: networkSession->configuration().bearerType() == QNetworkConfiguration::Bearer2G
0
1000 timeout = 800;
never executed: timeout = 800;
0
1001 else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerCDMA2000)
never evaluated: networkSession->configuration().bearerType() == QNetworkConfiguration::BearerCDMA2000
0
1002 timeout = 500;
never executed: timeout = 500;
0
1003 else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerWCDMA)
never evaluated: networkSession->configuration().bearerType() == QNetworkConfiguration::BearerWCDMA
0
1004 timeout = 500;
never executed: timeout = 500;
0
1005 else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerHSPA)
never evaluated: networkSession->configuration().bearerType() == QNetworkConfiguration::BearerHSPA
0
1006 timeout = 400;
never executed: timeout = 400;
0
1007 } -
1008 -
1009 delayedConnectionTimer.start(timeout); -
1010 if (delayIpv4)
partially evaluated: delayIpv4
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1011 channels[1].ensureConnection();
never executed: channels[1].ensureConnection();
0
1012 else -
1013 channels[0].ensureConnection();
executed: channels[0].ensureConnection();
Execution Count:1
1
1014 } else { -
1015 networkLayerState = InProgress; -
1016 channels[0].networkLayerPreference = QAbstractSocket::AnyIPProtocol; -
1017 channels[0].ensureConnection(); -
1018 }
never executed: }
0
1019} -
1020 -
1021void QHttpNetworkConnectionPrivate::networkLayerDetected(QAbstractSocket::NetworkLayerProtocol protocol) -
1022{ -
1023 for (int i = 0 ; i < channelCount; ++i) {
evaluated: i < channelCount
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
1024 if ((channels[i].networkLayerPreference != protocol) && (channels[i].state == QHttpNetworkConnectionChannel::ConnectingState)) {
evaluated: (channels[i].networkLayerPreference != protocol)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
partially evaluated: (channels[i].state == QHttpNetworkConnectionChannel::ConnectingState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1025 channels[i].close(); -
1026 }
never executed: }
0
1027 }
executed: }
Execution Count:6
6
1028}
executed: }
Execution Count:1
1
1029 -
1030void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel() -
1031{ -
1032 if (delayIpv4)
never evaluated: delayIpv4
0
1033 channels[0].ensureConnection();
never executed: channels[0].ensureConnection();
0
1034 else -
1035 channels[1].ensureConnection();
never executed: channels[1].ensureConnection();
0
1036} -
1037 -
1038 -
1039QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent, QSharedPointer<QNetworkSession> networkSession) -
1040 : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent) -
1041{ -
1042 QHttpNetworkConnectionPrivate * const d = d_func(); -
1043 d->networkSession = networkSession; -
1044 d->init(); -
1045}
executed: }
Execution Count:507
507
1046 -
1047QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, QObject *parent, QSharedPointer<QNetworkSession> networkSession) -
1048 : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt)), parent) -
1049{ -
1050 QHttpNetworkConnectionPrivate * const d = d_func(); -
1051 d->networkSession = networkSession; -
1052 d->init(); -
1053}
never executed: }
0
1054QHttpNetworkConnection::~QHttpNetworkConnection() -
1055{ -
1056} -
1057 -
1058QString QHttpNetworkConnection::hostName() const -
1059{ -
1060 const QHttpNetworkConnectionPrivate * const d = d_func(); -
1061 return d->hostName;
never executed: return d->hostName;
0
1062} -
1063 -
1064quint16 QHttpNetworkConnection::port() const -
1065{ -
1066 const QHttpNetworkConnectionPrivate * const d = d_func(); -
1067 return d->port;
never executed: return d->port;
0
1068} -
1069 -
1070QHttpNetworkReply* QHttpNetworkConnection::sendRequest(const QHttpNetworkRequest &request) -
1071{ -
1072 QHttpNetworkConnectionPrivate * const d = d_func(); -
1073 return d->queueRequest(request);
executed: return d->queueRequest(request);
Execution Count:694
694
1074} -
1075 -
1076bool QHttpNetworkConnection::isSsl() const -
1077{ -
1078 const QHttpNetworkConnectionPrivate * const d = d_func(); -
1079 return d->encrypt;
never executed: return d->encrypt;
0
1080} -
1081 -
1082QHttpNetworkConnectionChannel *QHttpNetworkConnection::channels() const -
1083{ -
1084 return d_func()->channels;
never executed: return d_func()->channels;
0
1085} -
1086 -
1087 -
1088void QHttpNetworkConnection::setCacheProxy(const QNetworkProxy &networkProxy) -
1089{ -
1090 QHttpNetworkConnectionPrivate * const d = d_func(); -
1091 d->networkProxy = networkProxy; -
1092 -
1093 if (!d->networkProxy.user().isEmpty()) {
partially evaluated: !d->networkProxy.user().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:507
0-507
1094 for (int i = 0; i < d->channelCount; ++i) {
never evaluated: i < d->channelCount
0
1095 d->channels[i].proxyAuthenticator.setUser(d->networkProxy.user()); -
1096 d->channels[i].proxyAuthenticator.setPassword(d->networkProxy.password()); -
1097 }
never executed: }
0
1098 }
never executed: }
0
1099}
executed: }
Execution Count:507
507
1100 -
1101QNetworkProxy QHttpNetworkConnection::cacheProxy() const -
1102{ -
1103 const QHttpNetworkConnectionPrivate * const d = d_func(); -
1104 return d->networkProxy;
executed: return d->networkProxy;
Execution Count:467
467
1105} -
1106 -
1107void QHttpNetworkConnection::setTransparentProxy(const QNetworkProxy &networkProxy) -
1108{ -
1109 QHttpNetworkConnectionPrivate * const d = d_func(); -
1110 for (int i = 0; i < d->channelCount; ++i)
evaluated: i < d->channelCount
TRUEFALSE
yes
Evaluation Count:3042
yes
Evaluation Count:507
507-3042
1111 d->channels[i].setProxy(networkProxy);
executed: d->channels[i].setProxy(networkProxy);
Execution Count:3042
3042
1112}
executed: }
Execution Count:507
507
1113 -
1114QNetworkProxy QHttpNetworkConnection::transparentProxy() const -
1115{ -
1116 const QHttpNetworkConnectionPrivate * const d = d_func(); -
1117 return d->channels[0].proxy;
executed: return d->channels[0].proxy;
Execution Count:467
467
1118} -
1119 -
1120 -
1121 -
1122 -
1123 -
1124void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config) -
1125{ -
1126 QHttpNetworkConnectionPrivate * const d = d_func(); -
1127 if (!d->encrypt)
partially evaluated: !d->encrypt
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-43
1128 return;
never executed: return;
0
1129 -
1130 -
1131 for (int i = 0; i < d->channelCount; ++i)
evaluated: i < d->channelCount
TRUEFALSE
yes
Evaluation Count:258
yes
Evaluation Count:43
43-258
1132 d->channels[i].setSslConfiguration(config);
executed: d->channels[i].setSslConfiguration(config);
Execution Count:258
258
1133}
executed: }
Execution Count:43
43
1134 -
1135void QHttpNetworkConnection::ignoreSslErrors(int channel) -
1136{ -
1137 QHttpNetworkConnectionPrivate * const d = d_func(); -
1138 if (!d->encrypt)
partially evaluated: !d->encrypt
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1139 return;
never executed: return;
0
1140 -
1141 if (channel == -1) {
partially evaluated: channel == -1
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1142 for (int i = 0; i < d->channelCount; ++i) {
evaluated: i < d->channelCount
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:21
21-126
1143 d->channels[i].ignoreSslErrors(); -
1144 }
executed: }
Execution Count:126
126
1145 -
1146 } else {
executed: }
Execution Count:21
21
1147 d->channels[channel].ignoreSslErrors(); -
1148 }
never executed: }
0
1149} -
1150 -
1151void QHttpNetworkConnection::ignoreSslErrors(const QList<QSslError> &errors, int channel) -
1152{ -
1153 QHttpNetworkConnectionPrivate * const d = d_func(); -
1154 if (!d->encrypt)
partially evaluated: !d->encrypt
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1155 return;
never executed: return;
0
1156 -
1157 if (channel == -1) {
partially evaluated: channel == -1
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1158 for (int i = 0; i < d->channelCount; ++i) {
evaluated: i < d->channelCount
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:6
6-36
1159 d->channels[i].ignoreSslErrors(errors); -
1160 }
executed: }
Execution Count:36
36
1161 -
1162 } else {
executed: }
Execution Count:6
6
1163 d->channels[channel].ignoreSslErrors(errors); -
1164 }
never executed: }
0
1165} -
1166 -
1167 -
1168 -
1169 -
1170 -
1171 -
1172 -
1173void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth) -
1174{ -
1175 -
1176 -
1177 pauseConnection(); -
1178 chan->reply->proxyAuthenticationRequired(proxy, auth); -
1179 resumeConnection(); -
1180 int i = indexOf(chan->socket); -
1181 copyCredentials(i, auth, true); -
1182}
executed: }
Execution Count:33
33
1183 -
1184 -
1185 -
1186 -
1187 -
1188 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial