Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtNetwork module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | //#define QHTTPTHREADDELEGATE_DEBUG | - |
43 | #include "qhttpthreaddelegate_p.h" | - |
44 | | - |
45 | #include <QThread> | - |
46 | #include <QTimer> | - |
47 | #include <QAuthenticator> | - |
48 | #include <QEventLoop> | - |
49 | | - |
50 | #include "private/qhttpnetworkreply_p.h" | - |
51 | #include "private/qnetworkaccesscache_p.h" | - |
52 | #include "private/qnoncontiguousbytedevice_p.h" | - |
53 | | - |
54 | #ifndef QT_NO_HTTP | - |
55 | | - |
56 | QT_BEGIN_NAMESPACE | - |
57 | | - |
58 | static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url) | - |
59 | { | - |
60 | QNetworkReply::NetworkError code; executed (the execution status of this line is deduced): QNetworkReply::NetworkError code; | - |
61 | // we've got an error | - |
62 | switch (httpStatusCode) { | - |
63 | case 401: // Authorization required | - |
64 | code = QNetworkReply::AuthenticationRequiredError; never executed (the execution status of this line is deduced): code = QNetworkReply::AuthenticationRequiredError; | - |
65 | break; | 0 |
66 | | - |
67 | case 403: // Access denied | - |
68 | code = QNetworkReply::ContentOperationNotPermittedError; executed (the execution status of this line is deduced): code = QNetworkReply::ContentOperationNotPermittedError; | - |
69 | break; executed: break; Execution Count:1 | 1 |
70 | | - |
71 | case 404: // Not Found | - |
72 | code = QNetworkReply::ContentNotFoundError; executed (the execution status of this line is deduced): code = QNetworkReply::ContentNotFoundError; | - |
73 | break; executed: break; Execution Count:4 | 4 |
74 | | - |
75 | case 405: // Method Not Allowed | - |
76 | code = QNetworkReply::ContentOperationNotPermittedError; executed (the execution status of this line is deduced): code = QNetworkReply::ContentOperationNotPermittedError; | - |
77 | break; executed: break; Execution Count:1 | 1 |
78 | | - |
79 | case 407: | - |
80 | code = QNetworkReply::ProxyAuthenticationRequiredError; never executed (the execution status of this line is deduced): code = QNetworkReply::ProxyAuthenticationRequiredError; | - |
81 | break; | 0 |
82 | | - |
83 | case 418: // I'm a teapot | - |
84 | code = QNetworkReply::ProtocolInvalidOperationError; never executed (the execution status of this line is deduced): code = QNetworkReply::ProtocolInvalidOperationError; | - |
85 | break; | 0 |
86 | | - |
87 | | - |
88 | default: | - |
89 | if (httpStatusCode > 500) { evaluated: httpStatusCode > 500 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
90 | // some kind of server error | - |
91 | code = QNetworkReply::ProtocolUnknownError; executed (the execution status of this line is deduced): code = QNetworkReply::ProtocolUnknownError; | - |
92 | } else if (httpStatusCode >= 400) { executed: } Execution Count:1 partially evaluated: httpStatusCode >= 400 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
93 | // content error we did not handle above | - |
94 | code = QNetworkReply::UnknownContentError; executed (the execution status of this line is deduced): code = QNetworkReply::UnknownContentError; | - |
95 | } else { executed: } Execution Count:1 | 1 |
96 | qWarning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"", never executed (the execution status of this line is deduced): QMessageLogger("access/qhttpthreaddelegate.cpp", 96, __PRETTY_FUNCTION__).warning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"", | - |
97 | httpStatusCode, qPrintable(url.toString())); never executed (the execution status of this line is deduced): httpStatusCode, QString(url.toString()).toLocal8Bit().constData()); | - |
98 | code = QNetworkReply::ProtocolFailure; never executed (the execution status of this line is deduced): code = QNetworkReply::ProtocolFailure; | - |
99 | } | 0 |
100 | } | - |
101 | | - |
102 | return code; executed: return code; Execution Count:8 | 8 |
103 | } | - |
104 | | - |
105 | | - |
106 | static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy) | - |
107 | { | - |
108 | QString result; executed (the execution status of this line is deduced): QString result; | - |
109 | QUrl copy = url; executed (the execution status of this line is deduced): QUrl copy = url; | - |
110 | bool isEncrypted = copy.scheme().toLower() == QLatin1String("https"); executed (the execution status of this line is deduced): bool isEncrypted = copy.scheme().toLower() == QLatin1String("https"); | - |
111 | copy.setPort(copy.port(isEncrypted ? 443 : 80)); executed (the execution status of this line is deduced): copy.setPort(copy.port(isEncrypted ? 443 : 80)); | - |
112 | result = copy.toString(QUrl::RemoveUserInfo | QUrl::RemovePath | executed (the execution status of this line is deduced): result = copy.toString(QUrl::RemoveUserInfo | QUrl::RemovePath | | - |
113 | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::FullyEncoded); executed (the execution status of this line is deduced): QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::FullyEncoded); | - |
114 | | - |
115 | #ifndef QT_NO_NETWORKPROXY | - |
116 | if (proxy && proxy->type() != QNetworkProxy::NoProxy) { evaluated: proxy yes Evaluation Count:122 | yes Evaluation Count:572 |
partially evaluated: proxy->type() != QNetworkProxy::NoProxy yes Evaluation Count:122 | no Evaluation Count:0 |
| 0-572 |
117 | QUrl key; executed (the execution status of this line is deduced): QUrl key; | - |
118 | | - |
119 | switch (proxy->type()) { | - |
120 | case QNetworkProxy::Socks5Proxy: | - |
121 | key.setScheme(QLatin1String("proxy-socks5")); executed (the execution status of this line is deduced): key.setScheme(QLatin1String("proxy-socks5")); | - |
122 | break; executed: break; Execution Count:50 | 50 |
123 | | - |
124 | case QNetworkProxy::HttpProxy: | - |
125 | case QNetworkProxy::HttpCachingProxy: | - |
126 | key.setScheme(QLatin1String("proxy-http")); executed (the execution status of this line is deduced): key.setScheme(QLatin1String("proxy-http")); | - |
127 | break; executed: break; Execution Count:72 | 72 |
128 | | - |
129 | default: | - |
130 | break; | 0 |
131 | } | - |
132 | | - |
133 | if (!key.scheme().isEmpty()) { partially evaluated: !key.scheme().isEmpty() yes Evaluation Count:122 | no Evaluation Count:0 |
| 0-122 |
134 | key.setUserName(proxy->user()); executed (the execution status of this line is deduced): key.setUserName(proxy->user()); | - |
135 | key.setHost(proxy->hostName()); executed (the execution status of this line is deduced): key.setHost(proxy->hostName()); | - |
136 | key.setPort(proxy->port()); executed (the execution status of this line is deduced): key.setPort(proxy->port()); | - |
137 | key.setQuery(result); executed (the execution status of this line is deduced): key.setQuery(result); | - |
138 | result = key.toString(QUrl::FullyEncoded); executed (the execution status of this line is deduced): result = key.toString(QUrl::FullyEncoded); | - |
139 | } executed: } Execution Count:122 | 122 |
140 | } executed: } Execution Count:122 | 122 |
141 | #else | - |
142 | Q_UNUSED(proxy) | - |
143 | #endif | - |
144 | | - |
145 | return "http-connection:" + result.toLatin1(); executed: return "http-connection:" + result.toLatin1(); Execution Count:694 | 694 |
146 | } | - |
147 | | - |
148 | class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection, | - |
149 | public QNetworkAccessCache::CacheableObject | - |
150 | { | - |
151 | // Q_OBJECT | - |
152 | public: | - |
153 | #ifdef QT_NO_BEARERMANAGEMENT | - |
154 | QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt) | - |
155 | : QHttpNetworkConnection(hostName, port, encrypt) | - |
156 | #else | - |
157 | QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QSharedPointer<QNetworkSession> networkSession) | - |
158 | : QHttpNetworkConnection(hostName, port, encrypt, /*parent=*/0, networkSession) | - |
159 | #endif | - |
160 | { | - |
161 | setExpires(true); executed (the execution status of this line is deduced): setExpires(true); | - |
162 | setShareable(true); executed (the execution status of this line is deduced): setShareable(true); | - |
163 | } executed: } Execution Count:507 | 507 |
164 | | - |
165 | virtual void dispose() | - |
166 | { | - |
167 | #if 0 // sample code; do this right with the API | - |
168 | Q_ASSERT(!isWorking()); | - |
169 | #endif | - |
170 | delete this; executed (the execution status of this line is deduced): delete this; | - |
171 | } executed: } Execution Count:507 | 507 |
172 | }; | - |
173 | | - |
174 | | - |
175 | QThreadStorage<QNetworkAccessCache *> QHttpThreadDelegate::connections; | - |
176 | | - |
177 | | - |
178 | QHttpThreadDelegate::~QHttpThreadDelegate() | - |
179 | { | - |
180 | // It could be that the main thread has asked us to shut down, so we need to delete the HTTP reply | - |
181 | if (httpReply) { evaluated: httpReply yes Evaluation Count:13 | yes Evaluation Count:682 |
| 13-682 |
182 | delete httpReply; executed (the execution status of this line is deduced): delete httpReply; | - |
183 | } executed: } Execution Count:13 | 13 |
184 | | - |
185 | // Get the object cache that stores our QHttpNetworkConnection objects | - |
186 | // and release the entry for this QHttpNetworkConnection | - |
187 | if (connections.hasLocalData() && !cacheKey.isEmpty()) { evaluated: connections.hasLocalData() yes Evaluation Count:619 | yes Evaluation Count:76 |
evaluated: !cacheKey.isEmpty() yes Evaluation Count:618 | yes Evaluation Count:1 |
| 1-619 |
188 | connections.localData()->releaseEntry(cacheKey); executed (the execution status of this line is deduced): connections.localData()->releaseEntry(cacheKey); | - |
189 | } executed: } Execution Count:618 | 618 |
190 | } executed: } Execution Count:695 | 695 |
191 | | - |
192 | | - |
193 | QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) : | - |
194 | QObject(parent) | - |
195 | , ssl(false) | - |
196 | , downloadBufferMaximumSize(0) | - |
197 | , readBufferMaxSize(0) | - |
198 | , bytesEmitted(0) | - |
199 | , pendingDownloadData(0) | - |
200 | , pendingDownloadProgress(0) | - |
201 | , synchronous(false) | - |
202 | , incomingStatusCode(0) | - |
203 | , isPipeliningUsed(false) | - |
204 | , incomingContentLength(-1) | - |
205 | , incomingErrorCode(QNetworkReply::NoError) | - |
206 | , downloadBuffer(0) | - |
207 | , httpConnection(0) | - |
208 | , httpReply(0) | - |
209 | , synchronousRequestLoop(0) | - |
210 | { | - |
211 | } executed: } Execution Count:695 | 695 |
212 | | - |
213 | // This is invoked as BlockingQueuedConnection from QNetworkAccessHttpBackend in the user thread | - |
214 | void QHttpThreadDelegate::startRequestSynchronously() | - |
215 | { | - |
216 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
217 | qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId(); | - |
218 | #endif | - |
219 | synchronous = true; executed (the execution status of this line is deduced): synchronous = true; | - |
220 | | - |
221 | QEventLoop synchronousRequestLoop; executed (the execution status of this line is deduced): QEventLoop synchronousRequestLoop; | - |
222 | this->synchronousRequestLoop = &synchronousRequestLoop; executed (the execution status of this line is deduced): this->synchronousRequestLoop = &synchronousRequestLoop; | - |
223 | | - |
224 | // Worst case timeout | - |
225 | QTimer::singleShot(30*1000, this, SLOT(abortRequest())); executed (the execution status of this line is deduced): QTimer::singleShot(30*1000, this, "1""abortRequest()"); | - |
226 | | - |
227 | QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection); | - |
228 | synchronousRequestLoop.exec(); executed (the execution status of this line is deduced): synchronousRequestLoop.exec(); | - |
229 | | - |
230 | connections.localData()->releaseEntry(cacheKey); executed (the execution status of this line is deduced): connections.localData()->releaseEntry(cacheKey); | - |
231 | connections.setLocalData(0); executed (the execution status of this line is deduced): connections.setLocalData(0); | - |
232 | | - |
233 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
234 | qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId() << "finished"; | - |
235 | #endif | - |
236 | } executed: } Execution Count:76 | 76 |
237 | | - |
238 | | - |
239 | // This is invoked as QueuedConnection from QNetworkAccessHttpBackend in the user thread | - |
240 | void QHttpThreadDelegate::startRequest() | - |
241 | { | - |
242 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
243 | qDebug() << "QHttpThreadDelegate::startRequest() thread=" << QThread::currentThreadId(); | - |
244 | #endif | - |
245 | // Check QThreadStorage for the QNetworkAccessCache | - |
246 | // If not there, create this connection cache | - |
247 | if (!connections.hasLocalData()) { evaluated: !connections.hasLocalData() yes Evaluation Count:505 | yes Evaluation Count:189 |
| 189-505 |
248 | connections.setLocalData(new QNetworkAccessCache()); executed (the execution status of this line is deduced): connections.setLocalData(new QNetworkAccessCache()); | - |
249 | } executed: } Execution Count:505 | 505 |
250 | | - |
251 | // check if we have an open connection to this host | - |
252 | QUrl urlCopy = httpRequest.url(); executed (the execution status of this line is deduced): QUrl urlCopy = httpRequest.url(); | - |
253 | urlCopy.setPort(urlCopy.port(ssl ? 443 : 80)); executed (the execution status of this line is deduced): urlCopy.setPort(urlCopy.port(ssl ? 443 : 80)); | - |
254 | | - |
255 | #ifndef QT_NO_NETWORKPROXY | - |
256 | if (transparentProxy.type() != QNetworkProxy::NoProxy) evaluated: transparentProxy.type() != QNetworkProxy::NoProxy yes Evaluation Count:65 | yes Evaluation Count:629 |
| 65-629 |
257 | cacheKey = makeCacheKey(urlCopy, &transparentProxy); executed: cacheKey = makeCacheKey(urlCopy, &transparentProxy); Execution Count:65 | 65 |
258 | else if (cacheProxy.type() != QNetworkProxy::NoProxy) evaluated: cacheProxy.type() != QNetworkProxy::NoProxy yes Evaluation Count:57 | yes Evaluation Count:572 |
| 57-572 |
259 | cacheKey = makeCacheKey(urlCopy, &cacheProxy); executed: cacheKey = makeCacheKey(urlCopy, &cacheProxy); Execution Count:57 | 57 |
260 | else | - |
261 | #endif | - |
262 | cacheKey = makeCacheKey(urlCopy, 0); executed: cacheKey = makeCacheKey(urlCopy, 0); Execution Count:572 | 572 |
263 | | - |
264 | | - |
265 | // the http object is actually a QHttpNetworkConnection | - |
266 | httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey)); executed (the execution status of this line is deduced): httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey)); | - |
267 | if (httpConnection == 0) { evaluated: httpConnection == 0 yes Evaluation Count:507 | yes Evaluation Count:187 |
| 187-507 |
268 | // no entry in cache; create an object | - |
269 | // the http object is actually a QHttpNetworkConnection | - |
270 | #ifdef QT_NO_BEARERMANAGEMENT | - |
271 | httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl); | - |
272 | #else | - |
273 | httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, networkSession); executed (the execution status of this line is deduced): httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, networkSession); | - |
274 | #endif | - |
275 | #ifndef QT_NO_SSL | - |
276 | // Set the QSslConfiguration from this QNetworkRequest. | - |
277 | if (ssl && incomingSslConfiguration != QSslConfiguration::defaultConfiguration()) { evaluated: ssl yes Evaluation Count:72 | yes Evaluation Count:435 |
evaluated: incomingSslConfiguration != QSslConfiguration::defaultConfiguration() yes Evaluation Count:43 | yes Evaluation Count:29 |
| 29-435 |
278 | httpConnection->setSslConfiguration(incomingSslConfiguration); executed (the execution status of this line is deduced): httpConnection->setSslConfiguration(incomingSslConfiguration); | - |
279 | } executed: } Execution Count:43 | 43 |
280 | #endif | - |
281 | | - |
282 | #ifndef QT_NO_NETWORKPROXY | - |
283 | httpConnection->setTransparentProxy(transparentProxy); executed (the execution status of this line is deduced): httpConnection->setTransparentProxy(transparentProxy); | - |
284 | httpConnection->setCacheProxy(cacheProxy); executed (the execution status of this line is deduced): httpConnection->setCacheProxy(cacheProxy); | - |
285 | #endif | - |
286 | | - |
287 | // cache the QHttpNetworkConnection corresponding to this cache key | - |
288 | connections.localData()->addEntry(cacheKey, httpConnection); executed (the execution status of this line is deduced): connections.localData()->addEntry(cacheKey, httpConnection); | - |
289 | } executed: } Execution Count:507 | 507 |
290 | | - |
291 | | - |
292 | // Send the request to the connection | - |
293 | httpReply = httpConnection->sendRequest(httpRequest); executed (the execution status of this line is deduced): httpReply = httpConnection->sendRequest(httpRequest); | - |
294 | httpReply->setParent(this); executed (the execution status of this line is deduced): httpReply->setParent(this); | - |
295 | | - |
296 | // Connect the reply signals that we need to handle and then forward | - |
297 | if (synchronous) { evaluated: synchronous yes Evaluation Count:76 | yes Evaluation Count:618 |
| 76-618 |
298 | connect(httpReply,SIGNAL(headerChanged()), this, SLOT(synchronousHeaderChangedSlot())); executed (the execution status of this line is deduced): connect(httpReply,"2""headerChanged()", this, "1""synchronousHeaderChangedSlot()"); | - |
299 | connect(httpReply,SIGNAL(finished()), this, SLOT(synchronousFinishedSlot())); executed (the execution status of this line is deduced): connect(httpReply,"2""finished()", this, "1""synchronousFinishedSlot()"); | - |
300 | connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), executed (the execution status of this line is deduced): connect(httpReply,"2""finishedWithError(QNetworkReply::NetworkError,QString)", | - |
301 | this, SLOT(synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString))); executed (the execution status of this line is deduced): this, "1""synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString)"); | - |
302 | | - |
303 | connect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): connect(httpReply, "2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)", | - |
304 | this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*))); executed (the execution status of this line is deduced): this, "1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)"); | - |
305 | connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), executed (the execution status of this line is deduced): connect(httpReply, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
306 | this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*))); executed (the execution status of this line is deduced): this, "1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)"); | - |
307 | | - |
308 | // Don't care about ignored SSL errors for now in the synchronous HTTP case. | - |
309 | } else if (!synchronous) { executed: } Execution Count:76 partially evaluated: !synchronous yes Evaluation Count:618 | no Evaluation Count:0 |
| 0-618 |
310 | connect(httpReply,SIGNAL(headerChanged()), this, SLOT(headerChangedSlot())); executed (the execution status of this line is deduced): connect(httpReply,"2""headerChanged()", this, "1""headerChangedSlot()"); | - |
311 | connect(httpReply,SIGNAL(finished()), this, SLOT(finishedSlot())); executed (the execution status of this line is deduced): connect(httpReply,"2""finished()", this, "1""finishedSlot()"); | - |
312 | connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), executed (the execution status of this line is deduced): connect(httpReply,"2""finishedWithError(QNetworkReply::NetworkError,QString)", | - |
313 | this, SLOT(finishedWithErrorSlot(QNetworkReply::NetworkError,QString))); executed (the execution status of this line is deduced): this, "1""finishedWithErrorSlot(QNetworkReply::NetworkError,QString)"); | - |
314 | // some signals are only interesting when normal asynchronous style is used | - |
315 | connect(httpReply,SIGNAL(readyRead()), this, SLOT(readyReadSlot())); executed (the execution status of this line is deduced): connect(httpReply,"2""readyRead()", this, "1""readyReadSlot()"); | - |
316 | connect(httpReply,SIGNAL(dataReadProgress(qint64,qint64)), this, SLOT(dataReadProgressSlot(qint64,qint64))); executed (the execution status of this line is deduced): connect(httpReply,"2""dataReadProgress(qint64,qint64)", this, "1""dataReadProgressSlot(qint64,qint64)"); | - |
317 | #ifndef QT_NO_SSL | - |
318 | connect(httpReply,SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsSlot(QList<QSslError>))); executed (the execution status of this line is deduced): connect(httpReply,"2""sslErrors(QList<QSslError>)", this, "1""sslErrorsSlot(QList<QSslError>)"); | - |
319 | #endif | - |
320 | | - |
321 | // In the asynchronous HTTP case we can just forward those signals | - |
322 | // Connect the reply signals that we can directly forward | - |
323 | connect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): connect(httpReply, "2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)", | - |
324 | this, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*))); executed (the execution status of this line is deduced): this, "2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)"); | - |
325 | connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), executed (the execution status of this line is deduced): connect(httpReply, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
326 | this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); executed (the execution status of this line is deduced): this, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)"); | - |
327 | } executed: } Execution Count:618 | 618 |
328 | | - |
329 | connect(httpReply, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): connect(httpReply, "2""cacheCredentials(QHttpNetworkRequest,QAuthenticator*)", | - |
330 | this, SLOT(cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*))); executed (the execution status of this line is deduced): this, "1""cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*)"); | - |
331 | } executed: } Execution Count:694 | 694 |
332 | | - |
333 | // This gets called from the user thread or by the synchronous HTTP timeout timer | - |
334 | void QHttpThreadDelegate::abortRequest() | - |
335 | { | - |
336 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
337 | qDebug() << "QHttpThreadDelegate::abortRequest() thread=" << QThread::currentThreadId() << "sync=" << synchronous; | - |
338 | #endif | - |
339 | if (httpReply) { partially evaluated: httpReply yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
340 | delete httpReply; executed (the execution status of this line is deduced): delete httpReply; | - |
341 | httpReply = 0; executed (the execution status of this line is deduced): httpReply = 0; | - |
342 | } executed: } Execution Count:2 | 2 |
343 | | - |
344 | // Got aborted by the timeout timer | - |
345 | if (synchronous) { partially evaluated: synchronous no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
346 | incomingErrorCode = QNetworkReply::TimeoutError; never executed (the execution status of this line is deduced): incomingErrorCode = QNetworkReply::TimeoutError; | - |
347 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - |
348 | } else { | 0 |
349 | //only delete this for asynchronous mode or QNetworkAccessHttpBackend will crash - see QNetworkAccessHttpBackend::postRequest() | - |
350 | this->deleteLater(); executed (the execution status of this line is deduced): this->deleteLater(); | - |
351 | } executed: } Execution Count:2 | 2 |
352 | } | - |
353 | | - |
354 | void QHttpThreadDelegate::readBufferSizeChanged(qint64 size) | - |
355 | { | - |
356 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
357 | qDebug() << "QHttpThreadDelegate::readBufferSizeChanged() size " << size; | - |
358 | #endif | - |
359 | if (httpReply) { partially evaluated: httpReply yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
360 | httpReply->setDownstreamLimited(size > 0); executed (the execution status of this line is deduced): httpReply->setDownstreamLimited(size > 0); | - |
361 | httpReply->setReadBufferSize(size); executed (the execution status of this line is deduced): httpReply->setReadBufferSize(size); | - |
362 | readBufferMaxSize = size; executed (the execution status of this line is deduced): readBufferMaxSize = size; | - |
363 | } executed: } Execution Count:10 | 10 |
364 | } executed: } Execution Count:10 | 10 |
365 | | - |
366 | void QHttpThreadDelegate::readBufferFreed(qint64 size) | - |
367 | { | - |
368 | if (readBufferMaxSize) { partially evaluated: readBufferMaxSize yes Evaluation Count:881 | no Evaluation Count:0 |
| 0-881 |
369 | bytesEmitted -= size; executed (the execution status of this line is deduced): bytesEmitted -= size; | - |
370 | | - |
371 | QMetaObject::invokeMethod(this, "readyReadSlot", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "readyReadSlot", Qt::QueuedConnection); | - |
372 | } executed: } Execution Count:881 | 881 |
373 | } executed: } Execution Count:881 | 881 |
374 | | - |
375 | void QHttpThreadDelegate::readyReadSlot() | - |
376 | { | - |
377 | if (!httpReply) evaluated: !httpReply yes Evaluation Count:2 | yes Evaluation Count:12037 |
| 2-12037 |
378 | return; executed: return; Execution Count:2 | 2 |
379 | | - |
380 | // Don't do in zerocopy case | - |
381 | if (!downloadBuffer.isNull()) partially evaluated: !downloadBuffer.isNull() no Evaluation Count:0 | yes Evaluation Count:12037 |
| 0-12037 |
382 | return; | 0 |
383 | | - |
384 | if (readBufferMaxSize) { evaluated: readBufferMaxSize yes Evaluation Count:3122 | yes Evaluation Count:8915 |
| 3122-8915 |
385 | if (bytesEmitted < readBufferMaxSize) { evaluated: bytesEmitted < readBufferMaxSize yes Evaluation Count:3092 | yes Evaluation Count:30 |
| 30-3092 |
386 | qint64 sizeEmitted = 0; executed (the execution status of this line is deduced): qint64 sizeEmitted = 0; | - |
387 | while (httpReply->readAnyAvailable() && (sizeEmitted < (readBufferMaxSize-bytesEmitted))) { evaluated: httpReply->readAnyAvailable() yes Evaluation Count:2377 | yes Evaluation Count:2490 |
evaluated: (sizeEmitted < (readBufferMaxSize-bytesEmitted)) yes Evaluation Count:1775 | yes Evaluation Count:602 |
| 602-2490 |
388 | if (httpReply->sizeNextBlock() > (readBufferMaxSize-bytesEmitted)) { evaluated: httpReply->sizeNextBlock() > (readBufferMaxSize-bytesEmitted) yes Evaluation Count:595 | yes Evaluation Count:1180 |
| 595-1180 |
389 | sizeEmitted = readBufferMaxSize-bytesEmitted; executed (the execution status of this line is deduced): sizeEmitted = readBufferMaxSize-bytesEmitted; | - |
390 | bytesEmitted += sizeEmitted; executed (the execution status of this line is deduced): bytesEmitted += sizeEmitted; | - |
391 | pendingDownloadData->fetchAndAddRelease(1); executed (the execution status of this line is deduced): pendingDownloadData->fetchAndAddRelease(1); | - |
392 | emit downloadData(httpReply->read(sizeEmitted)); executed (the execution status of this line is deduced): downloadData(httpReply->read(sizeEmitted)); | - |
393 | } else { executed: } Execution Count:595 | 595 |
394 | sizeEmitted = httpReply->sizeNextBlock(); executed (the execution status of this line is deduced): sizeEmitted = httpReply->sizeNextBlock(); | - |
395 | bytesEmitted += sizeEmitted; executed (the execution status of this line is deduced): bytesEmitted += sizeEmitted; | - |
396 | pendingDownloadData->fetchAndAddRelease(1); executed (the execution status of this line is deduced): pendingDownloadData->fetchAndAddRelease(1); | - |
397 | emit downloadData(httpReply->readAny()); executed (the execution status of this line is deduced): downloadData(httpReply->readAny()); | - |
398 | } executed: } Execution Count:1180 | 1180 |
399 | } | - |
400 | } else { executed: } Execution Count:3092 | 3092 |
401 | // We need to wait until we empty data from the read buffer in the reply. | - |
402 | } executed: } Execution Count:30 | 30 |
403 | | - |
404 | } else { | - |
405 | while (httpReply->readAnyAvailable()) { evaluated: httpReply->readAnyAvailable() yes Evaluation Count:4955 | yes Evaluation Count:8915 |
| 4955-8915 |
406 | pendingDownloadData->fetchAndAddRelease(1); executed (the execution status of this line is deduced): pendingDownloadData->fetchAndAddRelease(1); | - |
407 | emit downloadData(httpReply->readAny()); executed (the execution status of this line is deduced): downloadData(httpReply->readAny()); | - |
408 | } executed: } Execution Count:4955 | 4955 |
409 | } executed: } Execution Count:8915 | 8915 |
410 | } | - |
411 | | - |
412 | void QHttpThreadDelegate::finishedSlot() | - |
413 | { | - |
414 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:535 |
| 0-535 |
415 | return; | 0 |
416 | | - |
417 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
418 | qDebug() << "QHttpThreadDelegate::finishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode(); | - |
419 | #endif | - |
420 | | - |
421 | // If there is still some data left emit that now | - |
422 | while (httpReply->readAnyAvailable()) { evaluated: httpReply->readAnyAvailable() yes Evaluation Count:2 | yes Evaluation Count:535 |
| 2-535 |
423 | pendingDownloadData->fetchAndAddRelease(1); executed (the execution status of this line is deduced): pendingDownloadData->fetchAndAddRelease(1); | - |
424 | emit downloadData(httpReply->readAny()); executed (the execution status of this line is deduced): downloadData(httpReply->readAny()); | - |
425 | } executed: } Execution Count:2 | 2 |
426 | | - |
427 | #ifndef QT_NO_SSL | - |
428 | if (ssl) evaluated: ssl yes Evaluation Count:48 | yes Evaluation Count:487 |
| 48-487 |
429 | emit sslConfigurationChanged(httpReply->sslConfiguration()); executed: sslConfigurationChanged(httpReply->sslConfiguration()); Execution Count:48 | 48 |
430 | #endif | - |
431 | | - |
432 | if (httpReply->statusCode() >= 400) { evaluated: httpReply->statusCode() >= 400 yes Evaluation Count:8 | yes Evaluation Count:527 |
| 8-527 |
433 | // it's an error reply | - |
434 | QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", executed (the execution status of this line is deduced): QString msg = QLatin1String("Error downloading %1 - server replied: %2"); | - |
435 | "Error downloading %1 - server replied: %2")); | - |
436 | msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); executed (the execution status of this line is deduced): msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); | - |
437 | emit error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg); executed (the execution status of this line is deduced): error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg); | - |
438 | } executed: } Execution Count:8 | 8 |
439 | | - |
440 | emit downloadFinished(); executed (the execution status of this line is deduced): downloadFinished(); | - |
441 | | - |
442 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - |
443 | QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); | - |
444 | httpReply = 0; executed (the execution status of this line is deduced): httpReply = 0; | - |
445 | } executed: } Execution Count:535 | 535 |
446 | | - |
447 | void QHttpThreadDelegate::synchronousFinishedSlot() | - |
448 | { | - |
449 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:63 |
| 0-63 |
450 | return; | 0 |
451 | | - |
452 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
453 | qDebug() << "QHttpThreadDelegate::synchronousFinishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode(); | - |
454 | #endif | - |
455 | if (httpReply->statusCode() >= 400) { partially evaluated: httpReply->statusCode() >= 400 no Evaluation Count:0 | yes Evaluation Count:63 |
| 0-63 |
456 | // it's an error reply | - |
457 | QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", never executed (the execution status of this line is deduced): QString msg = QLatin1String("Error downloading %1 - server replied: %2"); | - |
458 | "Error downloading %1 - server replied: %2")); | - |
459 | incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); never executed (the execution status of this line is deduced): incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); | - |
460 | incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()); never executed (the execution status of this line is deduced): incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()); | - |
461 | } | 0 |
462 | | - |
463 | synchronousDownloadData = httpReply->readAll(); executed (the execution status of this line is deduced): synchronousDownloadData = httpReply->readAll(); | - |
464 | | - |
465 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - |
466 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - |
467 | httpReply = 0; executed (the execution status of this line is deduced): httpReply = 0; | - |
468 | } executed: } Execution Count:63 | 63 |
469 | | - |
470 | void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail) | - |
471 | { | - |
472 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:68 |
| 0-68 |
473 | return; | 0 |
474 | | - |
475 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
476 | qDebug() << "QHttpThreadDelegate::finishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail; | - |
477 | #endif | - |
478 | | - |
479 | #ifndef QT_NO_SSL | - |
480 | if (ssl) evaluated: ssl yes Evaluation Count:22 | yes Evaluation Count:46 |
| 22-46 |
481 | emit sslConfigurationChanged(httpReply->sslConfiguration()); executed: sslConfigurationChanged(httpReply->sslConfiguration()); Execution Count:22 | 22 |
482 | #endif | - |
483 | emit error(errorCode,detail); executed (the execution status of this line is deduced): error(errorCode,detail); | - |
484 | emit downloadFinished(); executed (the execution status of this line is deduced): downloadFinished(); | - |
485 | | - |
486 | | - |
487 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - |
488 | QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); | - |
489 | httpReply = 0; executed (the execution status of this line is deduced): httpReply = 0; | - |
490 | } executed: } Execution Count:68 | 68 |
491 | | - |
492 | | - |
493 | void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail) | - |
494 | { | - |
495 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
496 | return; | 0 |
497 | | - |
498 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
499 | qDebug() << "QHttpThreadDelegate::synchronousFinishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail; | - |
500 | #endif | - |
501 | incomingErrorCode = errorCode; executed (the execution status of this line is deduced): incomingErrorCode = errorCode; | - |
502 | incomingErrorDetail = detail; executed (the execution status of this line is deduced): incomingErrorDetail = detail; | - |
503 | | - |
504 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - |
505 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - |
506 | httpReply = 0; executed (the execution status of this line is deduced): httpReply = 0; | - |
507 | } executed: } Execution Count:13 | 13 |
508 | | - |
509 | static void downloadBufferDeleter(char *ptr) | - |
510 | { | - |
511 | delete[] ptr; executed (the execution status of this line is deduced): delete[] ptr; | - |
512 | } executed: } Execution Count:334 | 334 |
513 | | - |
514 | void QHttpThreadDelegate::headerChangedSlot() | - |
515 | { | - |
516 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:564 |
| 0-564 |
517 | return; | 0 |
518 | | - |
519 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
520 | qDebug() << "QHttpThreadDelegate::headerChangedSlot() thread=" << QThread::currentThreadId(); | - |
521 | #endif | - |
522 | | - |
523 | #ifndef QT_NO_SSL | - |
524 | if (ssl) evaluated: ssl yes Evaluation Count:56 | yes Evaluation Count:508 |
| 56-508 |
525 | emit sslConfigurationChanged(httpReply->sslConfiguration()); executed: sslConfigurationChanged(httpReply->sslConfiguration()); Execution Count:56 | 56 |
526 | #endif | - |
527 | | - |
528 | // Is using a zerocopy buffer allowed by user and possible with this reply? | - |
529 | if (httpReply->supportsUserProvidedDownloadBuffer() evaluated: httpReply->supportsUserProvidedDownloadBuffer() yes Evaluation Count:352 | yes Evaluation Count:212 |
| 212-352 |
530 | && (downloadBufferMaximumSize > 0) && (httpReply->contentLength() <= downloadBufferMaximumSize)) { partially evaluated: (downloadBufferMaximumSize > 0) yes Evaluation Count:352 | no Evaluation Count:0 |
evaluated: (httpReply->contentLength() <= downloadBufferMaximumSize) yes Evaluation Count:334 | yes Evaluation Count:18 |
| 0-352 |
531 | QT_TRY { partially evaluated: true yes Evaluation Count:334 | no Evaluation Count:0 |
| 0-334 |
532 | char *buf = new char[httpReply->contentLength()]; // throws if allocation fails executed (the execution status of this line is deduced): char *buf = new char[httpReply->contentLength()]; | - |
533 | if (buf) { partially evaluated: buf yes Evaluation Count:334 | no Evaluation Count:0 |
| 0-334 |
534 | downloadBuffer = QSharedPointer<char>(buf, downloadBufferDeleter); executed (the execution status of this line is deduced): downloadBuffer = QSharedPointer<char>(buf, downloadBufferDeleter); | - |
535 | httpReply->setUserProvidedDownloadBuffer(buf); executed (the execution status of this line is deduced): httpReply->setUserProvidedDownloadBuffer(buf); | - |
536 | } executed: } Execution Count:334 | 334 |
537 | } QT_CATCH(const std::bad_alloc &) { executed: } Execution Count:334 | 334 |
538 | // in out of memory situations, don't use downloadbuffer. | - |
539 | } | 0 |
540 | } | - |
541 | | - |
542 | // We fetch this into our own | - |
543 | incomingHeaders = httpReply->header(); executed (the execution status of this line is deduced): incomingHeaders = httpReply->header(); | - |
544 | incomingStatusCode = httpReply->statusCode(); executed (the execution status of this line is deduced): incomingStatusCode = httpReply->statusCode(); | - |
545 | incomingReasonPhrase = httpReply->reasonPhrase(); executed (the execution status of this line is deduced): incomingReasonPhrase = httpReply->reasonPhrase(); | - |
546 | isPipeliningUsed = httpReply->isPipeliningUsed(); executed (the execution status of this line is deduced): isPipeliningUsed = httpReply->isPipeliningUsed(); | - |
547 | incomingContentLength = httpReply->contentLength(); executed (the execution status of this line is deduced): incomingContentLength = httpReply->contentLength(); | - |
548 | | - |
549 | emit downloadMetaData(incomingHeaders, executed (the execution status of this line is deduced): downloadMetaData(incomingHeaders, | - |
550 | incomingStatusCode, executed (the execution status of this line is deduced): incomingStatusCode, | - |
551 | incomingReasonPhrase, executed (the execution status of this line is deduced): incomingReasonPhrase, | - |
552 | isPipeliningUsed, executed (the execution status of this line is deduced): isPipeliningUsed, | - |
553 | downloadBuffer, executed (the execution status of this line is deduced): downloadBuffer, | - |
554 | incomingContentLength); executed (the execution status of this line is deduced): incomingContentLength); | - |
555 | } executed: } Execution Count:564 | 564 |
556 | | - |
557 | void QHttpThreadDelegate::synchronousHeaderChangedSlot() | - |
558 | { | - |
559 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:74 |
| 0-74 |
560 | return; | 0 |
561 | | - |
562 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
563 | qDebug() << "QHttpThreadDelegate::synchronousHeaderChangedSlot() thread=" << QThread::currentThreadId(); | - |
564 | #endif | - |
565 | // Store the information we need in this object, the QNetworkAccessHttpBackend will later read it | - |
566 | incomingHeaders = httpReply->header(); executed (the execution status of this line is deduced): incomingHeaders = httpReply->header(); | - |
567 | incomingStatusCode = httpReply->statusCode(); executed (the execution status of this line is deduced): incomingStatusCode = httpReply->statusCode(); | - |
568 | incomingReasonPhrase = httpReply->reasonPhrase(); executed (the execution status of this line is deduced): incomingReasonPhrase = httpReply->reasonPhrase(); | - |
569 | isPipeliningUsed = httpReply->isPipeliningUsed(); executed (the execution status of this line is deduced): isPipeliningUsed = httpReply->isPipeliningUsed(); | - |
570 | incomingContentLength = httpReply->contentLength(); executed (the execution status of this line is deduced): incomingContentLength = httpReply->contentLength(); | - |
571 | } executed: } Execution Count:74 | 74 |
572 | | - |
573 | | - |
574 | void QHttpThreadDelegate::dataReadProgressSlot(qint64 done, qint64 total) | - |
575 | { | - |
576 | // If we don't have a download buffer don't attempt to go this codepath | - |
577 | // It is not used by QNetworkAccessHttpBackend | - |
578 | if (downloadBuffer.isNull()) evaluated: downloadBuffer.isNull() yes Evaluation Count:11135 | yes Evaluation Count:3163 |
| 3163-11135 |
579 | return; executed: return; Execution Count:11135 | 11135 |
580 | | - |
581 | pendingDownloadProgress->fetchAndAddRelease(1); executed (the execution status of this line is deduced): pendingDownloadProgress->fetchAndAddRelease(1); | - |
582 | emit downloadProgress(done, total); executed (the execution status of this line is deduced): downloadProgress(done, total); | - |
583 | } executed: } Execution Count:3163 | 3163 |
584 | | - |
585 | void QHttpThreadDelegate::cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator) | - |
586 | { | - |
587 | authenticationManager->cacheCredentials(request.url(), authenticator); executed (the execution status of this line is deduced): authenticationManager->cacheCredentials(request.url(), authenticator); | - |
588 | } executed: } Execution Count:169 | 169 |
589 | | - |
590 | | - |
591 | #ifndef QT_NO_SSL | - |
592 | void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors) | - |
593 | { | - |
594 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
595 | return; | 0 |
596 | | - |
597 | emit sslConfigurationChanged(httpReply->sslConfiguration()); executed (the execution status of this line is deduced): sslConfigurationChanged(httpReply->sslConfiguration()); | - |
598 | | - |
599 | bool ignoreAll = false; executed (the execution status of this line is deduced): bool ignoreAll = false; | - |
600 | QList<QSslError> specificErrors; executed (the execution status of this line is deduced): QList<QSslError> specificErrors; | - |
601 | emit sslErrors(errors, &ignoreAll, &specificErrors); executed (the execution status of this line is deduced): sslErrors(errors, &ignoreAll, &specificErrors); | - |
602 | if (ignoreAll) evaluated: ignoreAll yes Evaluation Count:21 | yes Evaluation Count:12 |
| 12-21 |
603 | httpReply->ignoreSslErrors(); executed: httpReply->ignoreSslErrors(); Execution Count:21 | 21 |
604 | if (!specificErrors.isEmpty()) evaluated: !specificErrors.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:27 |
| 6-27 |
605 | httpReply->ignoreSslErrors(specificErrors); executed: httpReply->ignoreSslErrors(specificErrors); Execution Count:6 | 6 |
606 | } executed: } Execution Count:33 | 33 |
607 | #endif | - |
608 | | - |
609 | void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *a) | - |
610 | { | - |
611 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
612 | return; | 0 |
613 | | - |
614 | Q_UNUSED(request); executed (the execution status of this line is deduced): (void)request;; | - |
615 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
616 | qDebug() << "QHttpThreadDelegate::synchronousAuthenticationRequiredSlot() thread=" << QThread::currentThreadId(); | - |
617 | #endif | - |
618 | | - |
619 | // Ask the credential cache | - |
620 | QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), a); executed (the execution status of this line is deduced): QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), a); | - |
621 | if (!credential.isNull()) { evaluated: !credential.isNull() yes Evaluation Count:11 | yes Evaluation Count:6 |
| 6-11 |
622 | a->setUser(credential.user); executed (the execution status of this line is deduced): a->setUser(credential.user); | - |
623 | a->setPassword(credential.password); executed (the execution status of this line is deduced): a->setPassword(credential.password); | - |
624 | } executed: } Execution Count:11 | 11 |
625 | | - |
626 | // Disconnect this connection now since we only want to ask the authentication cache once. | - |
627 | QObject::disconnect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): QObject::disconnect(httpReply, "2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)", | - |
628 | this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*))); executed (the execution status of this line is deduced): this, "1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)"); | - |
629 | } executed: } Execution Count:17 | 17 |
630 | | - |
631 | #ifndef QT_NO_NETWORKPROXY | - |
632 | void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &p, QAuthenticator *a) | - |
633 | { | - |
634 | if (!httpReply) partially evaluated: !httpReply no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
635 | return; | 0 |
636 | | - |
637 | #ifdef QHTTPTHREADDELEGATE_DEBUG | - |
638 | qDebug() << "QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot() thread=" << QThread::currentThreadId(); | - |
639 | #endif | - |
640 | // Ask the credential cache | - |
641 | QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedProxyCredentials(p, a); executed (the execution status of this line is deduced): QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedProxyCredentials(p, a); | - |
642 | if (!credential.isNull()) { partially evaluated: !credential.isNull() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
643 | a->setUser(credential.user); never executed (the execution status of this line is deduced): a->setUser(credential.user); | - |
644 | a->setPassword(credential.password); never executed (the execution status of this line is deduced): a->setPassword(credential.password); | - |
645 | } | 0 |
646 | | - |
647 | // Disconnect this connection now since we only want to ask the authentication cache once. | - |
648 | QObject::disconnect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), executed (the execution status of this line is deduced): QObject::disconnect(httpReply, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
649 | this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*))); executed (the execution status of this line is deduced): this, "1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)"); | - |
650 | } executed: } Execution Count:1 | 1 |
651 | | - |
652 | #endif | - |
653 | | - |
654 | #endif // QT_NO_HTTP | - |
655 | | - |
656 | QT_END_NAMESPACE | - |
657 | | - |
| | |