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 QNETWORKACCESSHTTPBACKEND_DEBUG | - |
43 | | - |
44 | #include "qnetworkreplyhttpimpl_p.h" | - |
45 | #include "qnetworkaccessmanager_p.h" | - |
46 | #include "qnetworkaccesscache_p.h" | - |
47 | #include "qabstractnetworkcache.h" | - |
48 | #include "qnetworkrequest.h" | - |
49 | #include "qnetworkreply.h" | - |
50 | #include "qnetworkrequest_p.h" | - |
51 | #include "qnetworkcookie.h" | - |
52 | #include "qnetworkcookie_p.h" | - |
53 | #include "QtCore/qdatetime.h" | - |
54 | #include "QtCore/qelapsedtimer.h" | - |
55 | #include "QtNetwork/qsslconfiguration.h" | - |
56 | #include "qhttpthreaddelegate_p.h" | - |
57 | #include "qthread.h" | - |
58 | #include "QtCore/qcoreapplication.h" | - |
59 | | - |
60 | #include "qnetworkcookiejar.h" | - |
61 | | - |
62 | #ifndef QT_NO_HTTP | - |
63 | | - |
64 | #include <string.h> // for strchr | - |
65 | | - |
66 | QT_BEGIN_NAMESPACE | - |
67 | | - |
68 | class QNetworkProxy; | - |
69 | | - |
70 | static inline bool isSeparator(register char c) | - |
71 | { | - |
72 | static const char separators[] = "()<>@,;:\\\"/[]?={}"; | - |
73 | return isLWS(c) || strchr(separators, c) != 0; executed: return isLWS(c) || strchr(separators, c) != 0; Execution Count:157 | 157 |
74 | } | - |
75 | | - |
76 | // ### merge with nextField in cookiejar.cpp | - |
77 | static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &header) | - |
78 | { | - |
79 | // The HTTP header is of the form: | - |
80 | // header = #1(directives) | - |
81 | // directives = token | value-directive | - |
82 | // value-directive = token "=" (token | quoted-string) | - |
83 | QHash<QByteArray, QByteArray> result; executed (the execution status of this line is deduced): QHash<QByteArray, QByteArray> result; | - |
84 | | - |
85 | int pos = 0; executed (the execution status of this line is deduced): int pos = 0; | - |
86 | while (true) { partially evaluated: true yes Evaluation Count:91 | no Evaluation Count:0 |
| 0-91 |
87 | // skip spaces | - |
88 | pos = nextNonWhitespace(header, pos); executed (the execution status of this line is deduced): pos = nextNonWhitespace(header, pos); | - |
89 | if (pos == header.length()) evaluated: pos == header.length() yes Evaluation Count:22 | yes Evaluation Count:69 |
| 22-69 |
90 | return result; // end of parsing executed: return result; Execution Count:22 | 22 |
91 | | - |
92 | // pos points to a non-whitespace | - |
93 | int comma = header.indexOf(',', pos); executed (the execution status of this line is deduced): int comma = header.indexOf(',', pos); | - |
94 | int equal = header.indexOf('=', pos); executed (the execution status of this line is deduced): int equal = header.indexOf('=', pos); | - |
95 | if (comma == pos || equal == pos) partially evaluated: comma == pos no Evaluation Count:0 | yes Evaluation Count:69 |
partially evaluated: equal == pos no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
96 | // huh? Broken header. | - |
97 | return result; never executed: return result; | 0 |
98 | | - |
99 | // The key name is delimited by either a comma, an equal sign or the end | - |
100 | // of the header, whichever comes first | - |
101 | int end = comma; executed (the execution status of this line is deduced): int end = comma; | - |
102 | if (end == -1) evaluated: end == -1 yes Evaluation Count:50 | yes Evaluation Count:19 |
| 19-50 |
103 | end = header.length(); executed: end = header.length(); Execution Count:50 | 50 |
104 | if (equal != -1 && end > equal) evaluated: equal != -1 yes Evaluation Count:47 | yes Evaluation Count:22 |
evaluated: end > equal yes Evaluation Count:43 | yes Evaluation Count:4 |
| 4-47 |
105 | end = equal; // equal sign comes before comma/end executed: end = equal; Execution Count:43 | 43 |
106 | QByteArray key = QByteArray(header.constData() + pos, end - pos).trimmed().toLower(); executed (the execution status of this line is deduced): QByteArray key = QByteArray(header.constData() + pos, end - pos).trimmed().toLower(); | - |
107 | pos = end + 1; executed (the execution status of this line is deduced): pos = end + 1; | - |
108 | | - |
109 | if (uint(equal) < uint(comma)) { evaluated: uint(equal) < uint(comma) yes Evaluation Count:43 | yes Evaluation Count:26 |
| 26-43 |
110 | // case: token "=" (token | quoted-string) | - |
111 | // skip spaces | - |
112 | pos = nextNonWhitespace(header, pos); executed (the execution status of this line is deduced): pos = nextNonWhitespace(header, pos); | - |
113 | if (pos == header.length()) partially evaluated: pos == header.length() no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
114 | // huh? Broken header | - |
115 | return result; never executed: return result; | 0 |
116 | | - |
117 | QByteArray value; executed (the execution status of this line is deduced): QByteArray value; | - |
118 | value.reserve(header.length() - pos); executed (the execution status of this line is deduced): value.reserve(header.length() - pos); | - |
119 | if (header.at(pos) == '"') { partially evaluated: header.at(pos) == '"' no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
120 | // case: quoted-string | - |
121 | // quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) | - |
122 | // qdtext = <any TEXT except <">> | - |
123 | // quoted-pair = "\" CHAR | - |
124 | ++pos; never executed (the execution status of this line is deduced): ++pos; | - |
125 | while (pos < header.length()) { never evaluated: pos < header.length() | 0 |
126 | register char c = header.at(pos); never executed (the execution status of this line is deduced): register char c = header.at(pos); | - |
127 | if (c == '"') { never evaluated: c == '"' | 0 |
128 | // end of quoted text | - |
129 | break; | 0 |
130 | } else if (c == '\\') { never evaluated: c == '\\' | 0 |
131 | ++pos; never executed (the execution status of this line is deduced): ++pos; | - |
132 | if (pos >= header.length()) never evaluated: pos >= header.length() | 0 |
133 | // broken header | - |
134 | return result; never executed: return result; | 0 |
135 | c = header.at(pos); never executed (the execution status of this line is deduced): c = header.at(pos); | - |
136 | } | 0 |
137 | | - |
138 | value += c; never executed (the execution status of this line is deduced): value += c; | - |
139 | ++pos; never executed (the execution status of this line is deduced): ++pos; | - |
140 | } | 0 |
141 | } else { | 0 |
142 | // case: token | - |
143 | while (pos < header.length()) { evaluated: pos < header.length() yes Evaluation Count:157 | yes Evaluation Count:28 |
| 28-157 |
144 | register char c = header.at(pos); executed (the execution status of this line is deduced): register char c = header.at(pos); | - |
145 | if (isSeparator(c)) evaluated: isSeparator(c) yes Evaluation Count:15 | yes Evaluation Count:142 |
| 15-142 |
146 | break; executed: break; Execution Count:15 | 15 |
147 | value += c; executed (the execution status of this line is deduced): value += c; | - |
148 | ++pos; executed (the execution status of this line is deduced): ++pos; | - |
149 | } executed: } Execution Count:142 | 142 |
150 | } executed: } Execution Count:43 | 43 |
151 | | - |
152 | result.insert(key, value); executed (the execution status of this line is deduced): result.insert(key, value); | - |
153 | | - |
154 | // find the comma now: | - |
155 | comma = header.indexOf(',', pos); executed (the execution status of this line is deduced): comma = header.indexOf(',', pos); | - |
156 | if (comma == -1) evaluated: comma == -1 yes Evaluation Count:28 | yes Evaluation Count:15 |
| 15-28 |
157 | return result; // end of parsing executed: return result; Execution Count:28 | 28 |
158 | pos = comma + 1; executed (the execution status of this line is deduced): pos = comma + 1; | - |
159 | } else { executed: } Execution Count:15 | 15 |
160 | // case: token | - |
161 | // key is already set | - |
162 | result.insert(key, QByteArray()); executed (the execution status of this line is deduced): result.insert(key, QByteArray()); | - |
163 | } executed: } Execution Count:26 | 26 |
164 | } | - |
165 | } | 0 |
166 | | - |
167 | QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager, | - |
168 | const QNetworkRequest& request, | - |
169 | QNetworkAccessManager::Operation& operation, | - |
170 | QIODevice* outgoingData) | - |
171 | : QNetworkReply(*new QNetworkReplyHttpImplPrivate, manager) | - |
172 | { | - |
173 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
174 | d->manager = manager; executed (the execution status of this line is deduced): d->manager = manager; | - |
175 | d->managerPrivate = manager->d_func(); executed (the execution status of this line is deduced): d->managerPrivate = manager->d_func(); | - |
176 | d->request = request; executed (the execution status of this line is deduced): d->request = request; | - |
177 | d->operation = operation; executed (the execution status of this line is deduced): d->operation = operation; | - |
178 | d->outgoingData = outgoingData; executed (the execution status of this line is deduced): d->outgoingData = outgoingData; | - |
179 | d->url = request.url(); executed (the execution status of this line is deduced): d->url = request.url(); | - |
180 | #ifndef QT_NO_SSL | - |
181 | d->sslConfiguration = request.sslConfiguration(); executed (the execution status of this line is deduced): d->sslConfiguration = request.sslConfiguration(); | - |
182 | #endif | - |
183 | | - |
184 | // FIXME Later maybe set to Unbuffered, especially if it is zerocopy or from cache? | - |
185 | QIODevice::open(QIODevice::ReadOnly); executed (the execution status of this line is deduced): QIODevice::open(QIODevice::ReadOnly); | - |
186 | | - |
187 | | - |
188 | // Internal code that does a HTTP reply for the synchronous Ajax | - |
189 | // in Qt WebKit. | - |
190 | QVariant synchronousHttpAttribute = request.attribute( executed (the execution status of this line is deduced): QVariant synchronousHttpAttribute = request.attribute( | - |
191 | static_cast<QNetworkRequest::Attribute>(QNetworkRequest::SynchronousRequestAttribute)); executed (the execution status of this line is deduced): static_cast<QNetworkRequest::Attribute>(QNetworkRequest::SynchronousRequestAttribute)); | - |
192 | if (synchronousHttpAttribute.isValid()) { evaluated: synchronousHttpAttribute.isValid() yes Evaluation Count:76 | yes Evaluation Count:637 |
| 76-637 |
193 | d->synchronous = synchronousHttpAttribute.toBool(); executed (the execution status of this line is deduced): d->synchronous = synchronousHttpAttribute.toBool(); | - |
194 | if (d->synchronous && outgoingData) { partially evaluated: d->synchronous yes Evaluation Count:76 | no Evaluation Count:0 |
evaluated: outgoingData yes Evaluation Count:41 | yes Evaluation Count:35 |
| 0-76 |
195 | // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer. | - |
196 | // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway. | - |
197 | d->outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); executed (the execution status of this line is deduced): d->outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); | - |
198 | qint64 previousDataSize = 0; executed (the execution status of this line is deduced): qint64 previousDataSize = 0; | - |
199 | do { | - |
200 | previousDataSize = d->outgoingDataBuffer->size(); executed (the execution status of this line is deduced): previousDataSize = d->outgoingDataBuffer->size(); | - |
201 | d->outgoingDataBuffer->append(d->outgoingData->readAll()); executed (the execution status of this line is deduced): d->outgoingDataBuffer->append(d->outgoingData->readAll()); | - |
202 | } while (d->outgoingDataBuffer->size() != previousDataSize); executed: } Execution Count:77 evaluated: d->outgoingDataBuffer->size() != previousDataSize yes Evaluation Count:36 | yes Evaluation Count:41 |
| 36-77 |
203 | d->_q_startOperation(); executed (the execution status of this line is deduced): d->_q_startOperation(); | - |
204 | return; executed: return; Execution Count:41 | 41 |
205 | } | - |
206 | } executed: } Execution Count:35 | 35 |
207 | | - |
208 | | - |
209 | if (outgoingData) { evaluated: outgoingData yes Evaluation Count:138 | yes Evaluation Count:534 |
| 138-534 |
210 | // there is data to be uploaded, e.g. HTTP POST. | - |
211 | | - |
212 | if (!d->outgoingData->isSequential()) { evaluated: !d->outgoingData->isSequential() yes Evaluation Count:77 | yes Evaluation Count:61 |
| 61-77 |
213 | // fixed size non-sequential (random-access) | - |
214 | // just start the operation | - |
215 | QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); | - |
216 | // FIXME make direct call? | - |
217 | } else { executed: } Execution Count:77 | 77 |
218 | bool bufferingDisallowed = executed (the execution status of this line is deduced): bool bufferingDisallowed = | - |
219 | request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, executed (the execution status of this line is deduced): request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, | - |
220 | false).toBool(); executed (the execution status of this line is deduced): false).toBool(); | - |
221 | | - |
222 | if (bufferingDisallowed) { evaluated: bufferingDisallowed yes Evaluation Count:1 | yes Evaluation Count:60 |
| 1-60 |
223 | // if a valid content-length header for the request was supplied, we can disable buffering | - |
224 | // if not, we will buffer anyway | - |
225 | if (request.header(QNetworkRequest::ContentLengthHeader).isValid()) { partially evaluated: request.header(QNetworkRequest::ContentLengthHeader).isValid() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
226 | QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); | - |
227 | // FIXME make direct call? | - |
228 | } else { executed: } Execution Count:1 | 1 |
229 | d->state = d->Buffering; never executed (the execution status of this line is deduced): d->state = d->Buffering; | - |
230 | QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); | - |
231 | } | 0 |
232 | } else { | - |
233 | // _q_startOperation will be called when the buffering has finished. | - |
234 | d->state = d->Buffering; executed (the execution status of this line is deduced): d->state = d->Buffering; | - |
235 | QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); | - |
236 | } executed: } Execution Count:60 | 60 |
237 | } | - |
238 | } else { | - |
239 | // No outgoing data (POST, ..) | - |
240 | d->_q_startOperation(); executed (the execution status of this line is deduced): d->_q_startOperation(); | - |
241 | } executed: } Execution Count:534 | 534 |
242 | } | - |
243 | | - |
244 | QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() | - |
245 | { | - |
246 | // Most work is done in private destructor | - |
247 | } | - |
248 | | - |
249 | void QNetworkReplyHttpImpl::close() | - |
250 | { | - |
251 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
252 | | - |
253 | if (d->state == QNetworkReplyHttpImplPrivate::Aborted || partially evaluated: d->state == QNetworkReplyHttpImplPrivate::Aborted no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
254 | d->state == QNetworkReplyHttpImplPrivate::Finished) partially evaluated: d->state == QNetworkReplyHttpImplPrivate::Finished no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
255 | return; | 0 |
256 | | - |
257 | // According to the documentation close only stops the download | - |
258 | // by closing we can ignore the download part and continue uploading. | - |
259 | QNetworkReply::close(); executed (the execution status of this line is deduced): QNetworkReply::close(); | - |
260 | | - |
261 | // call finished which will emit signals | - |
262 | // FIXME shouldn't this be emitted Queued? | - |
263 | d->error(OperationCanceledError, tr("Operation canceled")); executed (the execution status of this line is deduced): d->error(OperationCanceledError, tr("Operation canceled")); | - |
264 | d->finished(); executed (the execution status of this line is deduced): d->finished(); | - |
265 | } executed: } Execution Count:1 | 1 |
266 | | - |
267 | void QNetworkReplyHttpImpl::abort() | - |
268 | { | - |
269 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
270 | // FIXME | - |
271 | if (d->state == QNetworkReplyHttpImplPrivate::Finished || d->state == QNetworkReplyHttpImplPrivate::Aborted) evaluated: d->state == QNetworkReplyHttpImplPrivate::Finished yes Evaluation Count:1 | yes Evaluation Count:2 |
partially evaluated: d->state == QNetworkReplyHttpImplPrivate::Aborted no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
272 | return; executed: return; Execution Count:1 | 1 |
273 | | - |
274 | QNetworkReply::close(); executed (the execution status of this line is deduced): QNetworkReply::close(); | - |
275 | | - |
276 | if (d->state != QNetworkReplyHttpImplPrivate::Finished) { partially evaluated: d->state != QNetworkReplyHttpImplPrivate::Finished yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
277 | // call finished which will emit signals | - |
278 | // FIXME shouldn't this be emitted Queued? | - |
279 | d->error(OperationCanceledError, tr("Operation canceled")); executed (the execution status of this line is deduced): d->error(OperationCanceledError, tr("Operation canceled")); | - |
280 | d->finished(); executed (the execution status of this line is deduced): d->finished(); | - |
281 | } executed: } Execution Count:2 | 2 |
282 | | - |
283 | d->state = QNetworkReplyHttpImplPrivate::Aborted; executed (the execution status of this line is deduced): d->state = QNetworkReplyHttpImplPrivate::Aborted; | - |
284 | | - |
285 | emit abortHttpRequest(); executed (the execution status of this line is deduced): abortHttpRequest(); | - |
286 | } executed: } Execution Count:2 | 2 |
287 | | - |
288 | qint64 QNetworkReplyHttpImpl::bytesAvailable() const | - |
289 | { | - |
290 | Q_D(const QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): const QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
291 | | - |
292 | // if we load from cache device | - |
293 | if (d->cacheLoadDevice) { partially evaluated: d->cacheLoadDevice no Evaluation Count:0 | yes Evaluation Count:5095 |
| 0-5095 |
294 | return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable() + d->downloadMultiBuffer.byteAmount(); never executed: return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable() + d->downloadMultiBuffer.byteAmount(); | 0 |
295 | } | - |
296 | | - |
297 | // zerocopy buffer | - |
298 | if (d->downloadZerocopyBuffer) { evaluated: d->downloadZerocopyBuffer yes Evaluation Count:2384 | yes Evaluation Count:2711 |
| 2384-2711 |
299 | return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition; executed: return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition; Execution Count:2384 | 2384 |
300 | } | - |
301 | | - |
302 | // normal buffer | - |
303 | return QNetworkReply::bytesAvailable() + d->downloadMultiBuffer.byteAmount(); executed: return QNetworkReply::bytesAvailable() + d->downloadMultiBuffer.byteAmount(); Execution Count:2711 | 2711 |
304 | } | - |
305 | | - |
306 | bool QNetworkReplyHttpImpl::isSequential () const | - |
307 | { | - |
308 | // FIXME In the cache of a cached load or the zero-copy buffer we could actually be non-sequential. | - |
309 | // FIXME however this requires us to implement stuff like seek() too. | - |
310 | return true; executed: return true; Execution Count:467 | 467 |
311 | } | - |
312 | | - |
313 | qint64 QNetworkReplyHttpImpl::size() const | - |
314 | { | - |
315 | // FIXME At some point, this could return a proper value, e.g. if we're non-sequential. | - |
316 | return QNetworkReply::size(); executed: return QNetworkReply::size(); Execution Count:67 | 67 |
317 | } | - |
318 | | - |
319 | qint64 QNetworkReplyHttpImpl::readData(char* data, qint64 maxlen) | - |
320 | { | - |
321 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
322 | | - |
323 | // cacheload device | - |
324 | if (d->cacheLoadDevice) { partially evaluated: d->cacheLoadDevice no Evaluation Count:0 | yes Evaluation Count:4107 |
| 0-4107 |
325 | // FIXME bytesdownloaded, position etc? | - |
326 | | - |
327 | // There is something already in the buffer we buffered before because the user did not read() | - |
328 | // anything, so we read there first: | - |
329 | if (!d->downloadMultiBuffer.isEmpty()) { never evaluated: !d->downloadMultiBuffer.isEmpty() | 0 |
330 | return d->downloadMultiBuffer.read(data, maxlen); never executed: return d->downloadMultiBuffer.read(data, maxlen); | 0 |
331 | } | - |
332 | | - |
333 | qint64 ret = d->cacheLoadDevice->read(data, maxlen); never executed (the execution status of this line is deduced): qint64 ret = d->cacheLoadDevice->read(data, maxlen); | - |
334 | return ret; never executed: return ret; | 0 |
335 | } | - |
336 | | - |
337 | // zerocopy buffer | - |
338 | if (d->downloadZerocopyBuffer) { evaluated: d->downloadZerocopyBuffer yes Evaluation Count:1352 | yes Evaluation Count:2755 |
| 1352-2755 |
339 | // FIXME bytesdownloaded, position etc? | - |
340 | | - |
341 | qint64 howMuch = qMin(maxlen, (d->downloadBufferCurrentSize - d->downloadBufferReadPosition)); executed (the execution status of this line is deduced): qint64 howMuch = qMin(maxlen, (d->downloadBufferCurrentSize - d->downloadBufferReadPosition)); | - |
342 | memcpy(data, d->downloadZerocopyBuffer + d->downloadBufferReadPosition, howMuch); executed (the execution status of this line is deduced): memcpy(data, d->downloadZerocopyBuffer + d->downloadBufferReadPosition, howMuch); | - |
343 | d->downloadBufferReadPosition += howMuch; executed (the execution status of this line is deduced): d->downloadBufferReadPosition += howMuch; | - |
344 | return howMuch; executed: return howMuch; Execution Count:1352 | 1352 |
345 | | - |
346 | } | - |
347 | | - |
348 | // normal buffer | - |
349 | if (d->downloadMultiBuffer.isEmpty()) { evaluated: d->downloadMultiBuffer.isEmpty() yes Evaluation Count:1613 | yes Evaluation Count:1142 |
| 1142-1613 |
350 | if (d->state == d->Finished || d->state == d->Aborted) evaluated: d->state == d->Finished yes Evaluation Count:350 | yes Evaluation Count:1263 |
partially evaluated: d->state == d->Aborted no Evaluation Count:0 | yes Evaluation Count:1263 |
| 0-1263 |
351 | return -1; executed: return -1; Execution Count:350 | 350 |
352 | return 0; executed: return 0; Execution Count:1263 | 1263 |
353 | } | - |
354 | | - |
355 | if (maxlen == 1) { partially evaluated: maxlen == 1 no Evaluation Count:0 | yes Evaluation Count:1142 |
| 0-1142 |
356 | // optimization for getChar() | - |
357 | *data = d->downloadMultiBuffer.getChar(); never executed (the execution status of this line is deduced): *data = d->downloadMultiBuffer.getChar(); | - |
358 | if (readBufferSize()) never evaluated: readBufferSize() | 0 |
359 | emit readBufferFreed(1); never executed: readBufferFreed(1); | 0 |
360 | return 1; never executed: return 1; | 0 |
361 | } | - |
362 | | - |
363 | maxlen = qMin<qint64>(maxlen, d->downloadMultiBuffer.byteAmount()); executed (the execution status of this line is deduced): maxlen = qMin<qint64>(maxlen, d->downloadMultiBuffer.byteAmount()); | - |
364 | qint64 bytesRead = d->downloadMultiBuffer.read(data, maxlen); executed (the execution status of this line is deduced): qint64 bytesRead = d->downloadMultiBuffer.read(data, maxlen); | - |
365 | if (readBufferSize()) evaluated: readBufferSize() yes Evaluation Count:883 | yes Evaluation Count:259 |
| 259-883 |
366 | emit readBufferFreed(bytesRead); executed: readBufferFreed(bytesRead); Execution Count:883 | 883 |
367 | return bytesRead; executed: return bytesRead; Execution Count:1142 | 1142 |
368 | } | - |
369 | | - |
370 | void QNetworkReplyHttpImpl::setReadBufferSize(qint64 size) | - |
371 | { | - |
372 | QNetworkReply::setReadBufferSize(size); executed (the execution status of this line is deduced): QNetworkReply::setReadBufferSize(size); | - |
373 | emit readBufferSizeChanged(size); executed (the execution status of this line is deduced): readBufferSizeChanged(size); | - |
374 | return; executed: return; Execution Count:10 | 10 |
375 | } | - |
376 | | - |
377 | bool QNetworkReplyHttpImpl::canReadLine () const | - |
378 | { | - |
379 | Q_D(const QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): const QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
380 | | - |
381 | if (QNetworkReply::canReadLine()) evaluated: QNetworkReply::canReadLine() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
382 | return true; executed: return true; Execution Count:1 | 1 |
383 | | - |
384 | if (d->cacheLoadDevice) partially evaluated: d->cacheLoadDevice no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
385 | return d->cacheLoadDevice->canReadLine() || d->downloadMultiBuffer.canReadLine(); never executed: return d->cacheLoadDevice->canReadLine() || d->downloadMultiBuffer.canReadLine(); | 0 |
386 | | - |
387 | if (d->downloadZerocopyBuffer) partially evaluated: d->downloadZerocopyBuffer yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
388 | return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition); executed: return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition); Execution Count:5 | 5 |
389 | | - |
390 | return d->downloadMultiBuffer.canReadLine(); never executed: return d->downloadMultiBuffer.canReadLine(); | 0 |
391 | } | - |
392 | | - |
393 | #ifndef QT_NO_SSL | - |
394 | void QNetworkReplyHttpImpl::ignoreSslErrors() | - |
395 | { | - |
396 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
397 | | - |
398 | d->pendingIgnoreAllSslErrors = true; executed (the execution status of this line is deduced): d->pendingIgnoreAllSslErrors = true; | - |
399 | } executed: } Execution Count:24 | 24 |
400 | | - |
401 | void QNetworkReplyHttpImpl::ignoreSslErrorsImplementation(const QList<QSslError> &errors) | - |
402 | { | - |
403 | Q_D(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
404 | | - |
405 | // the pending list is set if QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors) | - |
406 | // is called before QNetworkAccessManager::get() (or post(), etc.) | - |
407 | d->pendingIgnoreSslErrorsList = errors; executed (the execution status of this line is deduced): d->pendingIgnoreSslErrorsList = errors; | - |
408 | } executed: } Execution Count:10 | 10 |
409 | | - |
410 | void QNetworkReplyHttpImpl::setSslConfigurationImplementation(const QSslConfiguration &newconfig) | - |
411 | { | - |
412 | // Setting a SSL configuration on a reply is not supported. The user needs to set | - |
413 | // her/his QSslConfiguration on the QNetworkRequest. | - |
414 | Q_UNUSED(newconfig); never executed (the execution status of this line is deduced): (void)newconfig;; | - |
415 | } | 0 |
416 | | - |
417 | void QNetworkReplyHttpImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const | - |
418 | { | - |
419 | Q_D(const QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): const QNetworkReplyHttpImplPrivate * const d = d_func(); | - |
420 | configuration = d->sslConfiguration; executed (the execution status of this line is deduced): configuration = d->sslConfiguration; | - |
421 | } executed: } Execution Count:21 | 21 |
422 | #endif | - |
423 | | - |
424 | QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate() | - |
425 | : QNetworkReplyPrivate() | - |
426 | , manager(0) | - |
427 | , managerPrivate(0) | - |
428 | , synchronous(false) | - |
429 | , state(Idle) | - |
430 | , statusCode(0) | - |
431 | , outgoingData(0) | - |
432 | , bytesUploaded(-1) | - |
433 | , cacheLoadDevice(0) | - |
434 | , loadingFromCache(false) | - |
435 | , cacheSaveDevice(0) | - |
436 | , cacheEnabled(false) | - |
437 | , resumeOffset(0) | - |
438 | , preMigrationDownloaded(-1) | - |
439 | , bytesDownloaded(0) | - |
440 | , downloadBufferReadPosition(0) | - |
441 | , downloadBufferCurrentSize(0) | - |
442 | , downloadZerocopyBuffer(0) | - |
443 | , pendingDownloadDataEmissions(new QAtomicInt()) | - |
444 | , pendingDownloadProgressEmissions(new QAtomicInt()) | - |
445 | #ifndef QT_NO_SSL | - |
446 | , pendingIgnoreAllSslErrors(false) | - |
447 | #endif | - |
448 | | - |
449 | { | - |
450 | } executed: } Execution Count:713 | 713 |
451 | | - |
452 | QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate() | - |
453 | { | - |
454 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
455 | // This will do nothing if the request was already finished or aborted | - |
456 | emit q->abortHttpRequest(); executed (the execution status of this line is deduced): q->abortHttpRequest(); | - |
457 | } executed: } Execution Count:713 | 713 |
458 | | - |
459 | /* | - |
460 | For a given httpRequest | - |
461 | 1) If AlwaysNetwork, return | - |
462 | 2) If we have a cache entry for this url populate headers so the server can return 304 | - |
463 | 3) Calculate if response_is_fresh and if so send the cache and set loadedFromCache to true | - |
464 | */ | - |
465 | bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &httpRequest) | - |
466 | { | - |
467 | QNetworkRequest::CacheLoadControl CacheLoadControlAttribute = executed (the execution status of this line is deduced): QNetworkRequest::CacheLoadControl CacheLoadControlAttribute = | - |
468 | (QNetworkRequest::CacheLoadControl)request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(); executed (the execution status of this line is deduced): (QNetworkRequest::CacheLoadControl)request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(); | - |
469 | if (CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork) { evaluated: CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork yes Evaluation Count:12 | yes Evaluation Count:507 |
| 12-507 |
470 | // If the request does not already specify preferred cache-control | - |
471 | // force reload from the network and tell any caching proxy servers to reload too | - |
472 | if (!request.rawHeaderList().contains("Cache-Control")) { partially evaluated: !request.rawHeaderList().contains("Cache-Control") yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
473 | httpRequest.setHeaderField("Cache-Control", "no-cache"); executed (the execution status of this line is deduced): httpRequest.setHeaderField("Cache-Control", "no-cache"); | - |
474 | httpRequest.setHeaderField("Pragma", "no-cache"); executed (the execution status of this line is deduced): httpRequest.setHeaderField("Pragma", "no-cache"); | - |
475 | } executed: } Execution Count:12 | 12 |
476 | return false; executed: return false; Execution Count:12 | 12 |
477 | } | - |
478 | | - |
479 | // The disk cache API does not currently support partial content retrieval. | - |
480 | // That is why we don't use the disk cache for any such requests. | - |
481 | if (request.hasRawHeader("Range")) evaluated: request.hasRawHeader("Range") yes Evaluation Count:2 | yes Evaluation Count:505 |
| 2-505 |
482 | return false; executed: return false; Execution Count:2 | 2 |
483 | | - |
484 | QAbstractNetworkCache *nc = managerPrivate->networkCache; executed (the execution status of this line is deduced): QAbstractNetworkCache *nc = managerPrivate->networkCache; | - |
485 | if (!nc) evaluated: !nc yes Evaluation Count:419 | yes Evaluation Count:86 |
| 86-419 |
486 | return false; // no local cache executed: return false; Execution Count:419 | 419 |
487 | | - |
488 | QNetworkCacheMetaData metaData = nc->metaData(request.url()); executed (the execution status of this line is deduced): QNetworkCacheMetaData metaData = nc->metaData(request.url()); | - |
489 | if (!metaData.isValid()) evaluated: !metaData.isValid() yes Evaluation Count:50 | yes Evaluation Count:36 |
| 36-50 |
490 | return false; // not in cache executed: return false; Execution Count:50 | 50 |
491 | | - |
492 | if (!metaData.saveToDisk()) partially evaluated: !metaData.saveToDisk() no Evaluation Count:0 | yes Evaluation Count:36 |
| 0-36 |
493 | return false; never executed: return false; | 0 |
494 | | - |
495 | QNetworkHeadersPrivate cacheHeaders; executed (the execution status of this line is deduced): QNetworkHeadersPrivate cacheHeaders; | - |
496 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; executed (the execution status of this line is deduced): QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - |
497 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); executed (the execution status of this line is deduced): cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - |
498 | | - |
499 | it = cacheHeaders.findRawHeader("etag"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("etag"); | - |
500 | if (it != cacheHeaders.rawHeaders.constEnd()) evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:4 | yes Evaluation Count:32 |
| 4-32 |
501 | httpRequest.setHeaderField("If-None-Match", it->second); executed: httpRequest.setHeaderField("If-None-Match", it->second); Execution Count:4 | 4 |
502 | | - |
503 | QDateTime lastModified = metaData.lastModified(); executed (the execution status of this line is deduced): QDateTime lastModified = metaData.lastModified(); | - |
504 | if (lastModified.isValid()) evaluated: lastModified.isValid() yes Evaluation Count:22 | yes Evaluation Count:14 |
| 14-22 |
505 | httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); executed: httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); Execution Count:22 | 22 |
506 | | - |
507 | it = cacheHeaders.findRawHeader("Cache-Control"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("Cache-Control"); | - |
508 | if (it != cacheHeaders.rawHeaders.constEnd()) { evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:22 | yes Evaluation Count:14 |
| 14-22 |
509 | QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); executed (the execution status of this line is deduced): QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); | - |
510 | if (cacheControl.contains("must-revalidate")) evaluated: cacheControl.contains("must-revalidate") yes Evaluation Count:6 | yes Evaluation Count:16 |
| 6-16 |
511 | return false; executed: return false; Execution Count:6 | 6 |
512 | } executed: } Execution Count:16 | 16 |
513 | | - |
514 | QDateTime currentDateTime = QDateTime::currentDateTime(); executed (the execution status of this line is deduced): QDateTime currentDateTime = QDateTime::currentDateTime(); | - |
515 | QDateTime expirationDate = metaData.expirationDate(); executed (the execution status of this line is deduced): QDateTime expirationDate = metaData.expirationDate(); | - |
516 | | - |
517 | bool response_is_fresh; executed (the execution status of this line is deduced): bool response_is_fresh; | - |
518 | if (!expirationDate.isValid()) { evaluated: !expirationDate.isValid() yes Evaluation Count:8 | yes Evaluation Count:22 |
| 8-22 |
519 | /* | - |
520 | * age_value | - |
521 | * is the value of Age: header received by the cache with | - |
522 | * this response. | - |
523 | * date_value | - |
524 | * is the value of the origin server's Date: header | - |
525 | * request_time | - |
526 | * is the (local) time when the cache made the request | - |
527 | * that resulted in this cached response | - |
528 | * response_time | - |
529 | * is the (local) time when the cache received the | - |
530 | * response | - |
531 | * now | - |
532 | * is the current (local) time | - |
533 | */ | - |
534 | int age_value = 0; executed (the execution status of this line is deduced): int age_value = 0; | - |
535 | it = cacheHeaders.findRawHeader("age"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("age"); | - |
536 | if (it != cacheHeaders.rawHeaders.constEnd()) partially evaluated: it != cacheHeaders.rawHeaders.constEnd() no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
537 | age_value = it->second.toInt(); never executed: age_value = it->second.toInt(); | 0 |
538 | | - |
539 | QDateTime dateHeader; executed (the execution status of this line is deduced): QDateTime dateHeader; | - |
540 | int date_value = 0; executed (the execution status of this line is deduced): int date_value = 0; | - |
541 | it = cacheHeaders.findRawHeader("date"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("date"); | - |
542 | if (it != cacheHeaders.rawHeaders.constEnd()) { partially evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
543 | dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second); executed (the execution status of this line is deduced): dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second); | - |
544 | date_value = dateHeader.toTime_t(); executed (the execution status of this line is deduced): date_value = dateHeader.toTime_t(); | - |
545 | } executed: } Execution Count:8 | 8 |
546 | | - |
547 | int now = currentDateTime.toUTC().toTime_t(); executed (the execution status of this line is deduced): int now = currentDateTime.toUTC().toTime_t(); | - |
548 | int request_time = now; executed (the execution status of this line is deduced): int request_time = now; | - |
549 | int response_time = now; executed (the execution status of this line is deduced): int response_time = now; | - |
550 | | - |
551 | // Algorithm from RFC 2616 section 13.2.3 | - |
552 | int apparent_age = qMax(0, response_time - date_value); executed (the execution status of this line is deduced): int apparent_age = qMax(0, response_time - date_value); | - |
553 | int corrected_received_age = qMax(apparent_age, age_value); executed (the execution status of this line is deduced): int corrected_received_age = qMax(apparent_age, age_value); | - |
554 | int response_delay = response_time - request_time; executed (the execution status of this line is deduced): int response_delay = response_time - request_time; | - |
555 | int corrected_initial_age = corrected_received_age + response_delay; executed (the execution status of this line is deduced): int corrected_initial_age = corrected_received_age + response_delay; | - |
556 | int resident_time = now - response_time; executed (the execution status of this line is deduced): int resident_time = now - response_time; | - |
557 | int current_age = corrected_initial_age + resident_time; executed (the execution status of this line is deduced): int current_age = corrected_initial_age + resident_time; | - |
558 | | - |
559 | // RFC 2616 13.2.4 Expiration Calculations | - |
560 | if (!expirationDate.isValid()) { partially evaluated: !expirationDate.isValid() yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
561 | if (lastModified.isValid()) { evaluated: lastModified.isValid() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
562 | int diff = currentDateTime.secsTo(lastModified); executed (the execution status of this line is deduced): int diff = currentDateTime.secsTo(lastModified); | - |
563 | expirationDate = lastModified; executed (the execution status of this line is deduced): expirationDate = lastModified; | - |
564 | expirationDate.addSecs(diff / 10); executed (the execution status of this line is deduced): expirationDate.addSecs(diff / 10); | - |
565 | if (httpRequest.headerField("Warning").isEmpty()) { partially evaluated: httpRequest.headerField("Warning").isEmpty() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
566 | QDateTime dt; executed (the execution status of this line is deduced): QDateTime dt; | - |
567 | dt.setTime_t(current_age); executed (the execution status of this line is deduced): dt.setTime_t(current_age); | - |
568 | if (dt.daysTo(currentDateTime) > 1) partially evaluated: dt.daysTo(currentDateTime) > 1 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
569 | httpRequest.setHeaderField("Warning", "113"); executed: httpRequest.setHeaderField("Warning", "113"); Execution Count:4 | 4 |
570 | } executed: } Execution Count:4 | 4 |
571 | } executed: } Execution Count:4 | 4 |
572 | } executed: } Execution Count:8 | 8 |
573 | | - |
574 | // the cache-saving code below sets the expirationDate with date+max_age | - |
575 | // if "max-age" is present, or to Expires otherwise | - |
576 | int freshness_lifetime = dateHeader.secsTo(expirationDate); executed (the execution status of this line is deduced): int freshness_lifetime = dateHeader.secsTo(expirationDate); | - |
577 | response_is_fresh = (freshness_lifetime > current_age); executed (the execution status of this line is deduced): response_is_fresh = (freshness_lifetime > current_age); | - |
578 | } else { executed: } Execution Count:8 | 8 |
579 | // expiration date was calculated earlier (e.g. when storing object to the cache) | - |
580 | response_is_fresh = currentDateTime.secsTo(expirationDate) >= 0; executed (the execution status of this line is deduced): response_is_fresh = currentDateTime.secsTo(expirationDate) >= 0; | - |
581 | } executed: } Execution Count:22 | 22 |
582 | | - |
583 | if (!response_is_fresh) evaluated: !response_is_fresh yes Evaluation Count:16 | yes Evaluation Count:14 |
| 14-16 |
584 | return false; executed: return false; Execution Count:16 | 16 |
585 | | - |
586 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
587 | qDebug() << "response_is_fresh" << CacheLoadControlAttribute; | - |
588 | #endif | - |
589 | return sendCacheContents(metaData); executed: return sendCacheContents(metaData); Execution Count:14 | 14 |
590 | } | - |
591 | | - |
592 | QHttpNetworkRequest::Priority QNetworkReplyHttpImplPrivate::convert(const QNetworkRequest::Priority& prio) | - |
593 | { | - |
594 | switch (prio) { | - |
595 | case QNetworkRequest::LowPriority: | - |
596 | return QHttpNetworkRequest::LowPriority; never executed: return QHttpNetworkRequest::LowPriority; | 0 |
597 | case QNetworkRequest::HighPriority: | - |
598 | return QHttpNetworkRequest::HighPriority; never executed: return QHttpNetworkRequest::HighPriority; | 0 |
599 | case QNetworkRequest::NormalPriority: | - |
600 | default: | - |
601 | return QHttpNetworkRequest::NormalPriority; executed: return QHttpNetworkRequest::NormalPriority; Execution Count:709 | 709 |
602 | } | - |
603 | } | 0 |
604 | | - |
605 | void QNetworkReplyHttpImplPrivate::postRequest() | - |
606 | { | - |
607 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
608 | | - |
609 | QThread *thread = 0; executed (the execution status of this line is deduced): QThread *thread = 0; | - |
610 | if (synchronous) { evaluated: synchronous yes Evaluation Count:76 | yes Evaluation Count:636 |
| 76-636 |
611 | // A synchronous HTTP request uses its own thread | - |
612 | thread = new QThread(); executed (the execution status of this line is deduced): thread = new QThread(); | - |
613 | thread->setObjectName(QStringLiteral("httpReply")); executed (the execution status of this line is deduced): thread->setObjectName(QString::fromUtf8("" "httpReply" "", sizeof("httpReply") - 1)); | - |
614 | QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); executed (the execution status of this line is deduced): QObject::connect(thread, "2""finished()", thread, "1""deleteLater()"); | - |
615 | thread->start(); executed (the execution status of this line is deduced): thread->start(); | - |
616 | } else if (!managerPrivate->httpThread) { executed: } Execution Count:76 evaluated: !managerPrivate->httpThread yes Evaluation Count:436 | yes Evaluation Count:200 |
| 76-436 |
617 | // We use the manager-global thread. | - |
618 | // At some point we could switch to having multiple threads if it makes sense. | - |
619 | managerPrivate->httpThread = new QThread(); executed (the execution status of this line is deduced): managerPrivate->httpThread = new QThread(); | - |
620 | managerPrivate->httpThread->setObjectName(QStringLiteral("httpThread")); executed (the execution status of this line is deduced): managerPrivate->httpThread->setObjectName(QString::fromUtf8("" "httpThread" "", sizeof("httpThread") - 1)); | - |
621 | managerPrivate->httpThread->start(); executed (the execution status of this line is deduced): managerPrivate->httpThread->start(); | - |
622 | | - |
623 | thread = managerPrivate->httpThread; executed (the execution status of this line is deduced): thread = managerPrivate->httpThread; | - |
624 | } else { executed: } Execution Count:436 | 436 |
625 | // Asynchronous request, thread already exists | - |
626 | thread = managerPrivate->httpThread; executed (the execution status of this line is deduced): thread = managerPrivate->httpThread; | - |
627 | } executed: } Execution Count:200 | 200 |
628 | | - |
629 | QUrl url = request.url(); executed (the execution status of this line is deduced): QUrl url = request.url(); | - |
630 | httpRequest.setUrl(url); executed (the execution status of this line is deduced): httpRequest.setUrl(url); | - |
631 | | - |
632 | bool ssl = url.scheme().toLower() == QLatin1String("https"); executed (the execution status of this line is deduced): bool ssl = url.scheme().toLower() == QLatin1String("https"); | - |
633 | q->setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, ssl); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, ssl); | - |
634 | httpRequest.setSsl(ssl); executed (the execution status of this line is deduced): httpRequest.setSsl(ssl); | - |
635 | | - |
636 | | - |
637 | #ifndef QT_NO_NETWORKPROXY | - |
638 | QNetworkProxy transparentProxy, cacheProxy; executed (the execution status of this line is deduced): QNetworkProxy transparentProxy, cacheProxy; | - |
639 | | - |
640 | // FIXME the proxy stuff should be done in the HTTP thread | - |
641 | foreach (const QNetworkProxy &p, managerPrivate->queryProxy(QNetworkProxyQuery(request.url()))) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(managerPrivate->queryProxy(QNetworkProxyQuery(request.url())))> _container_(managerPrivate->queryProxy(QNetworkProxyQuery(request.url()))); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QNetworkProxy &p = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
642 | // use the first proxy that works | - |
643 | // for non-encrypted connections, any transparent or HTTP proxy | - |
644 | // for encrypted, only transparent proxies | - |
645 | if (!ssl evaluated: !ssl yes Evaluation Count:625 | yes Evaluation Count:92 |
| 92-625 |
646 | && (p.capabilities() & QNetworkProxy::CachingCapability) evaluated: (p.capabilities() & QNetworkProxy::CachingCapability) yes Evaluation Count:60 | yes Evaluation Count:565 |
| 60-565 |
647 | && (p.type() == QNetworkProxy::HttpProxy || evaluated: p.type() == QNetworkProxy::HttpProxy yes Evaluation Count:49 | yes Evaluation Count:11 |
| 11-49 |
648 | p.type() == QNetworkProxy::HttpCachingProxy)) { evaluated: p.type() == QNetworkProxy::HttpCachingProxy yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
649 | cacheProxy = p; executed (the execution status of this line is deduced): cacheProxy = p; | - |
650 | transparentProxy = QNetworkProxy::NoProxy; executed (the execution status of this line is deduced): transparentProxy = QNetworkProxy::NoProxy; | - |
651 | break; executed: break; Execution Count:57 | 57 |
652 | } | - |
653 | if (p.isTransparentProxy()) { evaluated: p.isTransparentProxy() yes Evaluation Count:652 | yes Evaluation Count:8 |
| 8-652 |
654 | transparentProxy = p; executed (the execution status of this line is deduced): transparentProxy = p; | - |
655 | cacheProxy = QNetworkProxy::NoProxy; executed (the execution status of this line is deduced): cacheProxy = QNetworkProxy::NoProxy; | - |
656 | break; executed: break; Execution Count:652 | 652 |
657 | } | - |
658 | } executed: } Execution Count:8 | 8 |
659 | | - |
660 | // check if at least one of the proxies | - |
661 | if (transparentProxy.type() == QNetworkProxy::DefaultProxy && evaluated: transparentProxy.type() == QNetworkProxy::DefaultProxy yes Evaluation Count:3 | yes Evaluation Count:709 |
| 3-709 |
662 | cacheProxy.type() == QNetworkProxy::DefaultProxy) { partially evaluated: cacheProxy.type() == QNetworkProxy::DefaultProxy yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
663 | // unsuitable proxies | - |
664 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - |
665 | Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError), executed (the execution status of this line is deduced): QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::ProxyNotFoundError), | - |
666 | Q_ARG(QString, QNetworkReplyHttpImpl::tr("No suitable proxy found"))); executed (the execution status of this line is deduced): QArgument<QString >("QString", QNetworkReplyHttpImpl::tr("No suitable proxy found"))); | - |
667 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - |
668 | return; executed: return; Execution Count:3 | 3 |
669 | } | - |
670 | #endif | - |
671 | | - |
672 | | - |
673 | bool loadedFromCache = false; executed (the execution status of this line is deduced): bool loadedFromCache = false; | - |
674 | httpRequest.setPriority(convert(request.priority())); executed (the execution status of this line is deduced): httpRequest.setPriority(convert(request.priority())); | - |
675 | | - |
676 | switch (operation) { | - |
677 | case QNetworkAccessManager::GetOperation: | - |
678 | httpRequest.setOperation(QHttpNetworkRequest::Get); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Get); | - |
679 | loadedFromCache = loadFromCacheIfAllowed(httpRequest); executed (the execution status of this line is deduced): loadedFromCache = loadFromCacheIfAllowed(httpRequest); | - |
680 | break; executed: break; Execution Count:493 | 493 |
681 | | - |
682 | case QNetworkAccessManager::HeadOperation: | - |
683 | httpRequest.setOperation(QHttpNetworkRequest::Head); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Head); | - |
684 | loadedFromCache = loadFromCacheIfAllowed(httpRequest); executed (the execution status of this line is deduced): loadedFromCache = loadFromCacheIfAllowed(httpRequest); | - |
685 | break; executed: break; Execution Count:26 | 26 |
686 | | - |
687 | case QNetworkAccessManager::PostOperation: | - |
688 | invalidateCache(); executed (the execution status of this line is deduced): invalidateCache(); | - |
689 | httpRequest.setOperation(QHttpNetworkRequest::Post); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Post); | - |
690 | createUploadByteDevice(); executed (the execution status of this line is deduced): createUploadByteDevice(); | - |
691 | break; executed: break; Execution Count:142 | 142 |
692 | | - |
693 | case QNetworkAccessManager::PutOperation: | - |
694 | invalidateCache(); executed (the execution status of this line is deduced): invalidateCache(); | - |
695 | httpRequest.setOperation(QHttpNetworkRequest::Put); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Put); | - |
696 | createUploadByteDevice(); executed (the execution status of this line is deduced): createUploadByteDevice(); | - |
697 | break; executed: break; Execution Count:35 | 35 |
698 | | - |
699 | case QNetworkAccessManager::DeleteOperation: | - |
700 | invalidateCache(); executed (the execution status of this line is deduced): invalidateCache(); | - |
701 | httpRequest.setOperation(QHttpNetworkRequest::Delete); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Delete); | - |
702 | break; executed: break; Execution Count:7 | 7 |
703 | | - |
704 | case QNetworkAccessManager::CustomOperation: | - |
705 | invalidateCache(); // for safety reasons, we don't know what the operation does executed (the execution status of this line is deduced): invalidateCache(); | - |
706 | httpRequest.setOperation(QHttpNetworkRequest::Custom); executed (the execution status of this line is deduced): httpRequest.setOperation(QHttpNetworkRequest::Custom); | - |
707 | createUploadByteDevice(); executed (the execution status of this line is deduced): createUploadByteDevice(); | - |
708 | httpRequest.setCustomVerb(request.attribute( executed (the execution status of this line is deduced): httpRequest.setCustomVerb(request.attribute( | - |
709 | QNetworkRequest::CustomVerbAttribute).toByteArray()); executed (the execution status of this line is deduced): QNetworkRequest::CustomVerbAttribute).toByteArray()); | - |
710 | break; executed: break; Execution Count:6 | 6 |
711 | | - |
712 | default: | - |
713 | break; // can't happen | 0 |
714 | } | - |
715 | | - |
716 | if (loadedFromCache) { evaluated: loadedFromCache yes Evaluation Count:14 | yes Evaluation Count:695 |
| 14-695 |
717 | return; // no need to send the request! :) executed: return; Execution Count:14 | 14 |
718 | } | - |
719 | | - |
720 | QList<QByteArray> headers = request.rawHeaderList(); executed (the execution status of this line is deduced): QList<QByteArray> headers = request.rawHeaderList(); | - |
721 | if (resumeOffset != 0) { partially evaluated: resumeOffset != 0 no Evaluation Count:0 | yes Evaluation Count:695 |
| 0-695 |
722 | if (headers.contains("Range")) { never evaluated: headers.contains("Range") | 0 |
723 | // Need to adjust resume offset for user specified range | - |
724 | | - |
725 | headers.removeOne("Range"); never executed (the execution status of this line is deduced): headers.removeOne("Range"); | - |
726 | | - |
727 | // We've already verified that requestRange starts with "bytes=", see canResume. | - |
728 | QByteArray requestRange = request.rawHeader("Range").mid(6); never executed (the execution status of this line is deduced): QByteArray requestRange = request.rawHeader("Range").mid(6); | - |
729 | | - |
730 | int index = requestRange.indexOf('-'); never executed (the execution status of this line is deduced): int index = requestRange.indexOf('-'); | - |
731 | | - |
732 | quint64 requestStartOffset = requestRange.left(index).toULongLong(); never executed (the execution status of this line is deduced): quint64 requestStartOffset = requestRange.left(index).toULongLong(); | - |
733 | quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); never executed (the execution status of this line is deduced): quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); | - |
734 | | - |
735 | requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + never executed (the execution status of this line is deduced): requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + | - |
736 | '-' + QByteArray::number(requestEndOffset); never executed (the execution status of this line is deduced): '-' + QByteArray::number(requestEndOffset); | - |
737 | | - |
738 | httpRequest.setHeaderField("Range", requestRange); never executed (the execution status of this line is deduced): httpRequest.setHeaderField("Range", requestRange); | - |
739 | } else { | 0 |
740 | httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-'); never executed (the execution status of this line is deduced): httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-'); | - |
741 | } | 0 |
742 | } | - |
743 | | - |
744 | foreach (const QByteArray &header, headers) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(headers)> _container_(headers); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QByteArray &header = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
745 | httpRequest.setHeaderField(header, request.rawHeader(header)); executed: httpRequest.setHeaderField(header, request.rawHeader(header)); Execution Count:295 | 295 |
746 | | - |
747 | if (request.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true) evaluated: request.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true yes Evaluation Count:20 | yes Evaluation Count:675 |
| 20-675 |
748 | httpRequest.setPipeliningAllowed(true); executed: httpRequest.setPipeliningAllowed(true); Execution Count:20 | 20 |
749 | | - |
750 | if (static_cast<QNetworkRequest::LoadControl> evaluated: static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual yes Evaluation Count:1 | yes Evaluation Count:694 |
| 1-694 |
751 | (request.attribute(QNetworkRequest::AuthenticationReuseAttribute, evaluated: static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual yes Evaluation Count:1 | yes Evaluation Count:694 |
| 1-694 |
752 | QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual) evaluated: static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual yes Evaluation Count:1 | yes Evaluation Count:694 |
| 1-694 |
753 | httpRequest.setWithCredentials(false); executed: httpRequest.setWithCredentials(false); Execution Count:1 | 1 |
754 | | - |
755 | | - |
756 | // Create the HTTP thread delegate | - |
757 | QHttpThreadDelegate *delegate = new QHttpThreadDelegate; executed (the execution status of this line is deduced): QHttpThreadDelegate *delegate = new QHttpThreadDelegate; | - |
758 | #ifndef QT_NO_BEARERMANAGEMENT | - |
759 | delegate->networkSession = managerPrivate->getNetworkSession(); executed (the execution status of this line is deduced): delegate->networkSession = managerPrivate->getNetworkSession(); | - |
760 | #endif | - |
761 | | - |
762 | // For the synchronous HTTP, this is the normal way the delegate gets deleted | - |
763 | // For the asynchronous HTTP this is a safety measure, the delegate deletes itself when HTTP is finished | - |
764 | QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater())); executed (the execution status of this line is deduced): QObject::connect(thread, "2""finished()", delegate, "1""deleteLater()"); | - |
765 | | - |
766 | // Set the properties it needs | - |
767 | delegate->httpRequest = httpRequest; executed (the execution status of this line is deduced): delegate->httpRequest = httpRequest; | - |
768 | #ifndef QT_NO_NETWORKPROXY | - |
769 | delegate->cacheProxy = cacheProxy; executed (the execution status of this line is deduced): delegate->cacheProxy = cacheProxy; | - |
770 | delegate->transparentProxy = transparentProxy; executed (the execution status of this line is deduced): delegate->transparentProxy = transparentProxy; | - |
771 | #endif | - |
772 | delegate->ssl = ssl; executed (the execution status of this line is deduced): delegate->ssl = ssl; | - |
773 | #ifndef QT_NO_SSL | - |
774 | if (ssl) evaluated: ssl yes Evaluation Count:87 | yes Evaluation Count:608 |
| 87-608 |
775 | delegate->incomingSslConfiguration = request.sslConfiguration(); executed: delegate->incomingSslConfiguration = request.sslConfiguration(); Execution Count:87 | 87 |
776 | #endif | - |
777 | | - |
778 | // Do we use synchronous HTTP? | - |
779 | delegate->synchronous = synchronous; executed (the execution status of this line is deduced): delegate->synchronous = synchronous; | - |
780 | | - |
781 | // The authentication manager is used to avoid the BlockingQueuedConnection communication | - |
782 | // from HTTP thread to user thread in some cases. | - |
783 | delegate->authenticationManager = managerPrivate->authenticationManager; executed (the execution status of this line is deduced): delegate->authenticationManager = managerPrivate->authenticationManager; | - |
784 | | - |
785 | if (!synchronous) { evaluated: !synchronous yes Evaluation Count:619 | yes Evaluation Count:76 |
| 76-619 |
786 | // Tell our zerocopy policy to the delegate | - |
787 | QVariant downloadBufferMaximumSizeAttribute = request.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute); executed (the execution status of this line is deduced): QVariant downloadBufferMaximumSizeAttribute = request.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute); | - |
788 | if (downloadBufferMaximumSizeAttribute.isValid()) { evaluated: downloadBufferMaximumSizeAttribute.isValid() yes Evaluation Count:3 | yes Evaluation Count:616 |
| 3-616 |
789 | delegate->downloadBufferMaximumSize = downloadBufferMaximumSizeAttribute.toLongLong(); executed (the execution status of this line is deduced): delegate->downloadBufferMaximumSize = downloadBufferMaximumSizeAttribute.toLongLong(); | - |
790 | } else { executed: } Execution Count:3 | 3 |
791 | // If there is no MaximumDownloadBufferSizeAttribute set (which is for the majority | - |
792 | // of QNetworkRequest) then we can assume we'll do it anyway for small HTTP replies. | - |
793 | // This helps with performance and memory fragmentation. | - |
794 | delegate->downloadBufferMaximumSize = 128*1024; executed (the execution status of this line is deduced): delegate->downloadBufferMaximumSize = 128*1024; | - |
795 | } executed: } Execution Count:616 | 616 |
796 | | - |
797 | | - |
798 | // These atomic integers are used for signal compression | - |
799 | delegate->pendingDownloadData = pendingDownloadDataEmissions; executed (the execution status of this line is deduced): delegate->pendingDownloadData = pendingDownloadDataEmissions; | - |
800 | delegate->pendingDownloadProgress = pendingDownloadProgressEmissions; executed (the execution status of this line is deduced): delegate->pendingDownloadProgress = pendingDownloadProgressEmissions; | - |
801 | | - |
802 | // Connect the signals of the delegate to us | - |
803 | QObject::connect(delegate, SIGNAL(downloadData(QByteArray)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""downloadData(QByteArray)", | - |
804 | q, SLOT(replyDownloadData(QByteArray)), executed (the execution status of this line is deduced): q, "1""replyDownloadData(QByteArray)", | - |
805 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
806 | QObject::connect(delegate, SIGNAL(downloadFinished()), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""downloadFinished()", | - |
807 | q, SLOT(replyFinished()), executed (the execution status of this line is deduced): q, "1""replyFinished()", | - |
808 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
809 | QObject::connect(delegate, SIGNAL(downloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""downloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)", | - |
810 | q, SLOT(replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)), executed (the execution status of this line is deduced): q, "1""replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)", | - |
811 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
812 | QObject::connect(delegate, SIGNAL(downloadProgress(qint64,qint64)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""downloadProgress(qint64,qint64)", | - |
813 | q, SLOT(replyDownloadProgressSlot(qint64,qint64)), executed (the execution status of this line is deduced): q, "1""replyDownloadProgressSlot(qint64,qint64)", | - |
814 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
815 | QObject::connect(delegate, SIGNAL(error(QNetworkReply::NetworkError,QString)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""error(QNetworkReply::NetworkError,QString)", | - |
816 | q, SLOT(httpError(QNetworkReply::NetworkError,QString)), executed (the execution status of this line is deduced): q, "1""httpError(QNetworkReply::NetworkError,QString)", | - |
817 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
818 | #ifndef QT_NO_SSL | - |
819 | QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""sslConfigurationChanged(QSslConfiguration)", | - |
820 | q, SLOT(replySslConfigurationChanged(QSslConfiguration)), executed (the execution status of this line is deduced): q, "1""replySslConfigurationChanged(QSslConfiguration)", | - |
821 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
822 | #endif | - |
823 | // Those need to report back, therefire BlockingQueuedConnection | - |
824 | QObject::connect(delegate, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)", | - |
825 | q, SLOT(httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)), executed (the execution status of this line is deduced): q, "1""httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)", | - |
826 | Qt::BlockingQueuedConnection); executed (the execution status of this line is deduced): Qt::BlockingQueuedConnection); | - |
827 | #ifndef QT_NO_NETWORKPROXY | - |
828 | QObject::connect(delegate, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
829 | q, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), executed (the execution status of this line is deduced): q, "1""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)", | - |
830 | Qt::BlockingQueuedConnection); executed (the execution status of this line is deduced): Qt::BlockingQueuedConnection); | - |
831 | #endif | - |
832 | #ifndef QT_NO_SSL | - |
833 | QObject::connect(delegate, SIGNAL(sslErrors(QList<QSslError>,bool*,QList<QSslError>*)), executed (the execution status of this line is deduced): QObject::connect(delegate, "2""sslErrors(QList<QSslError>,bool*,QList<QSslError>*)", | - |
834 | q, SLOT(replySslErrors(QList<QSslError>,bool*,QList<QSslError>*)), executed (the execution status of this line is deduced): q, "1""replySslErrors(QList<QSslError>,bool*,QList<QSslError>*)", | - |
835 | Qt::BlockingQueuedConnection); executed (the execution status of this line is deduced): Qt::BlockingQueuedConnection); | - |
836 | #endif | - |
837 | // This signal we will use to start the request. | - |
838 | QObject::connect(q, SIGNAL(startHttpRequest()), delegate, SLOT(startRequest())); executed (the execution status of this line is deduced): QObject::connect(q, "2""startHttpRequest()", delegate, "1""startRequest()"); | - |
839 | QObject::connect(q, SIGNAL(abortHttpRequest()), delegate, SLOT(abortRequest())); executed (the execution status of this line is deduced): QObject::connect(q, "2""abortHttpRequest()", delegate, "1""abortRequest()"); | - |
840 | | - |
841 | // To throttle the connection. | - |
842 | QObject::connect(q, SIGNAL(readBufferSizeChanged(qint64)), delegate, SLOT(readBufferSizeChanged(qint64))); executed (the execution status of this line is deduced): QObject::connect(q, "2""readBufferSizeChanged(qint64)", delegate, "1""readBufferSizeChanged(qint64)"); | - |
843 | QObject::connect(q, SIGNAL(readBufferFreed(qint64)), delegate, SLOT(readBufferFreed(qint64))); executed (the execution status of this line is deduced): QObject::connect(q, "2""readBufferFreed(qint64)", delegate, "1""readBufferFreed(qint64)"); | - |
844 | | - |
845 | if (uploadByteDevice) { evaluated: uploadByteDevice yes Evaluation Count:138 | yes Evaluation Count:481 |
| 138-481 |
846 | QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice = executed (the execution status of this line is deduced): QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice = | - |
847 | new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size()); executed (the execution status of this line is deduced): new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size()); | - |
848 | if (uploadByteDevice->isResetDisabled()) evaluated: uploadByteDevice->isResetDisabled() yes Evaluation Count:1 | yes Evaluation Count:137 |
| 1-137 |
849 | forwardUploadDevice->disableReset(); executed: forwardUploadDevice->disableReset(); Execution Count:1 | 1 |
850 | forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread() executed (the execution status of this line is deduced): forwardUploadDevice->setParent(delegate); | - |
851 | delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); executed (the execution status of this line is deduced): delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); | - |
852 | | - |
853 | // From main thread to user thread: | - |
854 | QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)), executed (the execution status of this line is deduced): QObject::connect(q, "2""haveUploadData(QByteArray,bool,qint64)", | - |
855 | forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection); executed (the execution status of this line is deduced): forwardUploadDevice, "1""haveDataSlot(QByteArray,bool,qint64)", Qt::QueuedConnection); | - |
856 | QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()), executed (the execution status of this line is deduced): QObject::connect(uploadByteDevice.data(), "2""readyRead()", | - |
857 | forwardUploadDevice, SIGNAL(readyRead()), executed (the execution status of this line is deduced): forwardUploadDevice, "2""readyRead()", | - |
858 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
859 | | - |
860 | // From http thread to user thread: | - |
861 | QObject::connect(forwardUploadDevice, SIGNAL(wantData(qint64)), executed (the execution status of this line is deduced): QObject::connect(forwardUploadDevice, "2""wantData(qint64)", | - |
862 | q, SLOT(wantUploadDataSlot(qint64))); executed (the execution status of this line is deduced): q, "1""wantUploadDataSlot(qint64)"); | - |
863 | QObject::connect(forwardUploadDevice, SIGNAL(processedData(qint64)), executed (the execution status of this line is deduced): QObject::connect(forwardUploadDevice, "2""processedData(qint64)", | - |
864 | q, SLOT(sentUploadDataSlot(qint64))); executed (the execution status of this line is deduced): q, "1""sentUploadDataSlot(qint64)"); | - |
865 | QObject::connect(forwardUploadDevice, SIGNAL(resetData(bool*)), executed (the execution status of this line is deduced): QObject::connect(forwardUploadDevice, "2""resetData(bool*)", | - |
866 | q, SLOT(resetUploadDataSlot(bool*)), executed (the execution status of this line is deduced): q, "1""resetUploadDataSlot(bool*)", | - |
867 | Qt::BlockingQueuedConnection); // this is the only one with BlockingQueued! executed (the execution status of this line is deduced): Qt::BlockingQueuedConnection); | - |
868 | } executed: } Execution Count:138 | 138 |
869 | } else if (synchronous) { executed: } Execution Count:619 partially evaluated: synchronous yes Evaluation Count:76 | no Evaluation Count:0 |
| 0-619 |
870 | QObject::connect(q, SIGNAL(startHttpRequestSynchronously()), delegate, SLOT(startRequestSynchronously()), Qt::BlockingQueuedConnection); executed (the execution status of this line is deduced): QObject::connect(q, "2""startHttpRequestSynchronously()", delegate, "1""startRequestSynchronously()", Qt::BlockingQueuedConnection); | - |
871 | | - |
872 | if (uploadByteDevice) { evaluated: uploadByteDevice yes Evaluation Count:41 | yes Evaluation Count:35 |
| 35-41 |
873 | // For the synchronous HTTP use case the use thread (this one here) is blocked | - |
874 | // so we cannot use the asynchronous upload architecture. | - |
875 | // We therefore won't use the QNonContiguousByteDeviceThreadForwardImpl but directly | - |
876 | // use the uploadByteDevice provided to us by the QNetworkReplyImpl. | - |
877 | // The code that is in start() makes sure it is safe to use from a thread | - |
878 | // since it only wraps a QRingBuffer | - |
879 | delegate->httpRequest.setUploadByteDevice(uploadByteDevice.data()); executed (the execution status of this line is deduced): delegate->httpRequest.setUploadByteDevice(uploadByteDevice.data()); | - |
880 | } executed: } Execution Count:41 | 41 |
881 | } executed: } Execution Count:76 | 76 |
882 | | - |
883 | | - |
884 | // Move the delegate to the http thread | - |
885 | delegate->moveToThread(thread); executed (the execution status of this line is deduced): delegate->moveToThread(thread); | - |
886 | // This call automatically moves the uploadDevice too for the asynchronous case. | - |
887 | | - |
888 | // Prepare timers for progress notifications | - |
889 | downloadProgressSignalChoke.start(); executed (the execution status of this line is deduced): downloadProgressSignalChoke.start(); | - |
890 | uploadProgressSignalChoke.invalidate(); executed (the execution status of this line is deduced): uploadProgressSignalChoke.invalidate(); | - |
891 | | - |
892 | // Send an signal to the delegate so it starts working in the other thread | - |
893 | if (synchronous) { evaluated: synchronous yes Evaluation Count:76 | yes Evaluation Count:619 |
| 76-619 |
894 | emit q->startHttpRequestSynchronously(); // This one is BlockingQueuedConnection, so it will return when all work is done executed (the execution status of this line is deduced): q->startHttpRequestSynchronously(); | - |
895 | | - |
896 | if (delegate->incomingErrorCode != QNetworkReply::NoError) { evaluated: delegate->incomingErrorCode != QNetworkReply::NoError yes Evaluation Count:13 | yes Evaluation Count:63 |
| 13-63 |
897 | replyDownloadMetaData executed (the execution status of this line is deduced): replyDownloadMetaData | - |
898 | (delegate->incomingHeaders, executed (the execution status of this line is deduced): (delegate->incomingHeaders, | - |
899 | delegate->incomingStatusCode, executed (the execution status of this line is deduced): delegate->incomingStatusCode, | - |
900 | delegate->incomingReasonPhrase, executed (the execution status of this line is deduced): delegate->incomingReasonPhrase, | - |
901 | delegate->isPipeliningUsed, executed (the execution status of this line is deduced): delegate->isPipeliningUsed, | - |
902 | QSharedPointer<char>(), executed (the execution status of this line is deduced): QSharedPointer<char>(), | - |
903 | delegate->incomingContentLength); executed (the execution status of this line is deduced): delegate->incomingContentLength); | - |
904 | replyDownloadData(delegate->synchronousDownloadData); executed (the execution status of this line is deduced): replyDownloadData(delegate->synchronousDownloadData); | - |
905 | httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail); executed (the execution status of this line is deduced): httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail); | - |
906 | } else { executed: } Execution Count:13 | 13 |
907 | replyDownloadMetaData executed (the execution status of this line is deduced): replyDownloadMetaData | - |
908 | (delegate->incomingHeaders, executed (the execution status of this line is deduced): (delegate->incomingHeaders, | - |
909 | delegate->incomingStatusCode, executed (the execution status of this line is deduced): delegate->incomingStatusCode, | - |
910 | delegate->incomingReasonPhrase, executed (the execution status of this line is deduced): delegate->incomingReasonPhrase, | - |
911 | delegate->isPipeliningUsed, executed (the execution status of this line is deduced): delegate->isPipeliningUsed, | - |
912 | QSharedPointer<char>(), executed (the execution status of this line is deduced): QSharedPointer<char>(), | - |
913 | delegate->incomingContentLength); executed (the execution status of this line is deduced): delegate->incomingContentLength); | - |
914 | replyDownloadData(delegate->synchronousDownloadData); executed (the execution status of this line is deduced): replyDownloadData(delegate->synchronousDownloadData); | - |
915 | } executed: } Execution Count:63 | 63 |
916 | | - |
917 | thread->quit(); executed (the execution status of this line is deduced): thread->quit(); | - |
918 | thread->wait(5000); executed (the execution status of this line is deduced): thread->wait(5000); | - |
919 | if (thread->isFinished()) partially evaluated: thread->isFinished() yes Evaluation Count:76 | no Evaluation Count:0 |
| 0-76 |
920 | delete thread; executed: delete thread; Execution Count:76 | 76 |
921 | else | - |
922 | QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); never executed: QObject::connect(thread, "2""finished()", thread, "1""deleteLater()"); | 0 |
923 | | - |
924 | finished(); executed (the execution status of this line is deduced): finished(); | - |
925 | } else { executed: } Execution Count:76 | 76 |
926 | emit q->startHttpRequest(); // Signal to the HTTP thread and go back to user. executed (the execution status of this line is deduced): q->startHttpRequest(); | - |
927 | } executed: } Execution Count:619 | 619 |
928 | } | - |
929 | | - |
930 | void QNetworkReplyHttpImplPrivate::invalidateCache() | - |
931 | { | - |
932 | QAbstractNetworkCache *nc = managerPrivate->networkCache; executed (the execution status of this line is deduced): QAbstractNetworkCache *nc = managerPrivate->networkCache; | - |
933 | if (nc) evaluated: nc yes Evaluation Count:2 | yes Evaluation Count:188 |
| 2-188 |
934 | nc->remove(request.url()); executed: nc->remove(request.url()); Execution Count:2 | 2 |
935 | } executed: } Execution Count:190 | 190 |
936 | | - |
937 | void QNetworkReplyHttpImplPrivate::initCacheSaveDevice() | - |
938 | { | - |
939 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
940 | | - |
941 | // The disk cache does not support partial content, so don't even try to | - |
942 | // save any such content into the cache. | - |
943 | if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) { evaluated: q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206 yes Evaluation Count:1 | yes Evaluation Count:62 |
| 1-62 |
944 | cacheEnabled = false; executed (the execution status of this line is deduced): cacheEnabled = false; | - |
945 | return; executed: return; Execution Count:1 | 1 |
946 | } | - |
947 | | - |
948 | // save the meta data | - |
949 | QNetworkCacheMetaData metaData; executed (the execution status of this line is deduced): QNetworkCacheMetaData metaData; | - |
950 | metaData.setUrl(url); executed (the execution status of this line is deduced): metaData.setUrl(url); | - |
951 | metaData = fetchCacheMetaData(metaData); executed (the execution status of this line is deduced): metaData = fetchCacheMetaData(metaData); | - |
952 | | - |
953 | // save the redirect request also in the cache | - |
954 | QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute); executed (the execution status of this line is deduced): QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute); | - |
955 | if (redirectionTarget.isValid()) { partially evaluated: redirectionTarget.isValid() no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
956 | QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); never executed (the execution status of this line is deduced): QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); | - |
957 | attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); never executed (the execution status of this line is deduced): attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); | - |
958 | metaData.setAttributes(attributes); never executed (the execution status of this line is deduced): metaData.setAttributes(attributes); | - |
959 | } | 0 |
960 | | - |
961 | cacheSaveDevice = managerPrivate->networkCache->prepare(metaData); executed (the execution status of this line is deduced): cacheSaveDevice = managerPrivate->networkCache->prepare(metaData); | - |
962 | | - |
963 | if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) { evaluated: !cacheSaveDevice yes Evaluation Count:7 | yes Evaluation Count:55 |
partially evaluated: cacheSaveDevice yes Evaluation Count:55 | no Evaluation Count:0 |
partially evaluated: !cacheSaveDevice->isOpen() no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
964 | if (cacheSaveDevice && !cacheSaveDevice->isOpen()) partially evaluated: cacheSaveDevice no Evaluation Count:0 | yes Evaluation Count:7 |
never evaluated: !cacheSaveDevice->isOpen() | 0-7 |
965 | qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- " never executed: QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 965, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className()); | 0 |
966 | "class %s probably needs to be fixed", never executed: QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 965, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className()); | 0 |
967 | managerPrivate->networkCache->metaObject()->className()); never executed: QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 965, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", managerPrivate->networkCache->metaObject()->className()); | 0 |
968 | | - |
969 | managerPrivate->networkCache->remove(url); executed (the execution status of this line is deduced): managerPrivate->networkCache->remove(url); | - |
970 | cacheSaveDevice = 0; executed (the execution status of this line is deduced): cacheSaveDevice = 0; | - |
971 | cacheEnabled = false; executed (the execution status of this line is deduced): cacheEnabled = false; | - |
972 | } executed: } Execution Count:7 | 7 |
973 | } executed: } Execution Count:62 | 62 |
974 | | - |
975 | void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d) | - |
976 | { | - |
977 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
978 | | - |
979 | // If we're closed just ignore this data | - |
980 | if (!q->isOpen()) evaluated: !q->isOpen() yes Evaluation Count:2 | yes Evaluation Count:6578 |
| 2-6578 |
981 | return; executed: return; Execution Count:2 | 2 |
982 | | - |
983 | int pendingSignals = (int)pendingDownloadDataEmissions->fetchAndAddAcquire(-1) - 1; executed (the execution status of this line is deduced): int pendingSignals = (int)pendingDownloadDataEmissions->fetchAndAddAcquire(-1) - 1; | - |
984 | | - |
985 | if (pendingSignals > 0) { evaluated: pendingSignals > 0 yes Evaluation Count:681 | yes Evaluation Count:5897 |
| 681-5897 |
986 | // Some more signal emissions to this slot are pending. | - |
987 | // Instead of writing the downstream data, we wait | - |
988 | // and do it in the next call we get | - |
989 | // (signal comppression) | - |
990 | pendingDownloadData.append(d); executed (the execution status of this line is deduced): pendingDownloadData.append(d); | - |
991 | return; executed: return; Execution Count:681 | 681 |
992 | } | - |
993 | | - |
994 | pendingDownloadData.append(d); executed (the execution status of this line is deduced): pendingDownloadData.append(d); | - |
995 | d.clear(); executed (the execution status of this line is deduced): d.clear(); | - |
996 | // We need to usa a copy for calling writeDownstreamData as we could | - |
997 | // possibly recurse into this this function when we call | - |
998 | // appendDownstreamDataSignalEmissions because the user might call | - |
999 | // processEvents() or spin an event loop when this occur. | - |
1000 | QByteDataBuffer pendingDownloadDataCopy = pendingDownloadData; executed (the execution status of this line is deduced): QByteDataBuffer pendingDownloadDataCopy = pendingDownloadData; | - |
1001 | pendingDownloadData.clear(); executed (the execution status of this line is deduced): pendingDownloadData.clear(); | - |
1002 | | - |
1003 | if (cacheEnabled && isCachingAllowed() && !cacheSaveDevice) { evaluated: cacheEnabled yes Evaluation Count:47 | yes Evaluation Count:5850 |
partially evaluated: isCachingAllowed() yes Evaluation Count:47 | no Evaluation Count:0 |
partially evaluated: !cacheSaveDevice yes Evaluation Count:47 | no Evaluation Count:0 |
| 0-5850 |
1004 | initCacheSaveDevice(); executed (the execution status of this line is deduced): initCacheSaveDevice(); | - |
1005 | } executed: } Execution Count:47 | 47 |
1006 | | - |
1007 | qint64 bytesWritten = 0; executed (the execution status of this line is deduced): qint64 bytesWritten = 0; | - |
1008 | for (int i = 0; i < pendingDownloadDataCopy.bufferCount(); i++) { evaluated: i < pendingDownloadDataCopy.bufferCount() yes Evaluation Count:6565 | yes Evaluation Count:5897 |
| 5897-6565 |
1009 | QByteArray const &item = pendingDownloadDataCopy[i]; executed (the execution status of this line is deduced): QByteArray const &item = pendingDownloadDataCopy[i]; | - |
1010 | | - |
1011 | if (cacheSaveDevice) evaluated: cacheSaveDevice yes Evaluation Count:46 | yes Evaluation Count:6519 |
| 46-6519 |
1012 | cacheSaveDevice->write(item.constData(), item.size()); executed: cacheSaveDevice->write(item.constData(), item.size()); Execution Count:46 | 46 |
1013 | downloadMultiBuffer.append(item); executed (the execution status of this line is deduced): downloadMultiBuffer.append(item); | - |
1014 | | - |
1015 | bytesWritten += item.size(); executed (the execution status of this line is deduced): bytesWritten += item.size(); | - |
1016 | } executed: } Execution Count:6565 | 6565 |
1017 | pendingDownloadDataCopy.clear(); executed (the execution status of this line is deduced): pendingDownloadDataCopy.clear(); | - |
1018 | | - |
1019 | bytesDownloaded += bytesWritten; executed (the execution status of this line is deduced): bytesDownloaded += bytesWritten; | - |
1020 | | - |
1021 | | - |
1022 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); executed (the execution status of this line is deduced): QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - |
1023 | if (preMigrationDownloaded != Q_INT64_C(-1)) partially evaluated: preMigrationDownloaded != static_cast<long long>(-1LL) no Evaluation Count:0 | yes Evaluation Count:5897 |
| 0-5897 |
1024 | totalSize = totalSize.toLongLong() + preMigrationDownloaded; never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded; | 0 |
1025 | | - |
1026 | emit q->readyRead(); executed (the execution status of this line is deduced): q->readyRead(); | - |
1027 | // emit readyRead before downloadProgress incase this will cause events to be | - |
1028 | // processed and we get into a recursive call (as in QProgressDialog). | - |
1029 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) { evaluated: downloadProgressSignalChoke.elapsed() >= progressSignalInterval yes Evaluation Count:153 | yes Evaluation Count:5744 |
| 153-5744 |
1030 | downloadProgressSignalChoke.restart(); executed (the execution status of this line is deduced): downloadProgressSignalChoke.restart(); | - |
1031 | emit q->downloadProgress(bytesDownloaded, executed (the execution status of this line is deduced): q->downloadProgress(bytesDownloaded, | - |
1032 | totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); executed (the execution status of this line is deduced): totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong()); | - |
1033 | } executed: } Execution Count:153 | 153 |
1034 | | - |
1035 | } executed: } Execution Count:5897 | 5897 |
1036 | | - |
1037 | void QNetworkReplyHttpImplPrivate::replyFinished() | - |
1038 | { | - |
1039 | // We are already loading from cache, we still however | - |
1040 | // got this signal because it was posted already | - |
1041 | if (loadingFromCache) evaluated: loadingFromCache yes Evaluation Count:11 | yes Evaluation Count:589 |
| 11-589 |
1042 | return; executed: return; Execution Count:11 | 11 |
1043 | | - |
1044 | finished(); executed (the execution status of this line is deduced): finished(); | - |
1045 | } executed: } Execution Count:589 | 589 |
1046 | | - |
1047 | void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode) | - |
1048 | { | - |
1049 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1050 | switch (statusCode) { | - |
1051 | case 301: // Moved Permanently | - |
1052 | case 302: // Found | - |
1053 | case 303: // See Other | - |
1054 | case 307: // Temporary Redirect | - |
1055 | // What do we do about the caching of the HTML note? | - |
1056 | // The response to a 303 MUST NOT be cached, while the response to | - |
1057 | // all of the others is cacheable if the headers indicate it to be | - |
1058 | QByteArray header = q->rawHeader("location"); never executed (the execution status of this line is deduced): QByteArray header = q->rawHeader("location"); | - |
1059 | QUrl url = QUrl(QString::fromUtf8(header)); never executed (the execution status of this line is deduced): QUrl url = QUrl(QString::fromUtf8(header)); | - |
1060 | if (!url.isValid()) never evaluated: !url.isValid() | 0 |
1061 | url = QUrl(QLatin1String(header)); never executed: url = QUrl(QLatin1String(header)); | 0 |
1062 | q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, url); never executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, url); | - |
1063 | } | 0 |
1064 | } executed: } Execution Count:664 | 664 |
1065 | | - |
1066 | void QNetworkReplyHttpImplPrivate::replyDownloadMetaData | - |
1067 | (QList<QPair<QByteArray,QByteArray> > hm, | - |
1068 | int sc,QString rp,bool pu, | - |
1069 | QSharedPointer<char> db, | - |
1070 | qint64 contentLength) | - |
1071 | { | - |
1072 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1073 | Q_UNUSED(contentLength); executed (the execution status of this line is deduced): (void)contentLength;; | - |
1074 | | - |
1075 | statusCode = sc; executed (the execution status of this line is deduced): statusCode = sc; | - |
1076 | reasonPhrase = rp; executed (the execution status of this line is deduced): reasonPhrase = rp; | - |
1077 | | - |
1078 | // Download buffer | - |
1079 | if (!db.isNull()) { evaluated: !db.isNull() yes Evaluation Count:333 | yes Evaluation Count:306 |
| 306-333 |
1080 | downloadBufferPointer = db; executed (the execution status of this line is deduced): downloadBufferPointer = db; | - |
1081 | downloadZerocopyBuffer = downloadBufferPointer.data(); executed (the execution status of this line is deduced): downloadZerocopyBuffer = downloadBufferPointer.data(); | - |
1082 | downloadBufferCurrentSize = 0; executed (the execution status of this line is deduced): downloadBufferCurrentSize = 0; | - |
1083 | q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer)); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer)); | - |
1084 | } executed: } Execution Count:333 | 333 |
1085 | | - |
1086 | q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu); | - |
1087 | | - |
1088 | // reconstruct the HTTP header | - |
1089 | QList<QPair<QByteArray, QByteArray> > headerMap = hm; executed (the execution status of this line is deduced): QList<QPair<QByteArray, QByteArray> > headerMap = hm; | - |
1090 | QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(), executed (the execution status of this line is deduced): QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(), | - |
1091 | end = headerMap.constEnd(); executed (the execution status of this line is deduced): end = headerMap.constEnd(); | - |
1092 | for (; it != end; ++it) { evaluated: it != end yes Evaluation Count:4216 | yes Evaluation Count:639 |
| 639-4216 |
1093 | QByteArray value = q->rawHeader(it->first); executed (the execution status of this line is deduced): QByteArray value = q->rawHeader(it->first); | - |
1094 | if (!value.isEmpty()) { evaluated: !value.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:4213 |
| 3-4213 |
1095 | if (qstricmp(it->first.constData(), "set-cookie") == 0) evaluated: qstricmp(it->first.constData(), "set-cookie") == 0 yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1096 | value += '\n'; executed: value += '\n'; Execution Count:2 | 2 |
1097 | else | - |
1098 | value += ", "; executed: value += ", "; Execution Count:1 | 1 |
1099 | } | - |
1100 | value += it->second; executed (the execution status of this line is deduced): value += it->second; | - |
1101 | q->setRawHeader(it->first, value); executed (the execution status of this line is deduced): q->setRawHeader(it->first, value); | - |
1102 | } executed: } Execution Count:4216 | 4216 |
1103 | | - |
1104 | q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode); | - |
1105 | q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); | - |
1106 | | - |
1107 | // is it a redirection? | - |
1108 | checkForRedirect(statusCode); executed (the execution status of this line is deduced): checkForRedirect(statusCode); | - |
1109 | | - |
1110 | if (statusCode >= 500 && statusCode < 600) { evaluated: statusCode >= 500 yes Evaluation Count:1 | yes Evaluation Count:638 |
partially evaluated: statusCode < 600 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-638 |
1111 | QAbstractNetworkCache *nc = managerPrivate->networkCache; executed (the execution status of this line is deduced): QAbstractNetworkCache *nc = managerPrivate->networkCache; | - |
1112 | if (nc) { partially evaluated: nc no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1113 | QNetworkCacheMetaData metaData = nc->metaData(request.url()); never executed (the execution status of this line is deduced): QNetworkCacheMetaData metaData = nc->metaData(request.url()); | - |
1114 | QNetworkHeadersPrivate cacheHeaders; never executed (the execution status of this line is deduced): QNetworkHeadersPrivate cacheHeaders; | - |
1115 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); never executed (the execution status of this line is deduced): cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - |
1116 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; never executed (the execution status of this line is deduced): QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - |
1117 | it = cacheHeaders.findRawHeader("Cache-Control"); never executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("Cache-Control"); | - |
1118 | bool mustReValidate = false; never executed (the execution status of this line is deduced): bool mustReValidate = false; | - |
1119 | if (it != cacheHeaders.rawHeaders.constEnd()) { never evaluated: it != cacheHeaders.rawHeaders.constEnd() | 0 |
1120 | QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); never executed (the execution status of this line is deduced): QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); | - |
1121 | if (cacheControl.contains("must-revalidate")) never evaluated: cacheControl.contains("must-revalidate") | 0 |
1122 | mustReValidate = true; never executed: mustReValidate = true; | 0 |
1123 | } | 0 |
1124 | if (!mustReValidate && sendCacheContents(metaData)) never evaluated: !mustReValidate never evaluated: sendCacheContents(metaData) | 0 |
1125 | return; | 0 |
1126 | } | 0 |
1127 | } executed: } Execution Count:1 | 1 |
1128 | | - |
1129 | if (statusCode == 304) { evaluated: statusCode == 304 yes Evaluation Count:11 | yes Evaluation Count:628 |
| 11-628 |
1130 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
1131 | qDebug() << "Received a 304 from" << url(); | - |
1132 | #endif | - |
1133 | QAbstractNetworkCache *nc = managerPrivate->networkCache; executed (the execution status of this line is deduced): QAbstractNetworkCache *nc = managerPrivate->networkCache; | - |
1134 | if (nc) { partially evaluated: nc yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
1135 | QNetworkCacheMetaData oldMetaData = nc->metaData(request.url()); executed (the execution status of this line is deduced): QNetworkCacheMetaData oldMetaData = nc->metaData(request.url()); | - |
1136 | QNetworkCacheMetaData metaData = fetchCacheMetaData(oldMetaData); executed (the execution status of this line is deduced): QNetworkCacheMetaData metaData = fetchCacheMetaData(oldMetaData); | - |
1137 | if (oldMetaData != metaData) partially evaluated: oldMetaData != metaData yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
1138 | nc->updateMetaData(metaData); executed: nc->updateMetaData(metaData); Execution Count:11 | 11 |
1139 | if (sendCacheContents(metaData)) partially evaluated: sendCacheContents(metaData) yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
1140 | return; executed: return; Execution Count:11 | 11 |
1141 | } | 0 |
1142 | } | 0 |
1143 | | - |
1144 | | - |
1145 | if (statusCode != 304 && statusCode != 303) { partially evaluated: statusCode != 304 yes Evaluation Count:628 | no Evaluation Count:0 |
partially evaluated: statusCode != 303 yes Evaluation Count:628 | no Evaluation Count:0 |
| 0-628 |
1146 | if (!isCachingEnabled()) partially evaluated: !isCachingEnabled() yes Evaluation Count:628 | no Evaluation Count:0 |
| 0-628 |
1147 | setCachingEnabled(true); executed: setCachingEnabled(true); Execution Count:628 | 628 |
1148 | } executed: } Execution Count:628 | 628 |
1149 | | - |
1150 | metaDataChanged(); executed (the execution status of this line is deduced): metaDataChanged(); | - |
1151 | } executed: } Execution Count:628 | 628 |
1152 | | - |
1153 | void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceived, qint64 bytesTotal) | - |
1154 | { | - |
1155 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1156 | | - |
1157 | // If we're closed just ignore this data | - |
1158 | if (!q->isOpen()) partially evaluated: !q->isOpen() no Evaluation Count:0 | yes Evaluation Count:3161 |
| 0-3161 |
1159 | return; | 0 |
1160 | | - |
1161 | // we can be sure here that there is a download buffer | - |
1162 | | - |
1163 | int pendingSignals = (int)pendingDownloadProgressEmissions->fetchAndAddAcquire(-1) - 1; executed (the execution status of this line is deduced): int pendingSignals = (int)pendingDownloadProgressEmissions->fetchAndAddAcquire(-1) - 1; | - |
1164 | if (pendingSignals > 0) { evaluated: pendingSignals > 0 yes Evaluation Count:500 | yes Evaluation Count:2661 |
| 500-2661 |
1165 | // Let's ignore this signal and look at the next one coming in | - |
1166 | // (signal comppression) | - |
1167 | return; executed: return; Execution Count:500 | 500 |
1168 | } | - |
1169 | | - |
1170 | if (!q->isOpen()) partially evaluated: !q->isOpen() no Evaluation Count:0 | yes Evaluation Count:2661 |
| 0-2661 |
1171 | return; | 0 |
1172 | | - |
1173 | if (cacheEnabled && isCachingAllowed() && bytesReceived == bytesTotal) { evaluated: cacheEnabled yes Evaluation Count:18 | yes Evaluation Count:2643 |
evaluated: isCachingAllowed() yes Evaluation Count:17 | yes Evaluation Count:1 |
evaluated: bytesReceived == bytesTotal yes Evaluation Count:16 | yes Evaluation Count:1 |
| 1-2643 |
1174 | // Write everything in one go if we use a download buffer. might be more performant. | - |
1175 | initCacheSaveDevice(); executed (the execution status of this line is deduced): initCacheSaveDevice(); | - |
1176 | // need to check again if cache enabled and device exists | - |
1177 | if (cacheSaveDevice && cacheEnabled) evaluated: cacheSaveDevice yes Evaluation Count:9 | yes Evaluation Count:7 |
partially evaluated: cacheEnabled yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
1178 | cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal); executed: cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal); Execution Count:9 | 9 |
1179 | // FIXME where is it closed? | - |
1180 | } executed: } Execution Count:16 | 16 |
1181 | | - |
1182 | bytesDownloaded = bytesReceived; executed (the execution status of this line is deduced): bytesDownloaded = bytesReceived; | - |
1183 | | - |
1184 | downloadBufferCurrentSize = bytesReceived; executed (the execution status of this line is deduced): downloadBufferCurrentSize = bytesReceived; | - |
1185 | | - |
1186 | // Only emit readyRead when actual data is there | - |
1187 | // emit readyRead before downloadProgress incase this will cause events to be | - |
1188 | // processed and we get into a recursive call (as in QProgressDialog). | - |
1189 | if (bytesDownloaded > 0) partially evaluated: bytesDownloaded > 0 yes Evaluation Count:2661 | no Evaluation Count:0 |
| 0-2661 |
1190 | emit q->readyRead(); executed: q->readyRead(); Execution Count:2661 | 2661 |
1191 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) { evaluated: downloadProgressSignalChoke.elapsed() >= progressSignalInterval yes Evaluation Count:57 | yes Evaluation Count:2604 |
| 57-2604 |
1192 | downloadProgressSignalChoke.restart(); executed (the execution status of this line is deduced): downloadProgressSignalChoke.restart(); | - |
1193 | emit q->downloadProgress(bytesDownloaded, bytesTotal); executed (the execution status of this line is deduced): q->downloadProgress(bytesDownloaded, bytesTotal); | - |
1194 | } executed: } Execution Count:57 | 57 |
1195 | } executed: } Execution Count:2661 | 2661 |
1196 | | - |
1197 | void QNetworkReplyHttpImplPrivate::httpAuthenticationRequired(const QHttpNetworkRequest &request, | - |
1198 | QAuthenticator *auth) | - |
1199 | { | - |
1200 | managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication, request.withCredentials()); executed (the execution status of this line is deduced): managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication, request.withCredentials()); | - |
1201 | } executed: } Execution Count:113 | 113 |
1202 | | - |
1203 | #ifndef QT_NO_NETWORKPROXY | - |
1204 | void QNetworkReplyHttpImplPrivate::proxyAuthenticationRequired(const QNetworkProxy &proxy, | - |
1205 | QAuthenticator *authenticator) | - |
1206 | { | - |
1207 | managerPrivate->proxyAuthenticationRequired(proxy, synchronous, authenticator, &lastProxyAuthentication); executed (the execution status of this line is deduced): managerPrivate->proxyAuthenticationRequired(proxy, synchronous, authenticator, &lastProxyAuthentication); | - |
1208 | } executed: } Execution Count:61 | 61 |
1209 | #endif | - |
1210 | | - |
1211 | void QNetworkReplyHttpImplPrivate::httpError(QNetworkReply::NetworkError errorCode, | - |
1212 | const QString &errorString) | - |
1213 | { | - |
1214 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
1215 | qDebug() << "http error!" << errorCode << errorString; | - |
1216 | #endif | - |
1217 | | - |
1218 | // FIXME? | - |
1219 | error(errorCode, errorString); executed (the execution status of this line is deduced): error(errorCode, errorString); | - |
1220 | } executed: } Execution Count:87 | 87 |
1221 | | - |
1222 | #ifndef QT_NO_SSL | - |
1223 | void QNetworkReplyHttpImplPrivate::replySslErrors( | - |
1224 | const QList<QSslError> &list, bool *ignoreAll, QList<QSslError> *toBeIgnored) | - |
1225 | { | - |
1226 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1227 | emit q->sslErrors(list); executed (the execution status of this line is deduced): q->sslErrors(list); | - |
1228 | // Check if the callback set any ignore and return this here to http thread | - |
1229 | if (pendingIgnoreAllSslErrors) evaluated: pendingIgnoreAllSslErrors yes Evaluation Count:21 | yes Evaluation Count:12 |
| 12-21 |
1230 | *ignoreAll = true; executed: *ignoreAll = true; Execution Count:21 | 21 |
1231 | if (!pendingIgnoreSslErrorsList.isEmpty()) evaluated: !pendingIgnoreSslErrorsList.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:27 |
| 6-27 |
1232 | *toBeIgnored = pendingIgnoreSslErrorsList; executed: *toBeIgnored = pendingIgnoreSslErrorsList; Execution Count:6 | 6 |
1233 | } executed: } Execution Count:33 | 33 |
1234 | | - |
1235 | void QNetworkReplyHttpImplPrivate::replySslConfigurationChanged(const QSslConfiguration &sslConfiguration) | - |
1236 | { | - |
1237 | // Receiving the used SSL configuration from the HTTP thread | - |
1238 | this->sslConfiguration = sslConfiguration; executed (the execution status of this line is deduced): this->sslConfiguration = sslConfiguration; | - |
1239 | } executed: } Execution Count:159 | 159 |
1240 | #endif | - |
1241 | | - |
1242 | // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread | - |
1243 | void QNetworkReplyHttpImplPrivate::resetUploadDataSlot(bool *r) | - |
1244 | { | - |
1245 | *r = uploadByteDevice->reset(); executed (the execution status of this line is deduced): *r = uploadByteDevice->reset(); | - |
1246 | } executed: } Execution Count:137 | 137 |
1247 | | - |
1248 | // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread | - |
1249 | void QNetworkReplyHttpImplPrivate::sentUploadDataSlot(qint64 amount) | - |
1250 | { | - |
1251 | uploadByteDevice->advanceReadPointer(amount); executed (the execution status of this line is deduced): uploadByteDevice->advanceReadPointer(amount); | - |
1252 | } executed: } Execution Count:1875 | 1875 |
1253 | | - |
1254 | // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread | - |
1255 | void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) | - |
1256 | { | - |
1257 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1258 | | - |
1259 | // call readPointer | - |
1260 | qint64 currentUploadDataLength = 0; executed (the execution status of this line is deduced): qint64 currentUploadDataLength = 0; | - |
1261 | char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength)); executed (the execution status of this line is deduced): char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength)); | - |
1262 | // Let's make a copy of this data | - |
1263 | QByteArray dataArray(data, currentUploadDataLength); executed (the execution status of this line is deduced): QByteArray dataArray(data, currentUploadDataLength); | - |
1264 | | - |
1265 | // Communicate back to HTTP thread | - |
1266 | emit q->haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); executed (the execution status of this line is deduced): q->haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); | - |
1267 | } executed: } Execution Count:1876 | 1876 |
1268 | | - |
1269 | /* | - |
1270 | A simple web page that can be used to test us: http://www.procata.com/cachetest/ | - |
1271 | */ | - |
1272 | bool QNetworkReplyHttpImplPrivate::sendCacheContents(const QNetworkCacheMetaData &metaData) | - |
1273 | { | - |
1274 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1275 | | - |
1276 | setCachingEnabled(false); executed (the execution status of this line is deduced): setCachingEnabled(false); | - |
1277 | if (!metaData.isValid()) partially evaluated: !metaData.isValid() no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
1278 | return false; never executed: return false; | 0 |
1279 | | - |
1280 | QAbstractNetworkCache *nc = managerPrivate->networkCache; executed (the execution status of this line is deduced): QAbstractNetworkCache *nc = managerPrivate->networkCache; | - |
1281 | Q_ASSERT(nc); executed (the execution status of this line is deduced): qt_noop(); | - |
1282 | QIODevice *contents = nc->data(url); executed (the execution status of this line is deduced): QIODevice *contents = nc->data(url); | - |
1283 | if (!contents) { partially evaluated: !contents no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
1284 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
1285 | qDebug() << "Can not send cache, the contents are 0" << url; | - |
1286 | #endif | - |
1287 | return false; never executed: return false; | 0 |
1288 | } | - |
1289 | contents->setParent(q); executed (the execution status of this line is deduced): contents->setParent(q); | - |
1290 | | - |
1291 | QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); executed (the execution status of this line is deduced): QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); | - |
1292 | int status = attributes.value(QNetworkRequest::HttpStatusCodeAttribute).toInt(); executed (the execution status of this line is deduced): int status = attributes.value(QNetworkRequest::HttpStatusCodeAttribute).toInt(); | - |
1293 | if (status < 100) evaluated: status < 100 yes Evaluation Count:8 | yes Evaluation Count:17 |
| 8-17 |
1294 | status = 200; // fake it executed: status = 200; Execution Count:8 | 8 |
1295 | | - |
1296 | q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status); | - |
1297 | q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); | - |
1298 | q->setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); executed (the execution status of this line is deduced): q->setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); | - |
1299 | | - |
1300 | QNetworkCacheMetaData::RawHeaderList rawHeaders = metaData.rawHeaders(); executed (the execution status of this line is deduced): QNetworkCacheMetaData::RawHeaderList rawHeaders = metaData.rawHeaders(); | - |
1301 | QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(), executed (the execution status of this line is deduced): QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(), | - |
1302 | end = rawHeaders.constEnd(); executed (the execution status of this line is deduced): end = rawHeaders.constEnd(); | - |
1303 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:92 | yes Evaluation Count:25 |
| 25-92 |
1304 | setRawHeader(it->first, it->second); executed: setRawHeader(it->first, it->second); Execution Count:92 | 92 |
1305 | | - |
1306 | checkForRedirect(status); executed (the execution status of this line is deduced): checkForRedirect(status); | - |
1307 | | - |
1308 | cacheLoadDevice = contents; executed (the execution status of this line is deduced): cacheLoadDevice = contents; | - |
1309 | q->connect(cacheLoadDevice, SIGNAL(readyRead()), SLOT(_q_cacheLoadReadyRead())); executed (the execution status of this line is deduced): q->connect(cacheLoadDevice, "2""readyRead()", "1""_q_cacheLoadReadyRead()"); | - |
1310 | q->connect(cacheLoadDevice, SIGNAL(readChannelFinished()), SLOT(_q_cacheLoadReadyRead())); executed (the execution status of this line is deduced): q->connect(cacheLoadDevice, "2""readChannelFinished()", "1""_q_cacheLoadReadyRead()"); | - |
1311 | | - |
1312 | // This needs to be emitted in the event loop because it can be reached at | - |
1313 | // the direct code path of qnam.get(...) before the user has a chance | - |
1314 | // to connect any signals. | - |
1315 | QMetaObject::invokeMethod(q, "metaDataChanged", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "metaDataChanged", Qt::QueuedConnection); | - |
1316 | QMetaObject::invokeMethod(q, "_q_cacheLoadReadyRead", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_cacheLoadReadyRead", Qt::QueuedConnection); | - |
1317 | | - |
1318 | | - |
1319 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
1320 | qDebug() << "Successfully sent cache:" << url << contents->size() << "bytes"; | - |
1321 | #endif | - |
1322 | | - |
1323 | // Set the following flag so we can ignore some signals from HTTP thread | - |
1324 | // that would still come | - |
1325 | loadingFromCache = true; executed (the execution status of this line is deduced): loadingFromCache = true; | - |
1326 | return true; executed: return true; Execution Count:25 | 25 |
1327 | } | - |
1328 | | - |
1329 | QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNetworkCacheMetaData &oldMetaData) const | - |
1330 | { | - |
1331 | Q_Q(const QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): const QNetworkReplyHttpImpl * const q = q_func(); | - |
1332 | | - |
1333 | QNetworkCacheMetaData metaData = oldMetaData; executed (the execution status of this line is deduced): QNetworkCacheMetaData metaData = oldMetaData; | - |
1334 | | - |
1335 | QNetworkHeadersPrivate cacheHeaders; executed (the execution status of this line is deduced): QNetworkHeadersPrivate cacheHeaders; | - |
1336 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); executed (the execution status of this line is deduced): cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - |
1337 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; executed (the execution status of this line is deduced): QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - |
1338 | | - |
1339 | QList<QByteArray> newHeaders = q->rawHeaderList(); executed (the execution status of this line is deduced): QList<QByteArray> newHeaders = q->rawHeaderList(); | - |
1340 | foreach (QByteArray header, newHeaders) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(newHeaders)> _container_(newHeaders); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QByteArray header = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1341 | QByteArray originalHeader = header; executed (the execution status of this line is deduced): QByteArray originalHeader = header; | - |
1342 | header = header.toLower(); executed (the execution status of this line is deduced): header = header.toLower(); | - |
1343 | bool hop_by_hop = executed (the execution status of this line is deduced): bool hop_by_hop = | - |
1344 | (header == "connection" evaluated: header == "connection" yes Evaluation Count:73 | yes Evaluation Count:404 |
| 73-404 |
1345 | || header == "keep-alive" evaluated: header == "keep-alive" yes Evaluation Count:66 | yes Evaluation Count:338 |
| 66-338 |
1346 | || header == "proxy-authenticate" partially evaluated: header == "proxy-authenticate" no Evaluation Count:0 | yes Evaluation Count:338 |
| 0-338 |
1347 | || header == "proxy-authorization" partially evaluated: header == "proxy-authorization" no Evaluation Count:0 | yes Evaluation Count:338 |
| 0-338 |
1348 | || header == "te" partially evaluated: header == "te" no Evaluation Count:0 | yes Evaluation Count:338 |
| 0-338 |
1349 | || header == "trailers" partially evaluated: header == "trailers" no Evaluation Count:0 | yes Evaluation Count:338 |
| 0-338 |
1350 | || header == "transfer-encoding" evaluated: header == "transfer-encoding" yes Evaluation Count:43 | yes Evaluation Count:295 |
| 43-295 |
1351 | || header == "upgrade"); partially evaluated: header == "upgrade" no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
1352 | if (hop_by_hop) evaluated: hop_by_hop yes Evaluation Count:182 | yes Evaluation Count:295 |
| 182-295 |
1353 | continue; executed: continue; Execution Count:182 | 182 |
1354 | | - |
1355 | // for 4.6.0, we were planning to not store the date header in the | - |
1356 | // cached resource; through that we planned to reduce the number | - |
1357 | // of writes to disk when using a QNetworkDiskCache (i.e. don't | - |
1358 | // write to disk when only the date changes). | - |
1359 | // However, without the date we cannot calculate the age of the page | - |
1360 | // anymore. | - |
1361 | //if (header == "date") | - |
1362 | //continue; | - |
1363 | | - |
1364 | // Don't store Warning 1xx headers | - |
1365 | if (header == "warning") { partially evaluated: header == "warning" no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
1366 | QByteArray v = q->rawHeader(header); never executed (the execution status of this line is deduced): QByteArray v = q->rawHeader(header); | - |
1367 | if (v.length() == 3 never evaluated: v.length() == 3 | 0 |
1368 | && v[0] == '1' never evaluated: v[0] == '1' | 0 |
1369 | && v[1] >= '0' && v[1] <= '9' never evaluated: v[1] >= '0' never evaluated: v[1] <= '9' | 0 |
1370 | && v[2] >= '0' && v[2] <= '9') never evaluated: v[2] >= '0' never evaluated: v[2] <= '9' | 0 |
1371 | continue; never executed: continue; | 0 |
1372 | } | 0 |
1373 | | - |
1374 | it = cacheHeaders.findRawHeader(header); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader(header); | - |
1375 | if (it != cacheHeaders.rawHeaders.constEnd()) { evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:17 | yes Evaluation Count:278 |
| 17-278 |
1376 | // Match the behavior of Firefox and assume Cache-Control: "no-transform" | - |
1377 | if (header == "content-encoding" partially evaluated: header == "content-encoding" no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1378 | || header == "content-range" partially evaluated: header == "content-range" no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1379 | || header == "content-type") partially evaluated: header == "content-type" no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1380 | continue; never executed: continue; | 0 |
1381 | | - |
1382 | // For MS servers that send "Content-Length: 0" on 304 responses | - |
1383 | // ignore this too | - |
1384 | if (header == "content-length") partially evaluated: header == "content-length" no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1385 | continue; never executed: continue; | 0 |
1386 | } executed: } Execution Count:17 | 17 |
1387 | | - |
1388 | #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) | - |
1389 | QByteArray n = rawHeader(header); | - |
1390 | QByteArray o; | - |
1391 | if (it != cacheHeaders.rawHeaders.constEnd()) | - |
1392 | o = (*it).second; | - |
1393 | if (n != o && header != "date") { | - |
1394 | qDebug() << "replacing" << header; | - |
1395 | qDebug() << "new" << n; | - |
1396 | qDebug() << "old" << o; | - |
1397 | } | - |
1398 | #endif | - |
1399 | cacheHeaders.setRawHeader(originalHeader, q->rawHeader(header)); executed (the execution status of this line is deduced): cacheHeaders.setRawHeader(originalHeader, q->rawHeader(header)); | - |
1400 | } executed: } Execution Count:295 | 295 |
1401 | metaData.setRawHeaders(cacheHeaders.rawHeaders); executed (the execution status of this line is deduced): metaData.setRawHeaders(cacheHeaders.rawHeaders); | - |
1402 | | - |
1403 | bool checkExpired = true; executed (the execution status of this line is deduced): bool checkExpired = true; | - |
1404 | | - |
1405 | QHash<QByteArray, QByteArray> cacheControl; executed (the execution status of this line is deduced): QHash<QByteArray, QByteArray> cacheControl; | - |
1406 | it = cacheHeaders.findRawHeader("Cache-Control"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("Cache-Control"); | - |
1407 | if (it != cacheHeaders.rawHeaders.constEnd()) { evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:28 | yes Evaluation Count:45 |
| 28-45 |
1408 | cacheControl = parseHttpOptionHeader(it->second); executed (the execution status of this line is deduced): cacheControl = parseHttpOptionHeader(it->second); | - |
1409 | QByteArray maxAge = cacheControl.value("max-age"); executed (the execution status of this line is deduced): QByteArray maxAge = cacheControl.value("max-age"); | - |
1410 | if (!maxAge.isEmpty()) { evaluated: !maxAge.isEmpty() yes Evaluation Count:21 | yes Evaluation Count:7 |
| 7-21 |
1411 | checkExpired = false; executed (the execution status of this line is deduced): checkExpired = false; | - |
1412 | QDateTime dt = QDateTime::currentDateTime(); executed (the execution status of this line is deduced): QDateTime dt = QDateTime::currentDateTime(); | - |
1413 | dt = dt.addSecs(maxAge.toInt()); executed (the execution status of this line is deduced): dt = dt.addSecs(maxAge.toInt()); | - |
1414 | metaData.setExpirationDate(dt); executed (the execution status of this line is deduced): metaData.setExpirationDate(dt); | - |
1415 | } executed: } Execution Count:21 | 21 |
1416 | } executed: } Execution Count:28 | 28 |
1417 | if (checkExpired) { evaluated: checkExpired yes Evaluation Count:52 | yes Evaluation Count:21 |
| 21-52 |
1418 | it = cacheHeaders.findRawHeader("expires"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("expires"); | - |
1419 | if (it != cacheHeaders.rawHeaders.constEnd()) { evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:17 | yes Evaluation Count:35 |
| 17-35 |
1420 | QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(it->second); executed (the execution status of this line is deduced): QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(it->second); | - |
1421 | metaData.setExpirationDate(expiredDateTime); executed (the execution status of this line is deduced): metaData.setExpirationDate(expiredDateTime); | - |
1422 | } executed: } Execution Count:17 | 17 |
1423 | } executed: } Execution Count:52 | 52 |
1424 | | - |
1425 | it = cacheHeaders.findRawHeader("last-modified"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("last-modified"); | - |
1426 | if (it != cacheHeaders.rawHeaders.constEnd()) evaluated: it != cacheHeaders.rawHeaders.constEnd() yes Evaluation Count:33 | yes Evaluation Count:40 |
| 33-40 |
1427 | metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second)); executed: metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second)); Execution Count:33 | 33 |
1428 | | - |
1429 | bool canDiskCache; never executed (the execution status of this line is deduced): bool canDiskCache; | - |
1430 | // only cache GET replies by default, all other replies (POST, PUT, DELETE) | - |
1431 | // are not cacheable by default (according to RFC 2616 section 9) | - |
1432 | if (httpRequest.operation() == QHttpNetworkRequest::Get) { partially evaluated: httpRequest.operation() == QHttpNetworkRequest::Get yes Evaluation Count:73 | no Evaluation Count:0 |
| 0-73 |
1433 | | - |
1434 | canDiskCache = true; executed (the execution status of this line is deduced): canDiskCache = true; | - |
1435 | // 14.32 | - |
1436 | // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client | - |
1437 | // had sent "Cache-Control: no-cache". | - |
1438 | it = cacheHeaders.findRawHeader("pragma"); executed (the execution status of this line is deduced): it = cacheHeaders.findRawHeader("pragma"); | - |
1439 | if (it != cacheHeaders.rawHeaders.constEnd() partially evaluated: it != cacheHeaders.rawHeaders.constEnd() no Evaluation Count:0 | yes Evaluation Count:73 |
| 0-73 |
1440 | && it->second == "no-cache") never evaluated: it->second == "no-cache" | 0 |
1441 | canDiskCache = false; never executed: canDiskCache = false; | 0 |
1442 | | - |
1443 | // HTTP/1.1. Check the Cache-Control header | - |
1444 | if (cacheControl.contains("no-cache")) evaluated: cacheControl.contains("no-cache") yes Evaluation Count:7 | yes Evaluation Count:66 |
| 7-66 |
1445 | canDiskCache = false; executed: canDiskCache = false; Execution Count:7 | 7 |
1446 | else if (cacheControl.contains("no-store")) partially evaluated: cacheControl.contains("no-store") no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
1447 | canDiskCache = false; never executed: canDiskCache = false; | 0 |
1448 | | - |
1449 | // responses to POST might be cacheable | - |
1450 | } else if (httpRequest.operation() == QHttpNetworkRequest::Post) { never evaluated: httpRequest.operation() == QHttpNetworkRequest::Post | 0 |
1451 | | - |
1452 | canDiskCache = false; never executed (the execution status of this line is deduced): canDiskCache = false; | - |
1453 | // some pages contain "expires:" and "cache-control: no-cache" field, | - |
1454 | // so we only might cache POST requests if we get "cache-control: max-age ..." | - |
1455 | if (cacheControl.contains("max-age")) never evaluated: cacheControl.contains("max-age") | 0 |
1456 | canDiskCache = true; never executed: canDiskCache = true; | 0 |
1457 | | - |
1458 | // responses to PUT and DELETE are not cacheable | - |
1459 | } else { | 0 |
1460 | canDiskCache = false; never executed (the execution status of this line is deduced): canDiskCache = false; | - |
1461 | } | 0 |
1462 | | - |
1463 | metaData.setSaveToDisk(canDiskCache); executed (the execution status of this line is deduced): metaData.setSaveToDisk(canDiskCache); | - |
1464 | QNetworkCacheMetaData::AttributesMap attributes; executed (the execution status of this line is deduced): QNetworkCacheMetaData::AttributesMap attributes; | - |
1465 | if (statusCode != 304) { evaluated: statusCode != 304 yes Evaluation Count:62 | yes Evaluation Count:11 |
| 11-62 |
1466 | // update the status code | - |
1467 | attributes.insert(QNetworkRequest::HttpStatusCodeAttribute, statusCode); executed (the execution status of this line is deduced): attributes.insert(QNetworkRequest::HttpStatusCodeAttribute, statusCode); | - |
1468 | attributes.insert(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); executed (the execution status of this line is deduced): attributes.insert(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); | - |
1469 | } else { executed: } Execution Count:62 | 62 |
1470 | // this is a redirection, keep the attributes intact | - |
1471 | attributes = oldMetaData.attributes(); executed (the execution status of this line is deduced): attributes = oldMetaData.attributes(); | - |
1472 | } executed: } Execution Count:11 | 11 |
1473 | metaData.setAttributes(attributes); executed (the execution status of this line is deduced): metaData.setAttributes(attributes); | - |
1474 | return metaData; executed: return metaData; Execution Count:73 | 73 |
1475 | } | - |
1476 | | - |
1477 | bool QNetworkReplyHttpImplPrivate::canResume() const | - |
1478 | { | - |
1479 | Q_Q(const QNetworkReplyHttpImpl); never executed (the execution status of this line is deduced): const QNetworkReplyHttpImpl * const q = q_func(); | - |
1480 | | - |
1481 | // Only GET operation supports resuming. | - |
1482 | if (operation != QNetworkAccessManager::GetOperation) never evaluated: operation != QNetworkAccessManager::GetOperation | 0 |
1483 | return false; never executed: return false; | 0 |
1484 | | - |
1485 | // Can only resume if server/resource supports Range header. | - |
1486 | QByteArray acceptRangesheaderName("Accept-Ranges"); never executed (the execution status of this line is deduced): QByteArray acceptRangesheaderName("Accept-Ranges"); | - |
1487 | if (!q->hasRawHeader(acceptRangesheaderName) || q->rawHeader(acceptRangesheaderName) == "none") never evaluated: !q->hasRawHeader(acceptRangesheaderName) never evaluated: q->rawHeader(acceptRangesheaderName) == "none" | 0 |
1488 | return false; never executed: return false; | 0 |
1489 | | - |
1490 | // We only support resuming for byte ranges. | - |
1491 | if (request.hasRawHeader("Range")) { never evaluated: request.hasRawHeader("Range") | 0 |
1492 | QByteArray range = request.rawHeader("Range"); never executed (the execution status of this line is deduced): QByteArray range = request.rawHeader("Range"); | - |
1493 | if (!range.startsWith("bytes=")) never evaluated: !range.startsWith("bytes=") | 0 |
1494 | return false; never executed: return false; | 0 |
1495 | } | 0 |
1496 | | - |
1497 | // If we're using a download buffer then we don't support resuming/migration | - |
1498 | // right now. Too much trouble. | - |
1499 | if (downloadZerocopyBuffer) never evaluated: downloadZerocopyBuffer | 0 |
1500 | return false; never executed: return false; | 0 |
1501 | | - |
1502 | return true; never executed: return true; | 0 |
1503 | } | - |
1504 | | - |
1505 | void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset) | - |
1506 | { | - |
1507 | resumeOffset = offset; never executed (the execution status of this line is deduced): resumeOffset = offset; | - |
1508 | } | 0 |
1509 | | - |
1510 | /*! | - |
1511 | Starts the backend. Returns true if the backend is started. Returns false if the backend | - |
1512 | could not be started due to an unopened or roaming session. The caller should recall this | - |
1513 | function once the session has been opened or the roaming process has finished. | - |
1514 | */ | - |
1515 | bool QNetworkReplyHttpImplPrivate::start() | - |
1516 | { | - |
1517 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1518 | QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession()); executed (the execution status of this line is deduced): QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession()); | - |
1519 | if (!networkSession) { evaluated: !networkSession yes Evaluation Count:709 | yes Evaluation Count:7 |
| 7-709 |
1520 | #endif | - |
1521 | postRequest(); executed (the execution status of this line is deduced): postRequest(); | - |
1522 | return true; executed: return true; Execution Count:709 | 709 |
1523 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1524 | } | - |
1525 | | - |
1526 | // This is not ideal. | - |
1527 | const QString host = url.host(); executed (the execution status of this line is deduced): const QString host = url.host(); | - |
1528 | if (host == QLatin1String("localhost") || partially evaluated: host == QLatin1String("localhost") no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1529 | QHostAddress(host).isLoopback()) { partially evaluated: QHostAddress(host).isLoopback() no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1530 | // Don't need an open session for localhost access. | - |
1531 | postRequest(); never executed (the execution status of this line is deduced): postRequest(); | - |
1532 | return true; never executed: return true; | 0 |
1533 | } | - |
1534 | | - |
1535 | if (networkSession->isOpen() && evaluated: networkSession->isOpen() yes Evaluation Count:3 | yes Evaluation Count:4 |
| 3-4 |
1536 | networkSession->state() == QNetworkSession::Connected) { partially evaluated: networkSession->state() == QNetworkSession::Connected yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1537 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1538 | QObject::connect(networkSession.data(), SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)), executed (the execution status of this line is deduced): QObject::connect(networkSession.data(), "2""usagePoliciesChanged(QNetworkSession::UsagePolicies)", | - |
1539 | q, SLOT(_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies))); executed (the execution status of this line is deduced): q, "1""_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies)"); | - |
1540 | postRequest(); executed (the execution status of this line is deduced): postRequest(); | - |
1541 | return true; executed: return true; Execution Count:3 | 3 |
1542 | } | - |
1543 | | - |
1544 | return false; executed: return false; Execution Count:4 | 4 |
1545 | #endif | - |
1546 | } | - |
1547 | | - |
1548 | void QNetworkReplyHttpImplPrivate::_q_startOperation() | - |
1549 | { | - |
1550 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1551 | | - |
1552 | // ensure this function is only being called once | - |
1553 | if (state == Working) { partially evaluated: state == Working no Evaluation Count:0 | yes Evaluation Count:716 |
| 0-716 |
1554 | qDebug("QNetworkReplyImpl::_q_startOperation was called more than once"); never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 1554, __PRETTY_FUNCTION__).debug("QNetworkReplyImpl::_q_startOperation was called more than once"); | - |
1555 | return; | 0 |
1556 | } | - |
1557 | state = Working; executed (the execution status of this line is deduced): state = Working; | - |
1558 | | - |
1559 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1560 | // Do not start background requests if they are not allowed by session policy | - |
1561 | QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); executed (the execution status of this line is deduced): QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); | - |
1562 | QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false)); executed (the execution status of this line is deduced): QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false)); | - |
1563 | if (isBackground.toBool() && session && session->usagePolicies().testFlag(QNetworkSession::NoBackgroundTrafficPolicy)) { partially evaluated: isBackground.toBool() no Evaluation Count:0 | yes Evaluation Count:716 |
never evaluated: session never evaluated: session->usagePolicies().testFlag(QNetworkSession::NoBackgroundTrafficPolicy) | 0-716 |
1564 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - |
1565 | Q_ARG(QNetworkReply::NetworkError, QNetworkReply::BackgroundRequestNotAllowedError), never executed (the execution status of this line is deduced): QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::BackgroundRequestNotAllowedError), | - |
1566 | Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Background request not allowed."))); never executed (the execution status of this line is deduced): QArgument<QString >("QString", QCoreApplication::translate("QNetworkReply", "Background request not allowed."))); | - |
1567 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - |
1568 | return; | 0 |
1569 | } | - |
1570 | #endif | - |
1571 | | - |
1572 | if (!start()) { evaluated: !start() yes Evaluation Count:4 | yes Evaluation Count:712 |
| 4-712 |
1573 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1574 | // backend failed to start because the session state is not Connected. | - |
1575 | // QNetworkAccessManager will call reply->backend->start() again for us when the session | - |
1576 | // state changes. | - |
1577 | state = WaitingForSession; executed (the execution status of this line is deduced): state = WaitingForSession; | - |
1578 | | - |
1579 | if (session) { partially evaluated: session yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1580 | QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)), executed (the execution status of this line is deduced): QObject::connect(session.data(), "2""error(QNetworkSession::SessionError)", | - |
1581 | q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection); executed (the execution status of this line is deduced): q, "1""_q_networkSessionFailed()", Qt::QueuedConnection); | - |
1582 | | - |
1583 | if (!session->isOpen()) { partially evaluated: !session->isOpen() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1584 | session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground); executed (the execution status of this line is deduced): session->setSessionProperty(QString::fromUtf8("" "ConnectInBackground" "", sizeof("ConnectInBackground") - 1), isBackground); | - |
1585 | session->open(); executed (the execution status of this line is deduced): session->open(); | - |
1586 | } executed: } Execution Count:4 | 4 |
1587 | } else { executed: } Execution Count:4 | 4 |
1588 | qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 1588, __PRETTY_FUNCTION__).warning("Backend is waiting for QNetworkSession to connect, but there is none!"); | - |
1589 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - |
1590 | Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError), never executed (the execution status of this line is deduced): QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::NetworkSessionFailedError), | - |
1591 | Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error."))); never executed (the execution status of this line is deduced): QArgument<QString >("QString", QCoreApplication::translate("QNetworkReply", "Network session error."))); | - |
1592 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - |
1593 | return; | 0 |
1594 | } | - |
1595 | #else | - |
1596 | qWarning("Backend start failed"); | - |
1597 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - |
1598 | Q_ARG(QNetworkReply::NetworkError, QNetworkReply::UnknownNetworkError), | - |
1599 | Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "backend start error."))); | - |
1600 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - |
1601 | return; | - |
1602 | #endif | - |
1603 | } | - |
1604 | | - |
1605 | if (synchronous) { evaluated: synchronous yes Evaluation Count:76 | yes Evaluation Count:640 |
| 76-640 |
1606 | state = Finished; executed (the execution status of this line is deduced): state = Finished; | - |
1607 | q_func()->setFinished(true); executed (the execution status of this line is deduced): q_func()->setFinished(true); | - |
1608 | } else { executed: } Execution Count:76 | 76 |
1609 | if (state != Finished) { partially evaluated: state != Finished yes Evaluation Count:640 | no Evaluation Count:0 |
| 0-640 |
1610 | | - |
1611 | } executed: } Execution Count:640 | 640 |
1612 | } executed: } Execution Count:640 | 640 |
1613 | } | - |
1614 | | - |
1615 | void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead() | - |
1616 | { | - |
1617 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1618 | | - |
1619 | if (state != Working) partially evaluated: state != Working no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
1620 | return; | 0 |
1621 | if (!cacheLoadDevice || !q->isOpen() || !cacheLoadDevice->bytesAvailable()) partially evaluated: !cacheLoadDevice no Evaluation Count:0 | yes Evaluation Count:25 |
partially evaluated: !q->isOpen() no Evaluation Count:0 | yes Evaluation Count:25 |
partially evaluated: !cacheLoadDevice->bytesAvailable() no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
1622 | return; | 0 |
1623 | | - |
1624 | // FIXME Optimize to use zerocopy download buffer if it is a QBuffer. | - |
1625 | // Needs to be done where sendCacheContents() (?) of HTTP is emitting | - |
1626 | // metaDataChanged ? | - |
1627 | | - |
1628 | | - |
1629 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); executed (the execution status of this line is deduced): QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - |
1630 | | - |
1631 | // emit readyRead before downloadProgress incase this will cause events to be | - |
1632 | // processed and we get into a recursive call (as in QProgressDialog). | - |
1633 | | - |
1634 | // This readyRead() goes to the user. The user then may or may not read() anything. | - |
1635 | emit q->readyRead(); executed (the execution status of this line is deduced): q->readyRead(); | - |
1636 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval) { evaluated: downloadProgressSignalChoke.elapsed() >= progressSignalInterval yes Evaluation Count:6 | yes Evaluation Count:19 |
| 6-19 |
1637 | downloadProgressSignalChoke.restart(); executed (the execution status of this line is deduced): downloadProgressSignalChoke.restart(); | - |
1638 | emit q->downloadProgress(bytesDownloaded, executed (the execution status of this line is deduced): q->downloadProgress(bytesDownloaded, | - |
1639 | totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); executed (the execution status of this line is deduced): totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong()); | - |
1640 | } executed: } Execution Count:6 | 6 |
1641 | | - |
1642 | // If there are still bytes available in the cacheLoadDevice then the user did not read | - |
1643 | // in response to the readyRead() signal. This means we have to load from the cacheLoadDevice | - |
1644 | // and buffer that stuff. This is needed to be able to properly emit finished() later. | - |
1645 | while (cacheLoadDevice->bytesAvailable()) { evaluated: cacheLoadDevice->bytesAvailable() yes Evaluation Count:25 | yes Evaluation Count:25 |
| 25 |
1646 | downloadMultiBuffer.append(cacheLoadDevice->readAll()); executed (the execution status of this line is deduced): downloadMultiBuffer.append(cacheLoadDevice->readAll()); | - |
1647 | } executed: } Execution Count:25 | 25 |
1648 | | - |
1649 | if (cacheLoadDevice->isSequential()) { partially evaluated: cacheLoadDevice->isSequential() no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
1650 | // check if end and we can read the EOF -1 | - |
1651 | char c; never executed (the execution status of this line is deduced): char c; | - |
1652 | qint64 actualCount = cacheLoadDevice->read(&c, 1); never executed (the execution status of this line is deduced): qint64 actualCount = cacheLoadDevice->read(&c, 1); | - |
1653 | if (actualCount < 0) { never evaluated: actualCount < 0 | 0 |
1654 | cacheLoadDevice->deleteLater(); never executed (the execution status of this line is deduced): cacheLoadDevice->deleteLater(); | - |
1655 | cacheLoadDevice = 0; never executed (the execution status of this line is deduced): cacheLoadDevice = 0; | - |
1656 | QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); | - |
1657 | } else if (actualCount == 1) { never executed: } never evaluated: actualCount == 1 | 0 |
1658 | // This is most probably not happening since most QIODevice returned something proper for bytesAvailable() | - |
1659 | // and had already been "emptied". | - |
1660 | cacheLoadDevice->ungetChar(c); never executed (the execution status of this line is deduced): cacheLoadDevice->ungetChar(c); | - |
1661 | } | 0 |
1662 | } else if ((!cacheLoadDevice->isSequential() && cacheLoadDevice->atEnd())) { partially evaluated: !cacheLoadDevice->isSequential() yes Evaluation Count:25 | no Evaluation Count:0 |
partially evaluated: cacheLoadDevice->atEnd() yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
1663 | // This codepath is in case the cache device is a QBuffer, e.g. from QNetworkDiskCache. | - |
1664 | cacheLoadDevice->deleteLater(); executed (the execution status of this line is deduced): cacheLoadDevice->deleteLater(); | - |
1665 | cacheLoadDevice = 0; executed (the execution status of this line is deduced): cacheLoadDevice = 0; | - |
1666 | QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); | - |
1667 | } executed: } Execution Count:25 | 25 |
1668 | | - |
1669 | } | - |
1670 | | - |
1671 | | - |
1672 | void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingDataFinished() | - |
1673 | { | - |
1674 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1675 | | - |
1676 | // make sure this is only called once, ever. | - |
1677 | //_q_bufferOutgoingData may call it or the readChannelFinished emission | - |
1678 | if (state != Buffering) partially evaluated: state != Buffering no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
1679 | return; | 0 |
1680 | | - |
1681 | // disconnect signals | - |
1682 | QObject::disconnect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); executed (the execution status of this line is deduced): QObject::disconnect(outgoingData, "2""readyRead()", q, "1""_q_bufferOutgoingData()"); | - |
1683 | QObject::disconnect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); executed (the execution status of this line is deduced): QObject::disconnect(outgoingData, "2""readChannelFinished()", q, "1""_q_bufferOutgoingDataFinished()"); | - |
1684 | | - |
1685 | // finally, start the request | - |
1686 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - |
1687 | } executed: } Execution Count:60 | 60 |
1688 | | - |
1689 | void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData() | - |
1690 | { | - |
1691 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1692 | | - |
1693 | if (!outgoingDataBuffer) { evaluated: !outgoingDataBuffer yes Evaluation Count:60 | yes Evaluation Count:60 |
| 60 |
1694 | // first call, create our buffer | - |
1695 | outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); executed (the execution status of this line is deduced): outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); | - |
1696 | | - |
1697 | QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); executed (the execution status of this line is deduced): QObject::connect(outgoingData, "2""readyRead()", q, "1""_q_bufferOutgoingData()"); | - |
1698 | QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); executed (the execution status of this line is deduced): QObject::connect(outgoingData, "2""readChannelFinished()", q, "1""_q_bufferOutgoingDataFinished()"); | - |
1699 | } executed: } Execution Count:60 | 60 |
1700 | | - |
1701 | qint64 bytesBuffered = 0; executed (the execution status of this line is deduced): qint64 bytesBuffered = 0; | - |
1702 | qint64 bytesToBuffer = 0; executed (the execution status of this line is deduced): qint64 bytesToBuffer = 0; | - |
1703 | | - |
1704 | // read data into our buffer | - |
1705 | forever { executed (the execution status of this line is deduced): for(;;) { | - |
1706 | bytesToBuffer = outgoingData->bytesAvailable(); executed (the execution status of this line is deduced): bytesToBuffer = outgoingData->bytesAvailable(); | - |
1707 | // unknown? just try 2 kB, this also ensures we always try to read the EOF | - |
1708 | if (bytesToBuffer <= 0) evaluated: bytesToBuffer <= 0 yes Evaluation Count:140 | yes Evaluation Count:70 |
| 70-140 |
1709 | bytesToBuffer = 2*1024; executed: bytesToBuffer = 2*1024; Execution Count:140 | 140 |
1710 | | - |
1711 | char *dst = outgoingDataBuffer->reserve(bytesToBuffer); executed (the execution status of this line is deduced): char *dst = outgoingDataBuffer->reserve(bytesToBuffer); | - |
1712 | bytesBuffered = outgoingData->read(dst, bytesToBuffer); executed (the execution status of this line is deduced): bytesBuffered = outgoingData->read(dst, bytesToBuffer); | - |
1713 | | - |
1714 | if (bytesBuffered == -1) { evaluated: bytesBuffered == -1 yes Evaluation Count:60 | yes Evaluation Count:150 |
| 60-150 |
1715 | // EOF has been reached. | - |
1716 | outgoingDataBuffer->chop(bytesToBuffer); executed (the execution status of this line is deduced): outgoingDataBuffer->chop(bytesToBuffer); | - |
1717 | | - |
1718 | _q_bufferOutgoingDataFinished(); executed (the execution status of this line is deduced): _q_bufferOutgoingDataFinished(); | - |
1719 | break; executed: break; Execution Count:60 | 60 |
1720 | } else if (bytesBuffered == 0) { evaluated: bytesBuffered == 0 yes Evaluation Count:60 | yes Evaluation Count:90 |
| 60-90 |
1721 | // nothing read right now, just wait until we get called again | - |
1722 | outgoingDataBuffer->chop(bytesToBuffer); executed (the execution status of this line is deduced): outgoingDataBuffer->chop(bytesToBuffer); | - |
1723 | | - |
1724 | break; executed: break; Execution Count:60 | 60 |
1725 | } else { | - |
1726 | // don't break, try to read() again | - |
1727 | outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered); executed (the execution status of this line is deduced): outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered); | - |
1728 | } executed: } Execution Count:90 | 90 |
1729 | } | - |
1730 | } executed: } Execution Count:120 | 120 |
1731 | | - |
1732 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1733 | void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected() | - |
1734 | { | - |
1735 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1736 | | - |
1737 | if (!manager) partially evaluated: !manager no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1738 | return; | 0 |
1739 | | - |
1740 | QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); executed (the execution status of this line is deduced): QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); | - |
1741 | if (!session) partially evaluated: !session no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1742 | return; | 0 |
1743 | | - |
1744 | if (session->state() != QNetworkSession::Connected) partially evaluated: session->state() != QNetworkSession::Connected no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1745 | return; | 0 |
1746 | | - |
1747 | switch (state) { | - |
1748 | case QNetworkReplyImplPrivate::Buffering: | - |
1749 | case QNetworkReplyImplPrivate::Working: | - |
1750 | case QNetworkReplyImplPrivate::Reconnecting: | - |
1751 | // Migrate existing downloads to new network connection. | - |
1752 | migrateBackend(); never executed (the execution status of this line is deduced): migrateBackend(); | - |
1753 | break; | 0 |
1754 | case QNetworkReplyImplPrivate::WaitingForSession: | - |
1755 | // Start waiting requests. | - |
1756 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - |
1757 | break; executed: break; Execution Count:3 | 3 |
1758 | default: | - |
1759 | ; | - |
1760 | } | 0 |
1761 | } executed: } Execution Count:3 | 3 |
1762 | | - |
1763 | void QNetworkReplyHttpImplPrivate::_q_networkSessionFailed() | - |
1764 | { | - |
1765 | // Abort waiting and working replies. | - |
1766 | if (state == WaitingForSession || state == Working) { partially evaluated: state == WaitingForSession yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: state == Working | 0-1 |
1767 | state = Working; executed (the execution status of this line is deduced): state = Working; | - |
1768 | QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); executed (the execution status of this line is deduced): QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); | - |
1769 | QString errorStr; executed (the execution status of this line is deduced): QString errorStr; | - |
1770 | if (session) partially evaluated: session yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1771 | errorStr = session->errorString(); executed: errorStr = session->errorString(); Execution Count:1 | 1 |
1772 | else | - |
1773 | errorStr = QCoreApplication::translate("QNetworkReply", "Network session error."); never executed: errorStr = QCoreApplication::translate("QNetworkReply", "Network session error."); | 0 |
1774 | error(QNetworkReplyImpl::NetworkSessionFailedError, errorStr); executed (the execution status of this line is deduced): error(QNetworkReplyImpl::NetworkSessionFailedError, errorStr); | - |
1775 | finished(); executed (the execution status of this line is deduced): finished(); | - |
1776 | } executed: } Execution Count:1 | 1 |
1777 | } executed: } Execution Count:1 | 1 |
1778 | | - |
1779 | void QNetworkReplyHttpImplPrivate::_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies newPolicies) | - |
1780 | { | - |
1781 | if (request.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) { never evaluated: request.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool() | 0 |
1782 | if (newPolicies & QNetworkSession::NoBackgroundTrafficPolicy) { never evaluated: newPolicies & QNetworkSession::NoBackgroundTrafficPolicy | 0 |
1783 | // Abort waiting and working replies. | - |
1784 | if (state == WaitingForSession || state == Working) { never evaluated: state == WaitingForSession never evaluated: state == Working | 0 |
1785 | state = Working; never executed (the execution status of this line is deduced): state = Working; | - |
1786 | error(QNetworkReply::BackgroundRequestNotAllowedError, never executed (the execution status of this line is deduced): error(QNetworkReply::BackgroundRequestNotAllowedError, | - |
1787 | QCoreApplication::translate("QNetworkReply", "Background request not allowed.")); never executed (the execution status of this line is deduced): QCoreApplication::translate("QNetworkReply", "Background request not allowed.")); | - |
1788 | finished(); never executed (the execution status of this line is deduced): finished(); | - |
1789 | } | 0 |
1790 | // ### if canResume(), then we could resume automatically | - |
1791 | } | 0 |
1792 | } | 0 |
1793 | | - |
1794 | } | 0 |
1795 | #endif | - |
1796 | | - |
1797 | | - |
1798 | // need to have this function since the reply is a private member variable | - |
1799 | // and the special backends need to access this. | - |
1800 | void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) | - |
1801 | { | - |
1802 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1803 | if (isFinished) partially evaluated: isFinished no Evaluation Count:0 | yes Evaluation Count:1875 |
| 0-1875 |
1804 | return; | 0 |
1805 | | - |
1806 | //choke signal emissions, except the first and last signals which are unconditional | - |
1807 | if (uploadProgressSignalChoke.isValid()) { evaluated: uploadProgressSignalChoke.isValid() yes Evaluation Count:1757 | yes Evaluation Count:118 |
| 118-1757 |
1808 | if (bytesSent != bytesTotal && uploadProgressSignalChoke.elapsed() < progressSignalInterval) { evaluated: bytesSent != bytesTotal yes Evaluation Count:1689 | yes Evaluation Count:68 |
evaluated: uploadProgressSignalChoke.elapsed() < progressSignalInterval yes Evaluation Count:1681 | yes Evaluation Count:8 |
| 8-1689 |
1809 | return; executed: return; Execution Count:1681 | 1681 |
1810 | } | - |
1811 | uploadProgressSignalChoke.restart(); executed (the execution status of this line is deduced): uploadProgressSignalChoke.restart(); | - |
1812 | } else { executed: } Execution Count:76 | 76 |
1813 | uploadProgressSignalChoke.start(); executed (the execution status of this line is deduced): uploadProgressSignalChoke.start(); | - |
1814 | } executed: } Execution Count:118 | 118 |
1815 | | - |
1816 | emit q->uploadProgress(bytesSent, bytesTotal); executed (the execution status of this line is deduced): q->uploadProgress(bytesSent, bytesTotal); | - |
1817 | } executed: } Execution Count:194 | 194 |
1818 | | - |
1819 | QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice() | - |
1820 | { | - |
1821 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1822 | | - |
1823 | if (outgoingDataBuffer) evaluated: outgoingDataBuffer yes Evaluation Count:101 | yes Evaluation Count:82 |
| 82-101 |
1824 | uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingDataBuffer)); executed: uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingDataBuffer)); Execution Count:101 | 101 |
1825 | else if (outgoingData) { evaluated: outgoingData yes Evaluation Count:78 | yes Evaluation Count:4 |
| 4-78 |
1826 | uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingData)); executed (the execution status of this line is deduced): uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingData)); | - |
1827 | } else { executed: } Execution Count:78 | 78 |
1828 | return 0; executed: return 0; Execution Count:4 | 4 |
1829 | } | - |
1830 | | - |
1831 | bool bufferDisallowed = executed (the execution status of this line is deduced): bool bufferDisallowed = | - |
1832 | request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, executed (the execution status of this line is deduced): request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, | - |
1833 | QVariant(false)) == QVariant(true); executed (the execution status of this line is deduced): QVariant(false)) == QVariant(true); | - |
1834 | if (bufferDisallowed) evaluated: bufferDisallowed yes Evaluation Count:1 | yes Evaluation Count:178 |
| 1-178 |
1835 | uploadByteDevice->disableReset(); executed: uploadByteDevice->disableReset(); Execution Count:1 | 1 |
1836 | | - |
1837 | // We want signal emissions only for normal asynchronous uploads | - |
1838 | if (!synchronous) evaluated: !synchronous yes Evaluation Count:138 | yes Evaluation Count:41 |
| 41-138 |
1839 | QObject::connect(uploadByteDevice.data(), SIGNAL(readProgress(qint64,qint64)), executed: QObject::connect(uploadByteDevice.data(), "2""readProgress(qint64,qint64)", q, "1""emitReplyUploadProgress(qint64,qint64)"); Execution Count:138 | 138 |
1840 | q, SLOT(emitReplyUploadProgress(qint64,qint64))); executed: QObject::connect(uploadByteDevice.data(), "2""readProgress(qint64,qint64)", q, "1""emitReplyUploadProgress(qint64,qint64)"); Execution Count:138 | 138 |
1841 | | - |
1842 | return uploadByteDevice.data(); executed: return uploadByteDevice.data(); Execution Count:179 | 179 |
1843 | } | - |
1844 | | - |
1845 | void QNetworkReplyHttpImplPrivate::_q_finished() | - |
1846 | { | - |
1847 | // This gets called queued, just forward to real call then | - |
1848 | finished(); executed (the execution status of this line is deduced): finished(); | - |
1849 | } executed: } Execution Count:28 | 28 |
1850 | | - |
1851 | void QNetworkReplyHttpImplPrivate::finished() | - |
1852 | { | - |
1853 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1854 | | - |
1855 | if (state == Finished || state == Aborted || state == WaitingForSession) partially evaluated: state == Finished no Evaluation Count:0 | yes Evaluation Count:697 |
partially evaluated: state == Aborted no Evaluation Count:0 | yes Evaluation Count:697 |
partially evaluated: state == WaitingForSession no Evaluation Count:0 | yes Evaluation Count:697 |
| 0-697 |
1856 | return; | 0 |
1857 | | - |
1858 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); executed (the execution status of this line is deduced): QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - |
1859 | if (preMigrationDownloaded != Q_INT64_C(-1)) partially evaluated: preMigrationDownloaded != static_cast<long long>(-1LL) no Evaluation Count:0 | yes Evaluation Count:697 |
| 0-697 |
1860 | totalSize = totalSize.toLongLong() + preMigrationDownloaded; never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded; | 0 |
1861 | | - |
1862 | if (manager) { partially evaluated: manager yes Evaluation Count:697 | no Evaluation Count:0 |
| 0-697 |
1863 | #ifndef QT_NO_BEARERMANAGEMENT | - |
1864 | QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); executed (the execution status of this line is deduced): QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); | - |
1865 | if (session && session->state() == QNetworkSession::Roaming && evaluated: session yes Evaluation Count:4 | yes Evaluation Count:693 |
partially evaluated: session->state() == QNetworkSession::Roaming no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-693 |
1866 | state == Working && errorCode != QNetworkReply::OperationCanceledError) { never evaluated: state == Working never evaluated: errorCode != QNetworkReply::OperationCanceledError | 0 |
1867 | // only content with a known size will fail with a temporary network failure error | - |
1868 | if (!totalSize.isNull()) { never evaluated: !totalSize.isNull() | 0 |
1869 | if (bytesDownloaded != totalSize) { never evaluated: bytesDownloaded != totalSize | 0 |
1870 | if (migrateBackend()) { never evaluated: migrateBackend() | 0 |
1871 | // either we are migrating or the request is finished/aborted | - |
1872 | if (state == Reconnecting || state == WaitingForSession) { never evaluated: state == Reconnecting never evaluated: state == WaitingForSession | 0 |
1873 | return; // exit early if we are migrating. | 0 |
1874 | } | - |
1875 | } else { | 0 |
1876 | error(QNetworkReply::TemporaryNetworkFailureError, never executed (the execution status of this line is deduced): error(QNetworkReply::TemporaryNetworkFailureError, | - |
1877 | QNetworkReply::tr("Temporary network failure.")); never executed (the execution status of this line is deduced): QNetworkReply::tr("Temporary network failure.")); | - |
1878 | } | 0 |
1879 | } | - |
1880 | } | 0 |
1881 | } | 0 |
1882 | #endif | - |
1883 | } executed: } Execution Count:697 | 697 |
1884 | | - |
1885 | state = Finished; executed (the execution status of this line is deduced): state = Finished; | - |
1886 | q->setFinished(true); executed (the execution status of this line is deduced): q->setFinished(true); | - |
1887 | | - |
1888 | if (totalSize.isNull() || totalSize == -1) { evaluated: totalSize.isNull() yes Evaluation Count:206 | yes Evaluation Count:491 |
partially evaluated: totalSize == -1 no Evaluation Count:0 | yes Evaluation Count:491 |
| 0-491 |
1889 | emit q->downloadProgress(bytesDownloaded, bytesDownloaded); executed (the execution status of this line is deduced): q->downloadProgress(bytesDownloaded, bytesDownloaded); | - |
1890 | } else { executed: } Execution Count:206 | 206 |
1891 | emit q->downloadProgress(bytesDownloaded, totalSize.toLongLong()); executed (the execution status of this line is deduced): q->downloadProgress(bytesDownloaded, totalSize.toLongLong()); | - |
1892 | } executed: } Execution Count:491 | 491 |
1893 | | - |
1894 | if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) partially evaluated: bytesUploaded == -1 yes Evaluation Count:697 | no Evaluation Count:0 |
evaluated: outgoingData yes Evaluation Count:178 | yes Evaluation Count:519 |
partially evaluated: outgoingDataBuffer no Evaluation Count:0 | yes Evaluation Count:519 |
| 0-697 |
1895 | emit q->uploadProgress(0, 0); executed: q->uploadProgress(0, 0); Execution Count:178 | 178 |
1896 | | - |
1897 | // if we don't know the total size of or we received everything save the cache | - |
1898 | if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) evaluated: totalSize.isNull() yes Evaluation Count:206 | yes Evaluation Count:491 |
partially evaluated: totalSize == -1 no Evaluation Count:0 | yes Evaluation Count:491 |
evaluated: bytesDownloaded == totalSize yes Evaluation Count:450 | yes Evaluation Count:41 |
| 0-491 |
1899 | completeCacheSave(); executed: completeCacheSave(); Execution Count:656 | 656 |
1900 | | - |
1901 | emit q->readChannelFinished(); executed (the execution status of this line is deduced): q->readChannelFinished(); | - |
1902 | emit q->finished(); executed (the execution status of this line is deduced): q->finished(); | - |
1903 | } executed: } Execution Count:697 | 697 |
1904 | | - |
1905 | void QNetworkReplyHttpImplPrivate::_q_error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage) | - |
1906 | { | - |
1907 | this->error(code, errorMessage); executed (the execution status of this line is deduced): this->error(code, errorMessage); | - |
1908 | } executed: } Execution Count:3 | 3 |
1909 | | - |
1910 | | - |
1911 | void QNetworkReplyHttpImplPrivate::error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage) | - |
1912 | { | - |
1913 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1914 | // Can't set and emit multiple errors. | - |
1915 | if (errorCode != QNetworkReply::NoError) { partially evaluated: errorCode != QNetworkReply::NoError no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
1916 | qWarning("QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once."); never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 1916, __PRETTY_FUNCTION__).warning("QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once."); | - |
1917 | return; | 0 |
1918 | } | - |
1919 | | - |
1920 | errorCode = code; executed (the execution status of this line is deduced): errorCode = code; | - |
1921 | q->setErrorString(errorMessage); executed (the execution status of this line is deduced): q->setErrorString(errorMessage); | - |
1922 | | - |
1923 | // note: might not be a good idea, since users could decide to delete us | - |
1924 | // which would delete the backend too... | - |
1925 | // maybe we should protect the backend | - |
1926 | emit q->error(code); executed (the execution status of this line is deduced): q->error(code); | - |
1927 | } executed: } Execution Count:94 | 94 |
1928 | | - |
1929 | void QNetworkReplyHttpImplPrivate::metaDataChanged() | - |
1930 | { | - |
1931 | // FIXME merge this with replyDownloadMetaData(); ? | - |
1932 | | - |
1933 | Q_Q(QNetworkReplyHttpImpl); executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1934 | // 1. do we have cookies? | - |
1935 | // 2. are we allowed to set them? | - |
1936 | if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader) && manager evaluated: cookedHeaders.contains(QNetworkRequest::SetCookieHeader) yes Evaluation Count:12 | yes Evaluation Count:616 |
partially evaluated: manager yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-616 |
1937 | && (static_cast<QNetworkRequest::LoadControl> partially evaluated: (static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1938 | (request.attribute(QNetworkRequest::CookieSaveControlAttribute, partially evaluated: (static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1939 | QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic)) { partially evaluated: (static_cast<QNetworkRequest::LoadControl> (request.attribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1940 | QList<QNetworkCookie> cookies = executed (the execution status of this line is deduced): QList<QNetworkCookie> cookies = | - |
1941 | qvariant_cast<QList<QNetworkCookie> >(cookedHeaders.value(QNetworkRequest::SetCookieHeader)); executed (the execution status of this line is deduced): qvariant_cast<QList<QNetworkCookie> >(cookedHeaders.value(QNetworkRequest::SetCookieHeader)); | - |
1942 | QNetworkCookieJar *jar = manager->cookieJar(); executed (the execution status of this line is deduced): QNetworkCookieJar *jar = manager->cookieJar(); | - |
1943 | if (jar) partially evaluated: jar yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1944 | jar->setCookiesFromUrl(cookies, url); executed: jar->setCookiesFromUrl(cookies, url); Execution Count:12 | 12 |
1945 | } executed: } Execution Count:12 | 12 |
1946 | emit q->metaDataChanged(); executed (the execution status of this line is deduced): q->metaDataChanged(); | - |
1947 | } executed: } Execution Count:628 | 628 |
1948 | | - |
1949 | /* | - |
1950 | Migrates the backend of the QNetworkReply to a new network connection if required. Returns | - |
1951 | true if the reply is migrated or it is not required; otherwise returns false. | - |
1952 | */ | - |
1953 | bool QNetworkReplyHttpImplPrivate::migrateBackend() | - |
1954 | { | - |
1955 | Q_Q(QNetworkReplyHttpImpl); never executed (the execution status of this line is deduced): QNetworkReplyHttpImpl * const q = q_func(); | - |
1956 | | - |
1957 | // Network reply is already finished or aborted, don't need to migrate. | - |
1958 | if (state == Finished || state == Aborted) never evaluated: state == Finished never evaluated: state == Aborted | 0 |
1959 | return true; never executed: return true; | 0 |
1960 | | - |
1961 | // Backend does not support resuming download. | - |
1962 | if (!canResume()) never evaluated: !canResume() | 0 |
1963 | return false; never executed: return false; | 0 |
1964 | | - |
1965 | // Request has outgoing data, not migrating. | - |
1966 | if (outgoingData) never evaluated: outgoingData | 0 |
1967 | return false; never executed: return false; | 0 |
1968 | | - |
1969 | // Request is serviced from the cache, don't need to migrate. | - |
1970 | if (cacheLoadDevice) never evaluated: cacheLoadDevice | 0 |
1971 | return true; never executed: return true; | 0 |
1972 | | - |
1973 | state = Reconnecting; never executed (the execution status of this line is deduced): state = Reconnecting; | - |
1974 | | - |
1975 | cookedHeaders.clear(); never executed (the execution status of this line is deduced): cookedHeaders.clear(); | - |
1976 | rawHeaders.clear(); never executed (the execution status of this line is deduced): rawHeaders.clear(); | - |
1977 | | - |
1978 | preMigrationDownloaded = bytesDownloaded; never executed (the execution status of this line is deduced): preMigrationDownloaded = bytesDownloaded; | - |
1979 | | - |
1980 | setResumeOffset(bytesDownloaded); never executed (the execution status of this line is deduced): setResumeOffset(bytesDownloaded); | - |
1981 | | - |
1982 | emit q->abortHttpRequest(); never executed (the execution status of this line is deduced): q->abortHttpRequest(); | - |
1983 | | - |
1984 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - |
1985 | | - |
1986 | return true; never executed: return true; | 0 |
1987 | } | - |
1988 | | - |
1989 | | - |
1990 | void QNetworkReplyHttpImplPrivate::createCache() | - |
1991 | { | - |
1992 | // check if we can save and if we're allowed to | - |
1993 | if (!managerPrivate->networkCache evaluated: !managerPrivate->networkCache yes Evaluation Count:552 | yes Evaluation Count:76 |
| 76-552 |
1994 | || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()) evaluated: !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool() yes Evaluation Count:10 | yes Evaluation Count:66 |
| 10-66 |
1995 | return; executed: return; Execution Count:562 | 562 |
1996 | cacheEnabled = true; executed (the execution status of this line is deduced): cacheEnabled = true; | - |
1997 | } executed: } Execution Count:66 | 66 |
1998 | | - |
1999 | bool QNetworkReplyHttpImplPrivate::isCachingEnabled() const | - |
2000 | { | - |
2001 | return (cacheEnabled && managerPrivate->networkCache != 0); executed: return (cacheEnabled && managerPrivate->networkCache != 0); Execution Count:628 | 628 |
2002 | } | - |
2003 | | - |
2004 | void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable) | - |
2005 | { | - |
2006 | if (!enable && !cacheEnabled) evaluated: !enable yes Evaluation Count:25 | yes Evaluation Count:628 |
partially evaluated: !cacheEnabled yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-628 |
2007 | return; // nothing to do executed: return; Execution Count:25 | 25 |
2008 | if (enable && cacheEnabled) partially evaluated: enable yes Evaluation Count:628 | no Evaluation Count:0 |
partially evaluated: cacheEnabled no Evaluation Count:0 | yes Evaluation Count:628 |
| 0-628 |
2009 | return; // nothing to do either! | 0 |
2010 | | - |
2011 | if (enable) { partially evaluated: enable yes Evaluation Count:628 | no Evaluation Count:0 |
| 0-628 |
2012 | if (bytesDownloaded) { partially evaluated: bytesDownloaded no Evaluation Count:0 | yes Evaluation Count:628 |
| 0-628 |
2013 | qDebug() << "setCachingEnabled: " << bytesDownloaded << " bytesDownloaded"; never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 2013, __PRETTY_FUNCTION__).debug() << "setCachingEnabled: " << bytesDownloaded << " bytesDownloaded"; | - |
2014 | // refuse to enable in this case | - |
2015 | qCritical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written"); never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 2015, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written"); | - |
2016 | return; | 0 |
2017 | } | - |
2018 | | - |
2019 | createCache(); executed (the execution status of this line is deduced): createCache(); | - |
2020 | } else { executed: } Execution Count:628 | 628 |
2021 | // someone told us to turn on, then back off? | - |
2022 | // ok... but you should make up your mind | - |
2023 | qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)"); never executed (the execution status of this line is deduced): QMessageLogger("access/qnetworkreplyhttpimpl.cpp", 2023, __PRETTY_FUNCTION__).debug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)"); | - |
2024 | managerPrivate->networkCache->remove(url); never executed (the execution status of this line is deduced): managerPrivate->networkCache->remove(url); | - |
2025 | cacheSaveDevice = 0; never executed (the execution status of this line is deduced): cacheSaveDevice = 0; | - |
2026 | cacheEnabled = false; never executed (the execution status of this line is deduced): cacheEnabled = false; | - |
2027 | } | 0 |
2028 | } | - |
2029 | | - |
2030 | bool QNetworkReplyHttpImplPrivate::isCachingAllowed() const | - |
2031 | { | - |
2032 | return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation; executed: return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation; Execution Count:65 | 65 |
2033 | } | - |
2034 | | - |
2035 | void QNetworkReplyHttpImplPrivate::completeCacheSave() | - |
2036 | { | - |
2037 | if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) { evaluated: cacheEnabled yes Evaluation Count:57 | yes Evaluation Count:599 |
partially evaluated: errorCode != QNetworkReplyImpl::NoError no Evaluation Count:0 | yes Evaluation Count:57 |
| 0-599 |
2038 | managerPrivate->networkCache->remove(url); never executed (the execution status of this line is deduced): managerPrivate->networkCache->remove(url); | - |
2039 | } else if (cacheEnabled && cacheSaveDevice) { never executed: } evaluated: cacheEnabled yes Evaluation Count:57 | yes Evaluation Count:599 |
evaluated: cacheSaveDevice yes Evaluation Count:55 | yes Evaluation Count:2 |
| 0-599 |
2040 | managerPrivate->networkCache->insert(cacheSaveDevice); executed (the execution status of this line is deduced): managerPrivate->networkCache->insert(cacheSaveDevice); | - |
2041 | } executed: } Execution Count:55 | 55 |
2042 | cacheSaveDevice = 0; executed (the execution status of this line is deduced): cacheSaveDevice = 0; | - |
2043 | cacheEnabled = false; executed (the execution status of this line is deduced): cacheEnabled = false; | - |
2044 | } executed: } Execution Count:656 | 656 |
2045 | | - |
2046 | QT_END_NAMESPACE | - |
2047 | | - |
2048 | #endif // QT_NO_HTTP | - |
2049 | | - |
| | |