Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkreplyhttpimpl.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | class QNetworkProxy; | - | ||||||||||||||||||
14 | - | |||||||||||||||||||
15 | static inline bool isSeparator(char c) | - | ||||||||||||||||||
16 | { | - | ||||||||||||||||||
17 | static const char separators[] = "()<>@,;:\\\"/[]?={}"; | - | ||||||||||||||||||
18 | return executed 157 times by 2 tests: isLWS(c)return isLWS(c) || strchr(separators, c) != 0; Executed by:
executed 157 times by 2 tests: return isLWS(c) || strchr(separators, c) != 0; Executed by:
| 0-157 | ||||||||||||||||||
19 | } | - | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | - | |||||||||||||||||||
22 | static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &header) | - | ||||||||||||||||||
23 | { | - | ||||||||||||||||||
24 | - | |||||||||||||||||||
25 | - | |||||||||||||||||||
26 | - | |||||||||||||||||||
27 | - | |||||||||||||||||||
28 | QHash<QByteArray, QByteArray> result; | - | ||||||||||||||||||
29 | - | |||||||||||||||||||
30 | int pos = 0; | - | ||||||||||||||||||
31 | while (true) { | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | pos = nextNonWhitespace(header, pos); | - | ||||||||||||||||||
34 | if (pos == header.length()
| 22-69 | ||||||||||||||||||
35 | return executed 22 times by 2 tests: result;return result; Executed by:
executed 22 times by 2 tests: return result; Executed by:
| 22 | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | int comma = header.indexOf(',', pos); | - | ||||||||||||||||||
39 | int equal = header.indexOf('=', pos); | - | ||||||||||||||||||
40 | if (comma == pos
| 0-69 | ||||||||||||||||||
41 | - | |||||||||||||||||||
42 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | - | |||||||||||||||||||
45 | - | |||||||||||||||||||
46 | int end = comma; | - | ||||||||||||||||||
47 | if (end == -1
| 19-50 | ||||||||||||||||||
48 | end = header.length(); executed 50 times by 2 tests: end = header.length(); Executed by:
| 50 | ||||||||||||||||||
49 | if (equal != -1
| 4-47 | ||||||||||||||||||
50 | end = equal; executed 43 times by 2 tests: end = equal; Executed by:
| 43 | ||||||||||||||||||
51 | QByteArray key = QByteArray(header.constData() + pos, end - pos).trimmed().toLower(); | - | ||||||||||||||||||
52 | pos = end + 1; | - | ||||||||||||||||||
53 | - | |||||||||||||||||||
54 | if (uint(equal) < uint(comma)
| 26-43 | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | - | |||||||||||||||||||
57 | pos = nextNonWhitespace(header, pos); | - | ||||||||||||||||||
58 | if (pos == header.length()
| 0-43 | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
61 | - | |||||||||||||||||||
62 | QByteArray value; | - | ||||||||||||||||||
63 | value.reserve(header.length() - pos); | - | ||||||||||||||||||
64 | if (header.at(pos) == '"'
| 0-43 | ||||||||||||||||||
65 | - | |||||||||||||||||||
66 | - | |||||||||||||||||||
67 | - | |||||||||||||||||||
68 | - | |||||||||||||||||||
69 | ++pos; | - | ||||||||||||||||||
70 | while (pos < header.length()
| 0 | ||||||||||||||||||
71 | char c = header.at(pos); | - | ||||||||||||||||||
72 | if (c == '"'
| 0 | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | break; never executed: break; | 0 | ||||||||||||||||||
75 | } else if (c == '\\'
| 0 | ||||||||||||||||||
76 | ++pos; | - | ||||||||||||||||||
77 | if (pos >= header.length()
| 0 | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
80 | c = header.at(pos); | - | ||||||||||||||||||
81 | } never executed: end of block | 0 | ||||||||||||||||||
82 | - | |||||||||||||||||||
83 | value += c; | - | ||||||||||||||||||
84 | ++pos; | - | ||||||||||||||||||
85 | } never executed: end of block | 0 | ||||||||||||||||||
86 | } never executed: else {end of block | 0 | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | while (pos < header.length()
| 28-157 | ||||||||||||||||||
89 | char c = header.at(pos); | - | ||||||||||||||||||
90 | if (isSeparator(c)
| 15-142 | ||||||||||||||||||
91 | break; executed 15 times by 2 tests: break; Executed by:
| 15 | ||||||||||||||||||
92 | value += c; | - | ||||||||||||||||||
93 | ++pos; | - | ||||||||||||||||||
94 | } executed 142 times by 2 tests: end of block Executed by:
| 142 | ||||||||||||||||||
95 | } executed 43 times by 2 tests: end of block Executed by:
| 43 | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | result.insert(key, value); | - | ||||||||||||||||||
98 | - | |||||||||||||||||||
99 | - | |||||||||||||||||||
100 | comma = header.indexOf(',', pos); | - | ||||||||||||||||||
101 | if (comma == -1
| 15-28 | ||||||||||||||||||
102 | return executed 28 times by 2 tests: result;return result; Executed by:
executed 28 times by 2 tests: return result; Executed by:
| 28 | ||||||||||||||||||
103 | pos = comma + 1; | - | ||||||||||||||||||
104 | } executed 15 times by 2 tests: else {end of block Executed by:
| 15 | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | - | |||||||||||||||||||
107 | result.insert(key, QByteArray()); | - | ||||||||||||||||||
108 | } executed 26 times by 2 tests: end of block Executed by:
| 26 | ||||||||||||||||||
109 | } | - | ||||||||||||||||||
110 | } never executed: end of block | 0 | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager, | - | ||||||||||||||||||
113 | const QNetworkRequest& request, | - | ||||||||||||||||||
114 | QNetworkAccessManager::Operation& operation, | - | ||||||||||||||||||
115 | QIODevice* outgoingData) | - | ||||||||||||||||||
116 | : QNetworkReply(*new QNetworkReplyHttpImplPrivate, manager) | - | ||||||||||||||||||
117 | { | - | ||||||||||||||||||
118 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
119 | d->manager = manager; | - | ||||||||||||||||||
120 | d->managerPrivate = manager->d_func(); | - | ||||||||||||||||||
121 | d->request = request; | - | ||||||||||||||||||
122 | d->originalRequest = request; | - | ||||||||||||||||||
123 | d->operation = operation; | - | ||||||||||||||||||
124 | d->outgoingData = outgoingData; | - | ||||||||||||||||||
125 | d->url = request.url(); | - | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | d->sslConfiguration = request.sslConfiguration(); | - | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | - | |||||||||||||||||||
130 | - | |||||||||||||||||||
131 | QIODevice::open(QIODevice::ReadOnly); | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | - | |||||||||||||||||||
135 | - | |||||||||||||||||||
136 | QVariant synchronousHttpAttribute = request.attribute( | - | ||||||||||||||||||
137 | static_cast<QNetworkRequest::Attribute>(QNetworkRequest::SynchronousRequestAttribute)); | - | ||||||||||||||||||
138 | if (synchronousHttpAttribute.isValid()
| 76-811 | ||||||||||||||||||
139 | d->synchronous = synchronousHttpAttribute.toBool(); | - | ||||||||||||||||||
140 | if (d->synchronous
| 0-76 | ||||||||||||||||||
141 | - | |||||||||||||||||||
142 | - | |||||||||||||||||||
143 | d->outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); | - | ||||||||||||||||||
144 | qint64 previousDataSize = 0; | - | ||||||||||||||||||
145 | do { | - | ||||||||||||||||||
146 | previousDataSize = d->outgoingDataBuffer->size(); | - | ||||||||||||||||||
147 | d->outgoingDataBuffer->append(d->outgoingData->readAll()); | - | ||||||||||||||||||
148 | } executed 77 times by 1 test: while (d->outgoingDataBuffer->size() != previousDataSizeend of block Executed by:
| 36-77 | ||||||||||||||||||
149 | d->_q_startOperation(); | - | ||||||||||||||||||
150 | return; executed 41 times by 1 test: return; Executed by:
| 41 | ||||||||||||||||||
151 | } | - | ||||||||||||||||||
152 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||
153 | - | |||||||||||||||||||
154 | - | |||||||||||||||||||
155 | if (outgoingData
| 155-691 | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | - | |||||||||||||||||||
158 | if (!d->outgoingData->isSequential()
| 59-96 | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | - | |||||||||||||||||||
161 | QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); | - | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | } executed 96 times by 3 tests: else {end of block Executed by:
| 96 | ||||||||||||||||||
164 | bool bufferingDisallowed = | - | ||||||||||||||||||
165 | request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, | - | ||||||||||||||||||
166 | false).toBool(); | - | ||||||||||||||||||
167 | - | |||||||||||||||||||
168 | if (bufferingDisallowed
| 1-58 | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | - | |||||||||||||||||||
171 | if (request.header(QNetworkRequest::ContentLengthHeader).isValid()
| 0-1 | ||||||||||||||||||
172 | QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection); | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | } executed 1 time by 1 test: else {end of block Executed by:
| 1 | ||||||||||||||||||
175 | d->state = d->Buffering; | - | ||||||||||||||||||
176 | QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); | - | ||||||||||||||||||
177 | } never executed: end of block | 0 | ||||||||||||||||||
178 | } else { | - | ||||||||||||||||||
179 | - | |||||||||||||||||||
180 | d->state = d->Buffering; | - | ||||||||||||||||||
181 | QMetaObject::invokeMethod(this, "_q_bufferOutgoingData", Qt::QueuedConnection); | - | ||||||||||||||||||
182 | } executed 58 times by 1 test: end of block Executed by:
| 58 | ||||||||||||||||||
183 | } | - | ||||||||||||||||||
184 | } else { | - | ||||||||||||||||||
185 | - | |||||||||||||||||||
186 | d->_q_startOperation(); | - | ||||||||||||||||||
187 | } executed 691 times by 7 tests: end of block Executed by:
| 691 | ||||||||||||||||||
188 | } | - | ||||||||||||||||||
189 | - | |||||||||||||||||||
190 | QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() | - | ||||||||||||||||||
191 | { | - | ||||||||||||||||||
192 | - | |||||||||||||||||||
193 | abortHttpRequest(); | - | ||||||||||||||||||
194 | } executed 886 times by 9 tests: end of block Executed by:
| 886 | ||||||||||||||||||
195 | - | |||||||||||||||||||
196 | void QNetworkReplyHttpImpl::close() | - | ||||||||||||||||||
197 | { | - | ||||||||||||||||||
198 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
199 | - | |||||||||||||||||||
200 | if (d->state == QNetworkReplyPrivate::Aborted
| 0-1 | ||||||||||||||||||
201 | d->state == QNetworkReplyPrivate::Finished
| 0-1 | ||||||||||||||||||
202 | return; never executed: return; | 0 | ||||||||||||||||||
203 | - | |||||||||||||||||||
204 | - | |||||||||||||||||||
205 | - | |||||||||||||||||||
206 | QNetworkReply::close(); | - | ||||||||||||||||||
207 | - | |||||||||||||||||||
208 | - | |||||||||||||||||||
209 | - | |||||||||||||||||||
210 | d->error(OperationCanceledError, tr("Operation canceled")); | - | ||||||||||||||||||
211 | d->finished(); | - | ||||||||||||||||||
212 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
213 | - | |||||||||||||||||||
214 | void QNetworkReplyHttpImpl::abort() | - | ||||||||||||||||||
215 | { | - | ||||||||||||||||||
216 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | if (d->state == QNetworkReplyPrivate::Finished
| 0-2 | ||||||||||||||||||
219 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||||||||
220 | - | |||||||||||||||||||
221 | QNetworkReply::close(); | - | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | if (d->state != QNetworkReplyPrivate::Finished
| 0-2 | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | - | |||||||||||||||||||
226 | d->error(OperationCanceledError, tr("Operation canceled")); | - | ||||||||||||||||||
227 | - | |||||||||||||||||||
228 | - | |||||||||||||||||||
229 | if (d->state == QNetworkReplyPrivate::WaitingForSession
| 0-2 | ||||||||||||||||||
230 | d->state = QNetworkReplyPrivate::Working; never executed: d->state = QNetworkReplyPrivate::Working; | 0 | ||||||||||||||||||
231 | d->finished(); | - | ||||||||||||||||||
232 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
233 | - | |||||||||||||||||||
234 | d->state = QNetworkReplyPrivate::Aborted; | - | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | abortHttpRequest(); | - | ||||||||||||||||||
237 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | qint64 QNetworkReplyHttpImpl::bytesAvailable() const | - | ||||||||||||||||||
240 | { | - | ||||||||||||||||||
241 | const QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | - | |||||||||||||||||||
244 | if (d->cacheLoadDevice
| 0-1687 | ||||||||||||||||||
245 | return never executed: QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable() + d->downloadMultiBuffer.byteAmount();return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable() + d->downloadMultiBuffer.byteAmount(); never executed: return QNetworkReply::bytesAvailable() + d->cacheLoadDevice->bytesAvailable() + d->downloadMultiBuffer.byteAmount(); | 0 | ||||||||||||||||||
246 | } | - | ||||||||||||||||||
247 | - | |||||||||||||||||||
248 | - | |||||||||||||||||||
249 | if (d->downloadZerocopyBuffer
| 486-1201 | ||||||||||||||||||
250 | return executed 1201 times by 1 test: QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition;return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition; Executed by:
executed 1201 times by 1 test: return QNetworkReply::bytesAvailable() + d->downloadBufferCurrentSize - d->downloadBufferReadPosition; Executed by:
| 1201 | ||||||||||||||||||
251 | } | - | ||||||||||||||||||
252 | - | |||||||||||||||||||
253 | - | |||||||||||||||||||
254 | return executed 486 times by 1 test: QNetworkReply::bytesAvailable() + d->downloadMultiBuffer.byteAmount();return QNetworkReply::bytesAvailable() + d->downloadMultiBuffer.byteAmount(); Executed by:
executed 486 times by 1 test: return QNetworkReply::bytesAvailable() + d->downloadMultiBuffer.byteAmount(); Executed by:
| 486 | ||||||||||||||||||
255 | } | - | ||||||||||||||||||
256 | - | |||||||||||||||||||
257 | bool QNetworkReplyHttpImpl::isSequential () const | - | ||||||||||||||||||
258 | { | - | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | - | |||||||||||||||||||
261 | return executed 574 times by 3 tests: true;return true; Executed by:
executed 574 times by 3 tests: return true; Executed by:
| 574 | ||||||||||||||||||
262 | } | - | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | qint64 QNetworkReplyHttpImpl::size() const | - | ||||||||||||||||||
265 | { | - | ||||||||||||||||||
266 | - | |||||||||||||||||||
267 | return executed 67 times by 1 test: QNetworkReply::size();return QNetworkReply::size(); Executed by:
executed 67 times by 1 test: return QNetworkReply::size(); Executed by:
| 67 | ||||||||||||||||||
268 | } | - | ||||||||||||||||||
269 | - | |||||||||||||||||||
270 | qint64 QNetworkReplyHttpImpl::readData(char* data, qint64 maxlen) | - | ||||||||||||||||||
271 | { | - | ||||||||||||||||||
272 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
273 | - | |||||||||||||||||||
274 | - | |||||||||||||||||||
275 | if (d->cacheLoadDevice
| 0-1510 | ||||||||||||||||||
276 | - | |||||||||||||||||||
277 | - | |||||||||||||||||||
278 | - | |||||||||||||||||||
279 | - | |||||||||||||||||||
280 | if (!d->downloadMultiBuffer.isEmpty()
| 0 | ||||||||||||||||||
281 | return never executed: d->downloadMultiBuffer.read(data, maxlen);return d->downloadMultiBuffer.read(data, maxlen); never executed: return d->downloadMultiBuffer.read(data, maxlen); | 0 | ||||||||||||||||||
282 | } | - | ||||||||||||||||||
283 | - | |||||||||||||||||||
284 | qint64 ret = d->cacheLoadDevice->read(data, maxlen); | - | ||||||||||||||||||
285 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
286 | } | - | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | - | |||||||||||||||||||
289 | if (d->downloadZerocopyBuffer
| 593-917 | ||||||||||||||||||
290 | - | |||||||||||||||||||
291 | - | |||||||||||||||||||
292 | qint64 howMuch = qMin(maxlen, (d->downloadBufferCurrentSize - d->downloadBufferReadPosition)); | - | ||||||||||||||||||
293 | memcpy(data, d->downloadZerocopyBuffer + d->downloadBufferReadPosition, howMuch); | - | ||||||||||||||||||
294 | d->downloadBufferReadPosition += howMuch; | - | ||||||||||||||||||
295 | return executed 593 times by 2 tests: howMuch;return howMuch; Executed by:
executed 593 times by 2 tests: return howMuch; Executed by:
| 593 | ||||||||||||||||||
296 | - | |||||||||||||||||||
297 | } | - | ||||||||||||||||||
298 | - | |||||||||||||||||||
299 | - | |||||||||||||||||||
300 | if (d->downloadMultiBuffer.isEmpty()
| 395-522 | ||||||||||||||||||
301 | if (d->state == d->Finished
| 0-286 | ||||||||||||||||||
302 | return executed 286 times by 3 tests: -1;return -1; Executed by:
executed 286 times by 3 tests: return -1; Executed by:
| 286 | ||||||||||||||||||
303 | return executed 109 times by 1 test: 0;return 0; Executed by:
executed 109 times by 1 test: return 0; Executed by:
| 109 | ||||||||||||||||||
304 | } | - | ||||||||||||||||||
305 | - | |||||||||||||||||||
306 | if (maxlen == 1
| 0-522 | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | *data = d->downloadMultiBuffer.getChar(); | - | ||||||||||||||||||
309 | if (readBufferSize()
| 0 | ||||||||||||||||||
310 | readBufferFreed(1); never executed: readBufferFreed(1); | 0 | ||||||||||||||||||
311 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
312 | } | - | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | maxlen = qMin<qint64>(maxlen, d->downloadMultiBuffer.byteAmount()); | - | ||||||||||||||||||
315 | qint64 bytesRead = d->downloadMultiBuffer.read(data, maxlen); | - | ||||||||||||||||||
316 | if (readBufferSize()
| 150-372 | ||||||||||||||||||
317 | readBufferFreed(bytesRead); executed 150 times by 1 test: readBufferFreed(bytesRead); Executed by:
| 150 | ||||||||||||||||||
318 | return executed 522 times by 3 tests: bytesRead;return bytesRead; Executed by:
executed 522 times by 3 tests: return bytesRead; Executed by:
| 522 | ||||||||||||||||||
319 | } | - | ||||||||||||||||||
320 | - | |||||||||||||||||||
321 | void QNetworkReplyHttpImpl::setReadBufferSize(qint64 size) | - | ||||||||||||||||||
322 | { | - | ||||||||||||||||||
323 | QNetworkReply::setReadBufferSize(size); | - | ||||||||||||||||||
324 | readBufferSizeChanged(size); | - | ||||||||||||||||||
325 | return; executed 18 times by 1 test: return; Executed by:
| 18 | ||||||||||||||||||
326 | } | - | ||||||||||||||||||
327 | - | |||||||||||||||||||
328 | bool QNetworkReplyHttpImpl::canReadLine () const | - | ||||||||||||||||||
329 | { | - | ||||||||||||||||||
330 | const QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
331 | - | |||||||||||||||||||
332 | if (QNetworkReply::canReadLine()
| 1-5 | ||||||||||||||||||
333 | return executed 1 time by 1 test: true;return true; Executed by:
executed 1 time by 1 test: return true; Executed by:
| 1 | ||||||||||||||||||
334 | - | |||||||||||||||||||
335 | if (d->cacheLoadDevice
| 0-5 | ||||||||||||||||||
336 | return never executed: d->cacheLoadDevice->canReadLine()return d->cacheLoadDevice->canReadLine() || d->downloadMultiBuffer.canReadLine();
never executed: return d->cacheLoadDevice->canReadLine() || d->downloadMultiBuffer.canReadLine(); | 0 | ||||||||||||||||||
337 | - | |||||||||||||||||||
338 | if (d->downloadZerocopyBuffer
| 0-5 | ||||||||||||||||||
339 | return executed 5 times by 1 test: memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition);return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition); Executed by:
executed 5 times by 1 test: return memchr(d->downloadZerocopyBuffer + d->downloadBufferReadPosition, '\n', d->downloadBufferCurrentSize - d->downloadBufferReadPosition); Executed by:
| 5 | ||||||||||||||||||
340 | - | |||||||||||||||||||
341 | return never executed: d->downloadMultiBuffer.canReadLine();return d->downloadMultiBuffer.canReadLine(); never executed: return d->downloadMultiBuffer.canReadLine(); | 0 | ||||||||||||||||||
342 | } | - | ||||||||||||||||||
343 | - | |||||||||||||||||||
344 | - | |||||||||||||||||||
345 | void QNetworkReplyHttpImpl::ignoreSslErrors() | - | ||||||||||||||||||
346 | { | - | ||||||||||||||||||
347 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
348 | - | |||||||||||||||||||
349 | d->pendingIgnoreAllSslErrors = true; | - | ||||||||||||||||||
350 | } executed 143 times by 2 tests: end of block Executed by:
| 143 | ||||||||||||||||||
351 | - | |||||||||||||||||||
352 | void QNetworkReplyHttpImpl::ignoreSslErrorsImplementation(const QList<QSslError> &errors) | - | ||||||||||||||||||
353 | { | - | ||||||||||||||||||
354 | QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
355 | - | |||||||||||||||||||
356 | - | |||||||||||||||||||
357 | - | |||||||||||||||||||
358 | d->pendingIgnoreSslErrorsList = errors; | - | ||||||||||||||||||
359 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
360 | - | |||||||||||||||||||
361 | void QNetworkReplyHttpImpl::setSslConfigurationImplementation(const QSslConfiguration &newconfig) | - | ||||||||||||||||||
362 | { | - | ||||||||||||||||||
363 | - | |||||||||||||||||||
364 | - | |||||||||||||||||||
365 | (void)newconfig;; | - | ||||||||||||||||||
366 | } never executed: end of block | 0 | ||||||||||||||||||
367 | - | |||||||||||||||||||
368 | void QNetworkReplyHttpImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const | - | ||||||||||||||||||
369 | { | - | ||||||||||||||||||
370 | const QNetworkReplyHttpImplPrivate * const d = d_func(); | - | ||||||||||||||||||
371 | configuration = d->sslConfiguration; | - | ||||||||||||||||||
372 | } executed 211 times by 2 tests: end of block Executed by:
| 211 | ||||||||||||||||||
373 | - | |||||||||||||||||||
374 | - | |||||||||||||||||||
375 | QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate() | - | ||||||||||||||||||
376 | : QNetworkReplyPrivate() | - | ||||||||||||||||||
377 | , manager(0) | - | ||||||||||||||||||
378 | , managerPrivate(0) | - | ||||||||||||||||||
379 | , synchronous(false) | - | ||||||||||||||||||
380 | , state(Idle) | - | ||||||||||||||||||
381 | , statusCode(0) | - | ||||||||||||||||||
382 | , uploadByteDevicePosition(false) | - | ||||||||||||||||||
383 | , uploadDeviceChoking(false) | - | ||||||||||||||||||
384 | , outgoingData(0) | - | ||||||||||||||||||
385 | , bytesUploaded(-1) | - | ||||||||||||||||||
386 | , cacheLoadDevice(0) | - | ||||||||||||||||||
387 | , loadingFromCache(false) | - | ||||||||||||||||||
388 | , cacheSaveDevice(0) | - | ||||||||||||||||||
389 | , cacheEnabled(false) | - | ||||||||||||||||||
390 | , resumeOffset(0) | - | ||||||||||||||||||
391 | , preMigrationDownloaded(-1) | - | ||||||||||||||||||
392 | , bytesDownloaded(0) | - | ||||||||||||||||||
393 | , downloadBufferReadPosition(0) | - | ||||||||||||||||||
394 | , downloadBufferCurrentSize(0) | - | ||||||||||||||||||
395 | , downloadZerocopyBuffer(0) | - | ||||||||||||||||||
396 | , pendingDownloadDataEmissions(QSharedPointer<QAtomicInt>::create()) | - | ||||||||||||||||||
397 | , pendingDownloadProgressEmissions(QSharedPointer<QAtomicInt>::create()) | - | ||||||||||||||||||
398 | - | |||||||||||||||||||
399 | , pendingIgnoreAllSslErrors(false) | - | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | - | |||||||||||||||||||
402 | { | - | ||||||||||||||||||
403 | } executed 887 times by 8 tests: end of block Executed by:
| 887 | ||||||||||||||||||
404 | - | |||||||||||||||||||
405 | QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate() | - | ||||||||||||||||||
406 | { | - | ||||||||||||||||||
407 | } | - | ||||||||||||||||||
408 | - | |||||||||||||||||||
409 | - | |||||||||||||||||||
410 | - | |||||||||||||||||||
411 | - | |||||||||||||||||||
412 | - | |||||||||||||||||||
413 | - | |||||||||||||||||||
414 | - | |||||||||||||||||||
415 | bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &httpRequest) | - | ||||||||||||||||||
416 | { | - | ||||||||||||||||||
417 | QNetworkRequest::CacheLoadControl CacheLoadControlAttribute = | - | ||||||||||||||||||
418 | (QNetworkRequest::CacheLoadControl)request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(); | - | ||||||||||||||||||
419 | if (CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork
| 12-668 | ||||||||||||||||||
420 | - | |||||||||||||||||||
421 | - | |||||||||||||||||||
422 | if (!request.rawHeaderList().contains("Cache-Control")
| 0-12 | ||||||||||||||||||
423 | httpRequest.setHeaderField("Cache-Control", "no-cache"); | - | ||||||||||||||||||
424 | httpRequest.setHeaderField("Pragma", "no-cache"); | - | ||||||||||||||||||
425 | } executed 12 times by 2 tests: end of block Executed by:
| 12 | ||||||||||||||||||
426 | return executed 12 times by 2 tests: false;return false; Executed by:
executed 12 times by 2 tests: return false; Executed by:
| 12 | ||||||||||||||||||
427 | } | - | ||||||||||||||||||
428 | - | |||||||||||||||||||
429 | - | |||||||||||||||||||
430 | - | |||||||||||||||||||
431 | if (request.hasRawHeader("Range")
| 2-666 | ||||||||||||||||||
432 | return executed 2 times by 1 test: false;return false; Executed by:
executed 2 times by 1 test: return false; Executed by:
| 2 | ||||||||||||||||||
433 | - | |||||||||||||||||||
434 | QAbstractNetworkCache *nc = managerPrivate->networkCache; | - | ||||||||||||||||||
435 | if (!nc
| 87-579 | ||||||||||||||||||
436 | return executed 579 times by 6 tests: false;return false; Executed by:
executed 579 times by 6 tests: return false; Executed by:
| 579 | ||||||||||||||||||
437 | - | |||||||||||||||||||
438 | QNetworkCacheMetaData metaData = nc->metaData(httpRequest.url()); | - | ||||||||||||||||||
439 | if (!metaData.isValid()
| 37-50 | ||||||||||||||||||
440 | return executed 50 times by 3 tests: false;return false; Executed by:
executed 50 times by 3 tests: return false; Executed by:
| 50 | ||||||||||||||||||
441 | - | |||||||||||||||||||
442 | if (!metaData.saveToDisk()
| 0-37 | ||||||||||||||||||
443 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
444 | - | |||||||||||||||||||
445 | QNetworkHeadersPrivate cacheHeaders; | - | ||||||||||||||||||
446 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - | ||||||||||||||||||
447 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - | ||||||||||||||||||
448 | - | |||||||||||||||||||
449 | it = cacheHeaders.findRawHeader("etag"); | - | ||||||||||||||||||
450 | if (it != cacheHeaders.rawHeaders.constEnd()
| 4-33 | ||||||||||||||||||
451 | httpRequest.setHeaderField("If-None-Match", it->second); executed 4 times by 1 test: httpRequest.setHeaderField("If-None-Match", it->second); Executed by:
| 4 | ||||||||||||||||||
452 | - | |||||||||||||||||||
453 | QDateTime lastModified = metaData.lastModified(); | - | ||||||||||||||||||
454 | if (lastModified.isValid()
| 15-22 | ||||||||||||||||||
455 | httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); executed 22 times by 2 tests: httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); Executed by:
| 22 | ||||||||||||||||||
456 | - | |||||||||||||||||||
457 | it = cacheHeaders.findRawHeader("Cache-Control"); | - | ||||||||||||||||||
458 | if (it != cacheHeaders.rawHeaders.constEnd()
| 15-22 | ||||||||||||||||||
459 | QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); | - | ||||||||||||||||||
460 | if (cacheControl.contains("must-revalidate")
| 6-16 | ||||||||||||||||||
461 | return executed 6 times by 2 tests: false;return false; Executed by:
executed 6 times by 2 tests: return false; Executed by:
| 6 | ||||||||||||||||||
462 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||
463 | - | |||||||||||||||||||
464 | QDateTime currentDateTime = QDateTime::currentDateTimeUtc(); | - | ||||||||||||||||||
465 | QDateTime expirationDate = metaData.expirationDate(); | - | ||||||||||||||||||
466 | - | |||||||||||||||||||
467 | bool response_is_fresh; | - | ||||||||||||||||||
468 | if (!expirationDate.isValid()
| 9-22 | ||||||||||||||||||
469 | int age_value = 0; | - | ||||||||||||||||||
470 | it = cacheHeaders.findRawHeader("age"); | - | ||||||||||||||||||
471 | if (it != cacheHeaders.rawHeaders.constEnd()
| 0-9 | ||||||||||||||||||
472 | age_value = it->second.toInt(); never executed: age_value = it->second.toInt(); | 0 | ||||||||||||||||||
473 | - | |||||||||||||||||||
474 | QDateTime dateHeader; | - | ||||||||||||||||||
475 | int date_value = 0; | - | ||||||||||||||||||
476 | it = cacheHeaders.findRawHeader("date"); | - | ||||||||||||||||||
477 | if (it != cacheHeaders.rawHeaders.constEnd()
| 1-8 | ||||||||||||||||||
478 | dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second); | - | ||||||||||||||||||
479 | date_value = dateHeader.toTime_t(); | - | ||||||||||||||||||
480 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | int now = currentDateTime.toTime_t(); | - | ||||||||||||||||||
483 | int request_time = now; | - | ||||||||||||||||||
484 | int response_time = now; | - | ||||||||||||||||||
485 | - | |||||||||||||||||||
486 | - | |||||||||||||||||||
487 | int apparent_age = qMax(0, response_time - date_value); | - | ||||||||||||||||||
488 | int corrected_received_age = qMax(apparent_age, age_value); | - | ||||||||||||||||||
489 | int response_delay = response_time - request_time; | - | ||||||||||||||||||
490 | int corrected_initial_age = corrected_received_age + response_delay; | - | ||||||||||||||||||
491 | int resident_time = now - response_time; | - | ||||||||||||||||||
492 | int current_age = corrected_initial_age + resident_time; | - | ||||||||||||||||||
493 | - | |||||||||||||||||||
494 | int freshness_lifetime = 0; | - | ||||||||||||||||||
495 | - | |||||||||||||||||||
496 | - | |||||||||||||||||||
497 | if (lastModified.isValid()
| 0-5 | ||||||||||||||||||
498 | int diff = lastModified.secsTo(dateHeader); | - | ||||||||||||||||||
499 | freshness_lifetime = diff / 10; | - | ||||||||||||||||||
500 | if (httpRequest.headerField("Warning").isEmpty()
| 0-4 | ||||||||||||||||||
501 | QDateTime dt = currentDateTime.addSecs(current_age); | - | ||||||||||||||||||
502 | if (currentDateTime.daysTo(dt) > 1
| 0-4 | ||||||||||||||||||
503 | httpRequest.setHeaderField("Warning", "113"); never executed: httpRequest.setHeaderField("Warning", "113"); | 0 | ||||||||||||||||||
504 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
505 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
506 | - | |||||||||||||||||||
507 | - | |||||||||||||||||||
508 | - | |||||||||||||||||||
509 | response_is_fresh = (freshness_lifetime > current_age); | - | ||||||||||||||||||
510 | } executed 9 times by 2 tests: else {end of block Executed by:
| 9 | ||||||||||||||||||
511 | - | |||||||||||||||||||
512 | response_is_fresh = currentDateTime.secsTo(expirationDate) >= 0; | - | ||||||||||||||||||
513 | } executed 22 times by 2 tests: end of block Executed by:
| 22 | ||||||||||||||||||
514 | - | |||||||||||||||||||
515 | if (!response_is_fresh
| 13-18 | ||||||||||||||||||
516 | return executed 13 times by 3 tests: false;return false; Executed by:
executed 13 times by 3 tests: return false; Executed by:
| 13 | ||||||||||||||||||
517 | - | |||||||||||||||||||
518 | - | |||||||||||||||||||
519 | - | |||||||||||||||||||
520 | - | |||||||||||||||||||
521 | return executed 18 times by 2 tests: sendCacheContents(metaData);return sendCacheContents(metaData); Executed by:
executed 18 times by 2 tests: return sendCacheContents(metaData); Executed by:
| 18 | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | QHttpNetworkRequest::Priority QNetworkReplyHttpImplPrivate::convert(const QNetworkRequest::Priority& prio) | - | ||||||||||||||||||
525 | { | - | ||||||||||||||||||
526 | switch (prio) { | - | ||||||||||||||||||
527 | case never executed: QNetworkRequest::LowPriority:case QNetworkRequest::LowPriority: never executed: case QNetworkRequest::LowPriority: | 0 | ||||||||||||||||||
528 | return never executed: QHttpNetworkRequest::LowPriority;return QHttpNetworkRequest::LowPriority; never executed: return QHttpNetworkRequest::LowPriority; | 0 | ||||||||||||||||||
529 | case never executed: QNetworkRequest::HighPriority:case QNetworkRequest::HighPriority: never executed: case QNetworkRequest::HighPriority: | 0 | ||||||||||||||||||
530 | return never executed: QHttpNetworkRequest::HighPriority;return QHttpNetworkRequest::HighPriority; never executed: return QHttpNetworkRequest::HighPriority; | 0 | ||||||||||||||||||
531 | case executed 887 times by 8 tests: QNetworkRequest::NormalPriority:case QNetworkRequest::NormalPriority: Executed by:
executed 887 times by 8 tests: case QNetworkRequest::NormalPriority: Executed by:
| 887 | ||||||||||||||||||
532 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
533 | return executed 887 times by 8 tests: QHttpNetworkRequest::NormalPriority;return QHttpNetworkRequest::NormalPriority; Executed by:
executed 887 times by 8 tests: return QHttpNetworkRequest::NormalPriority; Executed by:
| 887 | ||||||||||||||||||
534 | } | - | ||||||||||||||||||
535 | } | - | ||||||||||||||||||
536 | - | |||||||||||||||||||
537 | void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpRequest) | - | ||||||||||||||||||
538 | { | - | ||||||||||||||||||
539 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
540 | - | |||||||||||||||||||
541 | QThread *thread = 0; | - | ||||||||||||||||||
542 | if (synchronous
| 76-814 | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | thread = new QThread(); | - | ||||||||||||||||||
545 | thread->setObjectName(([]() -> QString { enum { Size = sizeof(u"" "Qt HTTP synchronous thread")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Qt HTTP synchronous thread" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 76 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 76 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 76 | ||||||||||||||||||
546 | QObject::connect(thread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "610"), thread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "610")); | - | ||||||||||||||||||
547 | thread->start(); | - | ||||||||||||||||||
548 | } executed 76 times by 1 test: else if (!managerPrivate->httpThreadend of block Executed by:
| 76-471 | ||||||||||||||||||
549 | - | |||||||||||||||||||
550 | - | |||||||||||||||||||
551 | managerPrivate->httpThread = new QThread(); | - | ||||||||||||||||||
552 | managerPrivate->httpThread->setObjectName(([]() -> QString { enum { Size = sizeof(u"" "Qt HTTP thread")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Qt HTTP thread" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 471 times by 8 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 471 times by 8 tests: }()));return qstring_literal_temp; Executed by:
| 471 | ||||||||||||||||||
553 | managerPrivate->httpThread->start(); | - | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | thread = managerPrivate->httpThread; | - | ||||||||||||||||||
556 | } executed 471 times by 8 tests: else {end of block Executed by:
| 471 | ||||||||||||||||||
557 | - | |||||||||||||||||||
558 | thread = managerPrivate->httpThread; | - | ||||||||||||||||||
559 | } executed 343 times by 4 tests: end of block Executed by:
| 343 | ||||||||||||||||||
560 | - | |||||||||||||||||||
561 | QUrl url = newHttpRequest.url(); | - | ||||||||||||||||||
562 | httpRequest.setUrl(url); | - | ||||||||||||||||||
563 | httpRequest.setRedirectCount(newHttpRequest.maximumRedirectsAllowed()); | - | ||||||||||||||||||
564 | - | |||||||||||||||||||
565 | QString scheme = url.scheme(); | - | ||||||||||||||||||
566 | bool ssl = (scheme == QLatin1String("https")
| 231-659 | ||||||||||||||||||
567 | || scheme == QLatin1String("preconnect-https")
| 0-659 | ||||||||||||||||||
568 | q->setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, ssl); | - | ||||||||||||||||||
569 | httpRequest.setSsl(ssl); | - | ||||||||||||||||||
570 | - | |||||||||||||||||||
571 | bool preConnect = (scheme == QLatin1String("preconnect-http")
| 0-890 | ||||||||||||||||||
572 | || scheme == QLatin1String("preconnect-https")
| 0-890 | ||||||||||||||||||
573 | httpRequest.setPreConnect(preConnect); | - | ||||||||||||||||||
574 | - | |||||||||||||||||||
575 | - | |||||||||||||||||||
576 | QNetworkProxy transparentProxy, cacheProxy; | - | ||||||||||||||||||
577 | - | |||||||||||||||||||
578 | - | |||||||||||||||||||
579 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(managerPrivate->queryProxy(QNetworkProxyQuery(newHttpRequest.url())))>::type> _container_((managerPrivate->queryProxy(QNetworkProxyQuery(newHttpRequest.url())))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QNetworkProxy &p = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
580 | - | |||||||||||||||||||
581 | - | |||||||||||||||||||
582 | - | |||||||||||||||||||
583 | if (!ssl
| 234-661 | ||||||||||||||||||
584 | && (p.capabilities() & QNetworkProxy::CachingCapability) | - | ||||||||||||||||||
585 | && (p.type() == QNetworkProxy::HttpProxy
| 11-47 | ||||||||||||||||||
586 | p.type() == QNetworkProxy::HttpCachingProxy
| 3-8 | ||||||||||||||||||
587 | cacheProxy = p; | - | ||||||||||||||||||
588 | transparentProxy = QNetworkProxy::NoProxy; | - | ||||||||||||||||||
589 | break; executed 55 times by 1 test: break; Executed by:
| 55 | ||||||||||||||||||
590 | } | - | ||||||||||||||||||
591 | if (p.isTransparentProxy()
| 8-832 | ||||||||||||||||||
592 | transparentProxy = p; | - | ||||||||||||||||||
593 | cacheProxy = QNetworkProxy::NoProxy; | - | ||||||||||||||||||
594 | break; executed 832 times by 8 tests: break; Executed by:
| 832 | ||||||||||||||||||
595 | } | - | ||||||||||||||||||
596 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
597 | - | |||||||||||||||||||
598 | - | |||||||||||||||||||
599 | if (transparentProxy.type() == QNetworkProxy::DefaultProxy
| 3-887 | ||||||||||||||||||
600 | cacheProxy.type() == QNetworkProxy::DefaultProxy
| 0-3 | ||||||||||||||||||
601 | - | |||||||||||||||||||
602 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - | ||||||||||||||||||
603 | QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::ProxyNotFoundError), | - | ||||||||||||||||||
604 | QArgument<QString >("QString", QNetworkReplyHttpImpl::tr("No suitable proxy found"))); | - | ||||||||||||||||||
605 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - | ||||||||||||||||||
606 | return; executed 3 times by 1 test: return; Executed by:
| 3 | ||||||||||||||||||
607 | } | - | ||||||||||||||||||
608 | - | |||||||||||||||||||
609 | - | |||||||||||||||||||
610 | if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool()
| 9-878 | ||||||||||||||||||
611 | httpRequest.setFollowRedirects(true); executed 9 times by 1 test: httpRequest.setFollowRedirects(true); Executed by:
| 9 | ||||||||||||||||||
612 | - | |||||||||||||||||||
613 | httpRequest.setPriority(convert(newHttpRequest.priority())); | - | ||||||||||||||||||
614 | - | |||||||||||||||||||
615 | switch (operation) { | - | ||||||||||||||||||
616 | case executed 654 times by 7 tests: QNetworkAccessManager::GetOperation:case QNetworkAccessManager::GetOperation: Executed by:
executed 654 times by 7 tests: case QNetworkAccessManager::GetOperation: Executed by:
| 654 | ||||||||||||||||||
617 | httpRequest.setOperation(QHttpNetworkRequest::Get); | - | ||||||||||||||||||
618 | if (loadFromCacheIfAllowed(httpRequest)
| 18-636 | ||||||||||||||||||
619 | return; executed 18 times by 2 tests: return; Executed by:
| 18 | ||||||||||||||||||
620 | break; executed 636 times by 7 tests: break; Executed by:
| 636 | ||||||||||||||||||
621 | - | |||||||||||||||||||
622 | case executed 26 times by 1 test: QNetworkAccessManager::HeadOperation:case QNetworkAccessManager::HeadOperation: Executed by:
executed 26 times by 1 test: case QNetworkAccessManager::HeadOperation: Executed by:
| 26 | ||||||||||||||||||
623 | httpRequest.setOperation(QHttpNetworkRequest::Head); | - | ||||||||||||||||||
624 | if (loadFromCacheIfAllowed(httpRequest)
| 0-26 | ||||||||||||||||||
625 | return; never executed: return; | 0 | ||||||||||||||||||
626 | break; executed 26 times by 1 test: break; Executed by:
| 26 | ||||||||||||||||||
627 | - | |||||||||||||||||||
628 | case executed 157 times by 3 tests: QNetworkAccessManager::PostOperation:case QNetworkAccessManager::PostOperation: Executed by:
executed 157 times by 3 tests: case QNetworkAccessManager::PostOperation: Executed by:
| 157 | ||||||||||||||||||
629 | invalidateCache(); | - | ||||||||||||||||||
630 | httpRequest.setOperation(QHttpNetworkRequest::Post); | - | ||||||||||||||||||
631 | createUploadByteDevice(); | - | ||||||||||||||||||
632 | break; executed 157 times by 3 tests: break; Executed by:
| 157 | ||||||||||||||||||
633 | - | |||||||||||||||||||
634 | case executed 36 times by 2 tests: QNetworkAccessManager::PutOperation:case QNetworkAccessManager::PutOperation: Executed by:
executed 36 times by 2 tests: case QNetworkAccessManager::PutOperation: Executed by:
| 36 | ||||||||||||||||||
635 | invalidateCache(); | - | ||||||||||||||||||
636 | httpRequest.setOperation(QHttpNetworkRequest::Put); | - | ||||||||||||||||||
637 | createUploadByteDevice(); | - | ||||||||||||||||||
638 | break; executed 36 times by 2 tests: break; Executed by:
| 36 | ||||||||||||||||||
639 | - | |||||||||||||||||||
640 | case executed 7 times by 1 test: QNetworkAccessManager::DeleteOperation:case QNetworkAccessManager::DeleteOperation: Executed by:
executed 7 times by 1 test: case QNetworkAccessManager::DeleteOperation: Executed by:
| 7 | ||||||||||||||||||
641 | invalidateCache(); | - | ||||||||||||||||||
642 | httpRequest.setOperation(QHttpNetworkRequest::Delete); | - | ||||||||||||||||||
643 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||
644 | - | |||||||||||||||||||
645 | case executed 7 times by 1 test: QNetworkAccessManager::CustomOperation:case QNetworkAccessManager::CustomOperation: Executed by:
executed 7 times by 1 test: case QNetworkAccessManager::CustomOperation: Executed by:
| 7 | ||||||||||||||||||
646 | invalidateCache(); | - | ||||||||||||||||||
647 | httpRequest.setOperation(QHttpNetworkRequest::Custom); | - | ||||||||||||||||||
648 | createUploadByteDevice(); | - | ||||||||||||||||||
649 | httpRequest.setCustomVerb(newHttpRequest.attribute( | - | ||||||||||||||||||
650 | QNetworkRequest::CustomVerbAttribute).toByteArray()); | - | ||||||||||||||||||
651 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||
652 | - | |||||||||||||||||||
653 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
654 | break; never executed: break; | 0 | ||||||||||||||||||
655 | } | - | ||||||||||||||||||
656 | - | |||||||||||||||||||
657 | QList<QByteArray> headers = newHttpRequest.rawHeaderList(); | - | ||||||||||||||||||
658 | if (resumeOffset != 0
| 0-869 | ||||||||||||||||||
659 | if (headers.contains("Range")
| 0 | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | - | |||||||||||||||||||
662 | headers.removeOne("Range"); | - | ||||||||||||||||||
663 | - | |||||||||||||||||||
664 | - | |||||||||||||||||||
665 | QByteArray requestRange = newHttpRequest.rawHeader("Range").mid(6); | - | ||||||||||||||||||
666 | - | |||||||||||||||||||
667 | int index = requestRange.indexOf('-'); | - | ||||||||||||||||||
668 | - | |||||||||||||||||||
669 | quint64 requestStartOffset = requestRange.left(index).toULongLong(); | - | ||||||||||||||||||
670 | quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); | - | ||||||||||||||||||
671 | - | |||||||||||||||||||
672 | requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + | - | ||||||||||||||||||
673 | '-' + QByteArray::number(requestEndOffset); | - | ||||||||||||||||||
674 | - | |||||||||||||||||||
675 | httpRequest.setHeaderField("Range", requestRange); | - | ||||||||||||||||||
676 | } never executed: else {end of block | 0 | ||||||||||||||||||
677 | httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-'); | - | ||||||||||||||||||
678 | } never executed: end of block | 0 | ||||||||||||||||||
679 | } | - | ||||||||||||||||||
680 | - | |||||||||||||||||||
681 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(headers)>::type> _container_((headers)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QByteArray &header = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||
682 | httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header)); executed 319 times by 3 tests: httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header)); Executed by:
| 319 | ||||||||||||||||||
683 | - | |||||||||||||||||||
684 | if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool()
| 20-849 | ||||||||||||||||||
685 | httpRequest.setPipeliningAllowed(true); executed 20 times by 1 test: httpRequest.setPipeliningAllowed(true); Executed by:
| 20 | ||||||||||||||||||
686 | - | |||||||||||||||||||
687 | if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool()
| 113-756 | ||||||||||||||||||
688 | httpRequest.setSPDYAllowed(true); executed 113 times by 1 test: httpRequest.setSPDYAllowed(true); Executed by:
| 113 | ||||||||||||||||||
689 | - | |||||||||||||||||||
690 | if (static_cast<
| 1-868 | ||||||||||||||||||
691 | (newHttpRequest.attribute(QNetworkRequest::AuthenticationReuseAttribute,
| 1-868 | ||||||||||||||||||
692 | QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual
| 1-868 | ||||||||||||||||||
693 | httpRequest.setWithCredentials(false); executed 1 time by 1 test: httpRequest.setWithCredentials(false); Executed by:
| 1 | ||||||||||||||||||
694 | - | |||||||||||||||||||
695 | if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool()
| 1-868 | ||||||||||||||||||
696 | emitAllUploadProgressSignals = true; executed 1 time by 1 test: emitAllUploadProgressSignals = true; Executed by:
| 1 | ||||||||||||||||||
697 | - | |||||||||||||||||||
698 | - | |||||||||||||||||||
699 | - | |||||||||||||||||||
700 | QHttpThreadDelegate *delegate = new QHttpThreadDelegate; | - | ||||||||||||||||||
701 | - | |||||||||||||||||||
702 | delegate->networkSession = managerPrivate->getNetworkSession(); | - | ||||||||||||||||||
703 | - | |||||||||||||||||||
704 | - | |||||||||||||||||||
705 | - | |||||||||||||||||||
706 | - | |||||||||||||||||||
707 | QObject::connect(thread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "771"), delegate, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "771")); | - | ||||||||||||||||||
708 | - | |||||||||||||||||||
709 | - | |||||||||||||||||||
710 | delegate->httpRequest = httpRequest; | - | ||||||||||||||||||
711 | - | |||||||||||||||||||
712 | delegate->cacheProxy = cacheProxy; | - | ||||||||||||||||||
713 | delegate->transparentProxy = transparentProxy; | - | ||||||||||||||||||
714 | - | |||||||||||||||||||
715 | delegate->ssl = ssl; | - | ||||||||||||||||||
716 | - | |||||||||||||||||||
717 | if (ssl
| 229-640 | ||||||||||||||||||
718 | delegate-> executed 229 times by 2 tests: incomingSslConfiguration = newHttpRequest.sslConfiguration();delegate->incomingSslConfiguration = newHttpRequest.sslConfiguration(); Executed by:
executed 229 times by 2 tests: delegate->incomingSslConfiguration = newHttpRequest.sslConfiguration(); Executed by:
| 229 | ||||||||||||||||||
719 | - | |||||||||||||||||||
720 | - | |||||||||||||||||||
721 | - | |||||||||||||||||||
722 | delegate->synchronous = synchronous; | - | ||||||||||||||||||
723 | - | |||||||||||||||||||
724 | - | |||||||||||||||||||
725 | - | |||||||||||||||||||
726 | delegate->authenticationManager = managerPrivate->authenticationManager; | - | ||||||||||||||||||
727 | - | |||||||||||||||||||
728 | if (!synchronous
| 76-793 | ||||||||||||||||||
729 | - | |||||||||||||||||||
730 | QVariant downloadBufferMaximumSizeAttribute = newHttpRequest.attribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute); | - | ||||||||||||||||||
731 | if (downloadBufferMaximumSizeAttribute.isValid()
| 7-786 | ||||||||||||||||||
732 | delegate->downloadBufferMaximumSize = downloadBufferMaximumSizeAttribute.toLongLong(); | - | ||||||||||||||||||
733 | } executed 7 times by 1 test: else {end of block Executed by:
| 7 | ||||||||||||||||||
734 | - | |||||||||||||||||||
735 | - | |||||||||||||||||||
736 | - | |||||||||||||||||||
737 | delegate->downloadBufferMaximumSize = 128*1024; | - | ||||||||||||||||||
738 | } executed 786 times by 8 tests: end of block Executed by:
| 786 | ||||||||||||||||||
739 | - | |||||||||||||||||||
740 | - | |||||||||||||||||||
741 | - | |||||||||||||||||||
742 | delegate->pendingDownloadData = pendingDownloadDataEmissions; | - | ||||||||||||||||||
743 | delegate->pendingDownloadProgress = pendingDownloadProgressEmissions; | - | ||||||||||||||||||
744 | - | |||||||||||||||||||
745 | - | |||||||||||||||||||
746 | QObject::connect(delegate, qFlagLocation("2""downloadData(QByteArray)" "\0" __FILE__ ":" "810"), | - | ||||||||||||||||||
747 | q, qFlagLocation("1""replyDownloadData(QByteArray)" "\0" __FILE__ ":" "811"), | - | ||||||||||||||||||
748 | Qt::QueuedConnection); | - | ||||||||||||||||||
749 | QObject::connect(delegate, qFlagLocation("2""downloadFinished()" "\0" __FILE__ ":" "813"), | - | ||||||||||||||||||
750 | q, qFlagLocation("1""replyFinished()" "\0" __FILE__ ":" "814"), | - | ||||||||||||||||||
751 | Qt::QueuedConnection); | - | ||||||||||||||||||
752 | QObject::connect(delegate, qFlagLocation("2""downloadMetaData(QList<QPair<QByteArray,QByteArray> >, int, QString, bool, QSharedPointer<char>, qint64, bool)" "\0" | - | ||||||||||||||||||
753 | - | |||||||||||||||||||
754 | __FILE__ | - | ||||||||||||||||||
755 | ":" "818") | - | ||||||||||||||||||
756 | - | |||||||||||||||||||
757 | , | - | ||||||||||||||||||
758 | q, qFlagLocation("1""replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >, int, QString, bool, QSharedPointer<char>, qint64, bool)" "\0" | - | ||||||||||||||||||
759 | - | |||||||||||||||||||
760 | __FILE__ | - | ||||||||||||||||||
761 | ":" "821") | - | ||||||||||||||||||
762 | - | |||||||||||||||||||
763 | , | - | ||||||||||||||||||
764 | Qt::QueuedConnection); | - | ||||||||||||||||||
765 | QObject::connect(delegate, qFlagLocation("2""downloadProgress(qint64,qint64)" "\0" __FILE__ ":" "823"), | - | ||||||||||||||||||
766 | q, qFlagLocation("1""replyDownloadProgressSlot(qint64,qint64)" "\0" __FILE__ ":" "824"), | - | ||||||||||||||||||
767 | Qt::QueuedConnection); | - | ||||||||||||||||||
768 | QObject::connect(delegate, qFlagLocation("2""error(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "826"), | - | ||||||||||||||||||
769 | q, qFlagLocation("1""httpError(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "827"), | - | ||||||||||||||||||
770 | Qt::QueuedConnection); | - | ||||||||||||||||||
771 | QObject::connect(delegate, qFlagLocation("2""redirected(QUrl,int,int)" "\0" __FILE__ ":" "829"), | - | ||||||||||||||||||
772 | q, qFlagLocation("1""onRedirected(QUrl,int,int)" "\0" __FILE__ ":" "830"), | - | ||||||||||||||||||
773 | Qt::QueuedConnection); | - | ||||||||||||||||||
774 | - | |||||||||||||||||||
775 | QObject::connect(delegate, qFlagLocation("2""sslConfigurationChanged(QSslConfiguration)" "\0" __FILE__ ":" "833"), | - | ||||||||||||||||||
776 | q, qFlagLocation("1""replySslConfigurationChanged(QSslConfiguration)" "\0" __FILE__ ":" "834"), | - | ||||||||||||||||||
777 | Qt::QueuedConnection); | - | ||||||||||||||||||
778 | - | |||||||||||||||||||
779 | - | |||||||||||||||||||
780 | QObject::connect(delegate, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "838"), | - | ||||||||||||||||||
781 | q, qFlagLocation("1""httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "839"), | - | ||||||||||||||||||
782 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
783 | - | |||||||||||||||||||
784 | QObject::connect(delegate, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "842"), | - | ||||||||||||||||||
785 | q, qFlagLocation("1""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "843"), | - | ||||||||||||||||||
786 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
787 | - | |||||||||||||||||||
788 | - | |||||||||||||||||||
789 | QObject::connect(delegate, qFlagLocation("2""encrypted()" "\0" __FILE__ ":" "847"), q, qFlagLocation("1""replyEncrypted()" "\0" __FILE__ ":" "847"), | - | ||||||||||||||||||
790 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
791 | QObject::connect(delegate, qFlagLocation("2""sslErrors(QList<QSslError>,bool*,QList<QSslError>*)" "\0" __FILE__ ":" "849"), | - | ||||||||||||||||||
792 | q, qFlagLocation("1""replySslErrors(QList<QSslError>,bool*,QList<QSslError>*)" "\0" __FILE__ ":" "850"), | - | ||||||||||||||||||
793 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
794 | QObject::connect(delegate, qFlagLocation("2""preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "852"), | - | ||||||||||||||||||
795 | q, qFlagLocation("1""replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "853"), | - | ||||||||||||||||||
796 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
797 | - | |||||||||||||||||||
798 | - | |||||||||||||||||||
799 | QObject::connect(q, qFlagLocation("2""startHttpRequest()" "\0" __FILE__ ":" "857"), delegate, qFlagLocation("1""startRequest()" "\0" __FILE__ ":" "857")); | - | ||||||||||||||||||
800 | QObject::connect(q, qFlagLocation("2""abortHttpRequest()" "\0" __FILE__ ":" "858"), delegate, qFlagLocation("1""abortRequest()" "\0" __FILE__ ":" "858")); | - | ||||||||||||||||||
801 | - | |||||||||||||||||||
802 | - | |||||||||||||||||||
803 | QObject::connect(q, qFlagLocation("2""readBufferSizeChanged(qint64)" "\0" __FILE__ ":" "861"), delegate, qFlagLocation("1""readBufferSizeChanged(qint64)" "\0" __FILE__ ":" "861")); | - | ||||||||||||||||||
804 | QObject::connect(q, qFlagLocation("2""readBufferFreed(qint64)" "\0" __FILE__ ":" "862"), delegate, qFlagLocation("1""readBufferFreed(qint64)" "\0" __FILE__ ":" "862")); | - | ||||||||||||||||||
805 | - | |||||||||||||||||||
806 | if (uploadByteDevice
| 155-638 | ||||||||||||||||||
807 | QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice = | - | ||||||||||||||||||
808 | new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size()); | - | ||||||||||||||||||
809 | forwardUploadDevice->setParent(delegate); | - | ||||||||||||||||||
810 | delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); | - | ||||||||||||||||||
811 | - | |||||||||||||||||||
812 | - | |||||||||||||||||||
813 | QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "871"), | - | ||||||||||||||||||
814 | q, qFlagLocation("1""uploadByteDeviceReadyReadSlot()" "\0" __FILE__ ":" "872"), | - | ||||||||||||||||||
815 | Qt::QueuedConnection); | - | ||||||||||||||||||
816 | - | |||||||||||||||||||
817 | - | |||||||||||||||||||
818 | QObject::connect(q, qFlagLocation("2""haveUploadData(qint64,QByteArray,bool,qint64)" "\0" __FILE__ ":" "876"), | - | ||||||||||||||||||
819 | forwardUploadDevice, qFlagLocation("1""haveDataSlot(qint64,QByteArray,bool,qint64)" "\0" __FILE__ ":" "877"), Qt::QueuedConnection); | - | ||||||||||||||||||
820 | QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "878"), | - | ||||||||||||||||||
821 | forwardUploadDevice, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "879"), | - | ||||||||||||||||||
822 | Qt::QueuedConnection); | - | ||||||||||||||||||
823 | - | |||||||||||||||||||
824 | - | |||||||||||||||||||
825 | QObject::connect(forwardUploadDevice, qFlagLocation("2""wantData(qint64)" "\0" __FILE__ ":" "883"), | - | ||||||||||||||||||
826 | q, qFlagLocation("1""wantUploadDataSlot(qint64)" "\0" __FILE__ ":" "884")); | - | ||||||||||||||||||
827 | QObject::connect(forwardUploadDevice,qFlagLocation("2""processedData(qint64, qint64)" "\0" __FILE__ ":" "885"), | - | ||||||||||||||||||
828 | q, qFlagLocation("1""sentUploadDataSlot(qint64,qint64)" "\0" __FILE__ ":" "886")); | - | ||||||||||||||||||
829 | QObject::connect(forwardUploadDevice, qFlagLocation("2""resetData(bool*)" "\0" __FILE__ ":" "887"), | - | ||||||||||||||||||
830 | q, qFlagLocation("1""resetUploadDataSlot(bool*)" "\0" __FILE__ ":" "888"), | - | ||||||||||||||||||
831 | Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
832 | } executed 155 times by 3 tests: end of block Executed by:
| 155 | ||||||||||||||||||
833 | } executed 793 times by 8 tests: else if (synchronousend of block Executed by:
| 0-793 | ||||||||||||||||||
834 | QObject::connect(q, qFlagLocation("2""startHttpRequestSynchronously()" "\0" __FILE__ ":" "892"), delegate, qFlagLocation("1""startRequestSynchronously()" "\0" __FILE__ ":" "892"), Qt::BlockingQueuedConnection); | - | ||||||||||||||||||
835 | - | |||||||||||||||||||
836 | if (uploadByteDevice
| 35-41 | ||||||||||||||||||
837 | - | |||||||||||||||||||
838 | - | |||||||||||||||||||
839 | - | |||||||||||||||||||
840 | - | |||||||||||||||||||
841 | - | |||||||||||||||||||
842 | - | |||||||||||||||||||
843 | delegate->httpRequest.setUploadByteDevice(uploadByteDevice.data()); | - | ||||||||||||||||||
844 | } executed 41 times by 1 test: end of block Executed by:
| 41 | ||||||||||||||||||
845 | } executed 76 times by 1 test: end of block Executed by:
| 76 | ||||||||||||||||||
846 | - | |||||||||||||||||||
847 | - | |||||||||||||||||||
848 | - | |||||||||||||||||||
849 | delegate->moveToThread(thread); | - | ||||||||||||||||||
850 | - | |||||||||||||||||||
851 | - | |||||||||||||||||||
852 | - | |||||||||||||||||||
853 | downloadProgressSignalChoke.start(); | - | ||||||||||||||||||
854 | uploadProgressSignalChoke.invalidate(); | - | ||||||||||||||||||
855 | - | |||||||||||||||||||
856 | - | |||||||||||||||||||
857 | if (synchronous
| 76-793 | ||||||||||||||||||
858 | q->startHttpRequestSynchronously(); | - | ||||||||||||||||||
859 | - | |||||||||||||||||||
860 | if (delegate->
| 13-63 | ||||||||||||||||||
861 | replyDownloadMetaData | - | ||||||||||||||||||
862 | (delegate->incomingHeaders, | - | ||||||||||||||||||
863 | delegate->incomingStatusCode, | - | ||||||||||||||||||
864 | delegate->incomingReasonPhrase, | - | ||||||||||||||||||
865 | delegate->isPipeliningUsed, | - | ||||||||||||||||||
866 | QSharedPointer<char>(), | - | ||||||||||||||||||
867 | delegate->incomingContentLength, | - | ||||||||||||||||||
868 | delegate->isSpdyUsed); | - | ||||||||||||||||||
869 | replyDownloadData(delegate->synchronousDownloadData); | - | ||||||||||||||||||
870 | httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail); | - | ||||||||||||||||||
871 | } executed 13 times by 1 test: else {end of block Executed by:
| 13 | ||||||||||||||||||
872 | replyDownloadMetaData | - | ||||||||||||||||||
873 | (delegate->incomingHeaders, | - | ||||||||||||||||||
874 | delegate->incomingStatusCode, | - | ||||||||||||||||||
875 | delegate->incomingReasonPhrase, | - | ||||||||||||||||||
876 | delegate->isPipeliningUsed, | - | ||||||||||||||||||
877 | QSharedPointer<char>(), | - | ||||||||||||||||||
878 | delegate->incomingContentLength, | - | ||||||||||||||||||
879 | delegate->isSpdyUsed); | - | ||||||||||||||||||
880 | replyDownloadData(delegate->synchronousDownloadData); | - | ||||||||||||||||||
881 | } executed 63 times by 1 test: end of block Executed by:
| 63 | ||||||||||||||||||
882 | - | |||||||||||||||||||
883 | thread->quit(); | - | ||||||||||||||||||
884 | thread->wait(5000); | - | ||||||||||||||||||
885 | if (thread->isFinished()
| 0-76 | ||||||||||||||||||
886 | delete thread; executed 76 times by 1 test: delete thread; Executed by:
| 76 | ||||||||||||||||||
887 | else | - | ||||||||||||||||||
888 | QObject::connect(thread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "946"), thread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "946")); never executed: QObject::connect(thread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "946"), thread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "946")); | 0 | ||||||||||||||||||
889 | - | |||||||||||||||||||
890 | finished(); | - | ||||||||||||||||||
891 | } executed 76 times by 1 test: else {end of block Executed by:
| 76 | ||||||||||||||||||
892 | q->startHttpRequest(); | - | ||||||||||||||||||
893 | } executed 793 times by 8 tests: end of block Executed by:
| 793 | ||||||||||||||||||
894 | } | - | ||||||||||||||||||
895 | - | |||||||||||||||||||
896 | void QNetworkReplyHttpImplPrivate::invalidateCache() | - | ||||||||||||||||||
897 | { | - | ||||||||||||||||||
898 | QAbstractNetworkCache *nc = managerPrivate->networkCache; | - | ||||||||||||||||||
899 | if (nc
| 2-205 | ||||||||||||||||||
900 | nc->remove(httpRequest.url()); executed 2 times by 1 test: nc->remove(httpRequest.url()); Executed by:
| 2 | ||||||||||||||||||
901 | } executed 207 times by 3 tests: end of block Executed by:
| 207 | ||||||||||||||||||
902 | - | |||||||||||||||||||
903 | void QNetworkReplyHttpImplPrivate::initCacheSaveDevice() | - | ||||||||||||||||||
904 | { | - | ||||||||||||||||||
905 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
906 | - | |||||||||||||||||||
907 | - | |||||||||||||||||||
908 | - | |||||||||||||||||||
909 | if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206
| 1-61 | ||||||||||||||||||
910 | cacheEnabled = false; | - | ||||||||||||||||||
911 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||||||||
912 | } | - | ||||||||||||||||||
913 | - | |||||||||||||||||||
914 | - | |||||||||||||||||||
915 | QNetworkCacheMetaData metaData; | - | ||||||||||||||||||
916 | metaData.setUrl(url); | - | ||||||||||||||||||
917 | metaData = fetchCacheMetaData(metaData); | - | ||||||||||||||||||
918 | - | |||||||||||||||||||
919 | - | |||||||||||||||||||
920 | QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute); | - | ||||||||||||||||||
921 | if (redirectionTarget.isValid()
| 0-61 | ||||||||||||||||||
922 | QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); | - | ||||||||||||||||||
923 | attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); | - | ||||||||||||||||||
924 | metaData.setAttributes(attributes); | - | ||||||||||||||||||
925 | } never executed: end of block | 0 | ||||||||||||||||||
926 | - | |||||||||||||||||||
927 | cacheSaveDevice = managerPrivate->networkCache->prepare(metaData); | - | ||||||||||||||||||
928 | - | |||||||||||||||||||
929 | if (cacheSaveDevice
| 7-54 | ||||||||||||||||||
930 | q->connect(cacheSaveDevice, qFlagLocation("2""aboutToClose()" "\0" __FILE__ ":" "988"), qFlagLocation("1""_q_cacheSaveDeviceAboutToClose()" "\0" __FILE__ ":" "988")); executed 54 times by 3 tests: q->connect(cacheSaveDevice, qFlagLocation("2""aboutToClose()" "\0" __FILE__ ":" "988"), qFlagLocation("1""_q_cacheSaveDeviceAboutToClose()" "\0" __FILE__ ":" "988")); Executed by:
| 54 | ||||||||||||||||||
931 | - | |||||||||||||||||||
932 | if (!cacheSaveDevice
| 0-54 | ||||||||||||||||||
933 | if (cacheSaveDevice
| 0-7 | ||||||||||||||||||
934 | QMessageLogger(__FILE__, 992, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: network cache returned a device that is not open -- " never executed: QMessageLogger(__FILE__, 992, __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 | ||||||||||||||||||
935 | "class %s probably needs to be fixed", never executed: QMessageLogger(__FILE__, 992, __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 | ||||||||||||||||||
936 | managerPrivate->networkCache->metaObject()->className()); never executed: QMessageLogger(__FILE__, 992, __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 | ||||||||||||||||||
937 | - | |||||||||||||||||||
938 | managerPrivate->networkCache->remove(url); | - | ||||||||||||||||||
939 | cacheSaveDevice = 0; | - | ||||||||||||||||||
940 | cacheEnabled = false; | - | ||||||||||||||||||
941 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||
942 | } executed 61 times by 3 tests: end of block Executed by:
| 61 | ||||||||||||||||||
943 | - | |||||||||||||||||||
944 | void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d) | - | ||||||||||||||||||
945 | { | - | ||||||||||||||||||
946 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
947 | - | |||||||||||||||||||
948 | - | |||||||||||||||||||
949 | if (!q->isOpen()
| 1-5931 | ||||||||||||||||||
950 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||||||||
951 | - | |||||||||||||||||||
952 | int pendingSignals = (int)pendingDownloadDataEmissions->fetchAndAddAcquire(-1) - 1; | - | ||||||||||||||||||
953 | - | |||||||||||||||||||
954 | if (pendingSignals > 0
| 1312-4619 | ||||||||||||||||||
955 | - | |||||||||||||||||||
956 | - | |||||||||||||||||||
957 | - | |||||||||||||||||||
958 | - | |||||||||||||||||||
959 | pendingDownloadData.append(d); | - | ||||||||||||||||||
960 | return; executed 1312 times by 2 tests: return; Executed by:
| 1312 | ||||||||||||||||||
961 | } | - | ||||||||||||||||||
962 | - | |||||||||||||||||||
963 | pendingDownloadData.append(d); | - | ||||||||||||||||||
964 | d.clear(); | - | ||||||||||||||||||
965 | - | |||||||||||||||||||
966 | - | |||||||||||||||||||
967 | - | |||||||||||||||||||
968 | - | |||||||||||||||||||
969 | QByteDataBuffer pendingDownloadDataCopy = pendingDownloadData; | - | ||||||||||||||||||
970 | pendingDownloadData.clear(); | - | ||||||||||||||||||
971 | - | |||||||||||||||||||
972 | if (cacheEnabled
| 0-4574 | ||||||||||||||||||
973 | initCacheSaveDevice(); | - | ||||||||||||||||||
974 | } executed 45 times by 2 tests: end of block Executed by:
| 45 | ||||||||||||||||||
975 | - | |||||||||||||||||||
976 | qint64 bytesWritten = 0; | - | ||||||||||||||||||
977 | for (int i = 0; i < pendingDownloadDataCopy.bufferCount()
| 4619-5929 | ||||||||||||||||||
978 | QByteArray const &item = pendingDownloadDataCopy[i]; | - | ||||||||||||||||||
979 | - | |||||||||||||||||||
980 | - | |||||||||||||||||||
981 | - | |||||||||||||||||||
982 | - | |||||||||||||||||||
983 | - | |||||||||||||||||||
984 | - | |||||||||||||||||||
985 | if (cacheSaveDevice
| 44-5885 | ||||||||||||||||||
986 | cacheSaveDevice->write(item.constData(), item.size()); executed 44 times by 2 tests: cacheSaveDevice->write(item.constData(), item.size()); Executed by:
| 44 | ||||||||||||||||||
987 | - | |||||||||||||||||||
988 | if (!isHttpRedirectResponse()
| 0-5929 | ||||||||||||||||||
989 | downloadMultiBuffer.append(item); executed 5929 times by 4 tests: downloadMultiBuffer.append(item); Executed by:
| 5929 | ||||||||||||||||||
990 | - | |||||||||||||||||||
991 | bytesWritten += item.size(); | - | ||||||||||||||||||
992 | } executed 5929 times by 4 tests: end of block Executed by:
| 5929 | ||||||||||||||||||
993 | pendingDownloadDataCopy.clear(); | - | ||||||||||||||||||
994 | - | |||||||||||||||||||
995 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - | ||||||||||||||||||
996 | if (preMigrationDownloaded != static_cast<long long>(-1LL)
| 0-4619 | ||||||||||||||||||
997 | totalSize = totalSize.toLongLong() + preMigrationDownloaded; never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded; | 0 | ||||||||||||||||||
998 | - | |||||||||||||||||||
999 | if (isHttpRedirectResponse()
| 0-4619 | ||||||||||||||||||
1000 | return; never executed: return; | 0 | ||||||||||||||||||
1001 | - | |||||||||||||||||||
1002 | bytesDownloaded += bytesWritten; | - | ||||||||||||||||||
1003 | - | |||||||||||||||||||
1004 | q->readyRead(); | - | ||||||||||||||||||
1005 | - | |||||||||||||||||||
1006 | - | |||||||||||||||||||
1007 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
| 46-4573 | ||||||||||||||||||
1008 | downloadProgressSignalChoke.restart(); | - | ||||||||||||||||||
1009 | q->downloadProgress(bytesDownloaded, | - | ||||||||||||||||||
1010 | totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong()); | - | ||||||||||||||||||
1011 | } executed 46 times by 2 tests: end of block Executed by:
| 46 | ||||||||||||||||||
1012 | - | |||||||||||||||||||
1013 | } executed 4619 times by 4 tests: end of block Executed by:
| 4619 | ||||||||||||||||||
1014 | - | |||||||||||||||||||
1015 | void QNetworkReplyHttpImplPrivate::replyFinished() | - | ||||||||||||||||||
1016 | { | - | ||||||||||||||||||
1017 | - | |||||||||||||||||||
1018 | - | |||||||||||||||||||
1019 | if (loadingFromCache
| 5-756 | ||||||||||||||||||
1020 | return; executed 5 times by 1 test: return; Executed by:
| 5 | ||||||||||||||||||
1021 | - | |||||||||||||||||||
1022 | finished(); | - | ||||||||||||||||||
1023 | } executed 756 times by 7 tests: end of block Executed by:
| 756 | ||||||||||||||||||
1024 | - | |||||||||||||||||||
1025 | QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperation(QNetworkAccessManager::Operation currentOp, int httpStatus) | - | ||||||||||||||||||
1026 | { | - | ||||||||||||||||||
1027 | - | |||||||||||||||||||
1028 | - | |||||||||||||||||||
1029 | - | |||||||||||||||||||
1030 | (void)httpStatus;; | - | ||||||||||||||||||
1031 | - | |||||||||||||||||||
1032 | switch (currentOp) { | - | ||||||||||||||||||
1033 | case never executed: QNetworkAccessManager::HeadOperation:case QNetworkAccessManager::HeadOperation: never executed: case QNetworkAccessManager::HeadOperation: | 0 | ||||||||||||||||||
1034 | return never executed: QNetworkAccessManager::HeadOperation;return QNetworkAccessManager::HeadOperation; never executed: return QNetworkAccessManager::HeadOperation; | 0 | ||||||||||||||||||
1035 | default executed 5 times by 1 test: :default: Executed by:
executed 5 times by 1 test: default: Executed by:
| 5 | ||||||||||||||||||
1036 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||||||||
1037 | } | - | ||||||||||||||||||
1038 | - | |||||||||||||||||||
1039 | return executed 5 times by 1 test: QNetworkAccessManager::GetOperation;return QNetworkAccessManager::GetOperation; Executed by:
executed 5 times by 1 test: return QNetworkAccessManager::GetOperation; Executed by:
| 5 | ||||||||||||||||||
1040 | } | - | ||||||||||||||||||
1041 | - | |||||||||||||||||||
1042 | bool QNetworkReplyHttpImplPrivate::isHttpRedirectResponse() const | - | ||||||||||||||||||
1043 | { | - | ||||||||||||||||||
1044 | return executed 13590 times by 7 tests: httpRequest.isFollowRedirects()return httpRequest.isFollowRedirects() && QHttpNetworkReply::isHttpRedirect(statusCode); Executed by:
executed 13590 times by 7 tests: return httpRequest.isFollowRedirects() && QHttpNetworkReply::isHttpRedirect(statusCode); Executed by:
| 4-13590 | ||||||||||||||||||
1045 | } | - | ||||||||||||||||||
1046 | - | |||||||||||||||||||
1047 | QNetworkRequest QNetworkReplyHttpImplPrivate::createRedirectRequest(const QNetworkRequest &originalRequest, | - | ||||||||||||||||||
1048 | const QUrl &url, | - | ||||||||||||||||||
1049 | int maxRedirectsRemaining) | - | ||||||||||||||||||
1050 | { | - | ||||||||||||||||||
1051 | QNetworkRequest newRequest(originalRequest); | - | ||||||||||||||||||
1052 | newRequest.setUrl(url); | - | ||||||||||||||||||
1053 | newRequest.setMaximumRedirectsAllowed(maxRedirectsRemaining); | - | ||||||||||||||||||
1054 | - | |||||||||||||||||||
1055 | return executed 5 times by 1 test: newRequest;return newRequest; Executed by:
executed 5 times by 1 test: return newRequest; Executed by:
| 5 | ||||||||||||||||||
1056 | } | - | ||||||||||||||||||
1057 | - | |||||||||||||||||||
1058 | void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int httpStatus, int maxRedirectsRemaining) | - | ||||||||||||||||||
1059 | { | - | ||||||||||||||||||
1060 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1061 | - | |||||||||||||||||||
1062 | if (isFinished
| 0-5 | ||||||||||||||||||
1063 | return; never executed: return; | 0 | ||||||||||||||||||
1064 | - | |||||||||||||||||||
1065 | if (httpRequest.isFollowRedirects()
| 0-5 | ||||||||||||||||||
1066 | url = redirectUrl; executed 5 times by 1 test: url = redirectUrl; Executed by:
| 5 | ||||||||||||||||||
1067 | - | |||||||||||||||||||
1068 | QNetworkRequest redirectRequest = createRedirectRequest(originalRequest, redirectUrl, maxRedirectsRemaining); | - | ||||||||||||||||||
1069 | operation = getRedirectOperation(operation, httpStatus); | - | ||||||||||||||||||
1070 | - | |||||||||||||||||||
1071 | cookedHeaders.clear(); | - | ||||||||||||||||||
1072 | - | |||||||||||||||||||
1073 | if (managerPrivate->httpThread
| 0-5 | ||||||||||||||||||
1074 | managerPrivate->httpThread->disconnect(); executed 5 times by 1 test: managerPrivate->httpThread->disconnect(); Executed by:
| 5 | ||||||||||||||||||
1075 | - | |||||||||||||||||||
1076 | - | |||||||||||||||||||
1077 | QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection, | - | ||||||||||||||||||
1078 | QArgument<QNetworkRequest >("QNetworkRequest", redirectRequest)); | - | ||||||||||||||||||
1079 | - | |||||||||||||||||||
1080 | q->redirected(redirectUrl); | - | ||||||||||||||||||
1081 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
1082 | - | |||||||||||||||||||
1083 | void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode) | - | ||||||||||||||||||
1084 | { | - | ||||||||||||||||||
1085 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1086 | switch (statusCode) { | - | ||||||||||||||||||
1087 | case executed 3 times by 1 test: 301:case 301: Executed by:
executed 3 times by 1 test: case 301: Executed by:
| 3 | ||||||||||||||||||
1088 | case never executed: 302:case 302: never executed: case 302: | 0 | ||||||||||||||||||
1089 | case never executed: 303:case 303: never executed: case 303: | 0 | ||||||||||||||||||
1090 | case never executed: 307:case 307: never executed: case 307: | 0 | ||||||||||||||||||
1091 | - | |||||||||||||||||||
1092 | - | |||||||||||||||||||
1093 | - | |||||||||||||||||||
1094 | QByteArray header = q->rawHeader("location"); | - | ||||||||||||||||||
1095 | QUrl url = QUrl(QString::fromUtf8(header)); | - | ||||||||||||||||||
1096 | if (!url.isValid()
| 0-3 | ||||||||||||||||||
1097 | url = QUrl(QLatin1String(header)); never executed: url = QUrl(QLatin1String(header)); | 0 | ||||||||||||||||||
1098 | q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, url); | - | ||||||||||||||||||
1099 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
1100 | } executed 817 times by 6 tests: end of block Executed by:
| 817 | ||||||||||||||||||
1101 | - | |||||||||||||||||||
1102 | void QNetworkReplyHttpImplPrivate::replyDownloadMetaData | - | ||||||||||||||||||
1103 | (QList<QPair<QByteArray,QByteArray> > hm, | - | ||||||||||||||||||
1104 | int sc,QString rp,bool pu, | - | ||||||||||||||||||
1105 | QSharedPointer<char> db, | - | ||||||||||||||||||
1106 | qint64 contentLength, bool spdyWasUsed) | - | ||||||||||||||||||
1107 | { | - | ||||||||||||||||||
1108 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1109 | (void)contentLength;; | - | ||||||||||||||||||
1110 | - | |||||||||||||||||||
1111 | statusCode = sc; | - | ||||||||||||||||||
1112 | reasonPhrase = rp; | - | ||||||||||||||||||
1113 | - | |||||||||||||||||||
1114 | - | |||||||||||||||||||
1115 | if (!db.isNull()
| 364-432 | ||||||||||||||||||
1116 | downloadBufferPointer = db; | - | ||||||||||||||||||
1117 | downloadZerocopyBuffer = downloadBufferPointer.data(); | - | ||||||||||||||||||
1118 | downloadBufferCurrentSize = 0; | - | ||||||||||||||||||
1119 | q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer)); | - | ||||||||||||||||||
1120 | } executed 364 times by 3 tests: end of block Executed by:
| 364 | ||||||||||||||||||
1121 | - | |||||||||||||||||||
1122 | q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu); | - | ||||||||||||||||||
1123 | q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed); | - | ||||||||||||||||||
1124 | - | |||||||||||||||||||
1125 | - | |||||||||||||||||||
1126 | QList<QPair<QByteArray, QByteArray> > headerMap = hm; | - | ||||||||||||||||||
1127 | QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(), | - | ||||||||||||||||||
1128 | end = headerMap.constEnd(); | - | ||||||||||||||||||
1129 | for (; it != end
| 796-5044 | ||||||||||||||||||
1130 | QByteArray value = q->rawHeader(it->first); | - | ||||||||||||||||||
1131 | - | |||||||||||||||||||
1132 | - | |||||||||||||||||||
1133 | - | |||||||||||||||||||
1134 | - | |||||||||||||||||||
1135 | if (it->first.toLower() == "location"
| 43-5001 | ||||||||||||||||||
1136 | value.clear(); executed 43 times by 2 tests: value.clear(); Executed by:
| 43 | ||||||||||||||||||
1137 | - | |||||||||||||||||||
1138 | if (!value.isEmpty()
| 5-5039 | ||||||||||||||||||
1139 | - | |||||||||||||||||||
1140 | - | |||||||||||||||||||
1141 | if (qstricmp(it->first.constData(), "set-cookie") == 0
| 2-3 | ||||||||||||||||||
1142 | value += '\n'; executed 2 times by 1 test: value += '\n'; Executed by:
| 2 | ||||||||||||||||||
1143 | else | - | ||||||||||||||||||
1144 | value += ", "; executed 3 times by 1 test: value += ", "; Executed by:
| 3 | ||||||||||||||||||
1145 | } | - | ||||||||||||||||||
1146 | value += it->second; | - | ||||||||||||||||||
1147 | q->setRawHeader(it->first, value); | - | ||||||||||||||||||
1148 | } executed 5044 times by 6 tests: end of block Executed by:
| 5044 | ||||||||||||||||||
1149 | - | |||||||||||||||||||
1150 | q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode); | - | ||||||||||||||||||
1151 | q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); | - | ||||||||||||||||||
1152 | - | |||||||||||||||||||
1153 | - | |||||||||||||||||||
1154 | if (!isHttpRedirectResponse()
| 6-790 | ||||||||||||||||||
1155 | checkForRedirect(statusCode); executed 790 times by 6 tests: checkForRedirect(statusCode); Executed by:
| 790 | ||||||||||||||||||
1156 | - | |||||||||||||||||||
1157 | if (statusCode >= 500
| 0-795 | ||||||||||||||||||
1158 | QAbstractNetworkCache *nc = managerPrivate->networkCache; | - | ||||||||||||||||||
1159 | if (nc
| 0-1 | ||||||||||||||||||
1160 | QNetworkCacheMetaData metaData = nc->metaData(httpRequest.url()); | - | ||||||||||||||||||
1161 | QNetworkHeadersPrivate cacheHeaders; | - | ||||||||||||||||||
1162 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - | ||||||||||||||||||
1163 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - | ||||||||||||||||||
1164 | it = cacheHeaders.findRawHeader("Cache-Control"); | - | ||||||||||||||||||
1165 | bool mustReValidate = false; | - | ||||||||||||||||||
1166 | if (it != cacheHeaders.rawHeaders.constEnd()
| 0 | ||||||||||||||||||
1167 | QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); | - | ||||||||||||||||||
1168 | if (cacheControl.contains("must-revalidate")
| 0 | ||||||||||||||||||
1169 | mustReValidate = true; never executed: mustReValidate = true; | 0 | ||||||||||||||||||
1170 | } never executed: end of block | 0 | ||||||||||||||||||
1171 | if (!mustReValidate
| 0 | ||||||||||||||||||
1172 | return; never executed: return; | 0 | ||||||||||||||||||
1173 | } never executed: end of block | 0 | ||||||||||||||||||
1174 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1175 | - | |||||||||||||||||||
1176 | if (statusCode == 304
| 9-787 | ||||||||||||||||||
1177 | - | |||||||||||||||||||
1178 | - | |||||||||||||||||||
1179 | - | |||||||||||||||||||
1180 | QAbstractNetworkCache *nc = managerPrivate->networkCache; | - | ||||||||||||||||||
1181 | if (nc
| 0-9 | ||||||||||||||||||
1182 | QNetworkCacheMetaData oldMetaData = nc->metaData(httpRequest.url()); | - | ||||||||||||||||||
1183 | QNetworkCacheMetaData metaData = fetchCacheMetaData(oldMetaData); | - | ||||||||||||||||||
1184 | if (oldMetaData != metaData
| 0-9 | ||||||||||||||||||
1185 | nc->updateMetaData(metaData); executed 9 times by 2 tests: nc->updateMetaData(metaData); Executed by:
| 9 | ||||||||||||||||||
1186 | if (sendCacheContents(metaData)
| 0-9 | ||||||||||||||||||
1187 | return; executed 9 times by 2 tests: return; Executed by:
| 9 | ||||||||||||||||||
1188 | } never executed: end of block | 0 | ||||||||||||||||||
1189 | } never executed: end of block | 0 | ||||||||||||||||||
1190 | - | |||||||||||||||||||
1191 | - | |||||||||||||||||||
1192 | if (statusCode != 304
| 0-787 | ||||||||||||||||||
1193 | if (!isCachingEnabled()
| 0-787 | ||||||||||||||||||
1194 | setCachingEnabled(true); executed 787 times by 6 tests: setCachingEnabled(true); Executed by:
| 787 | ||||||||||||||||||
1195 | } executed 787 times by 6 tests: end of block Executed by:
| 787 | ||||||||||||||||||
1196 | - | |||||||||||||||||||
1197 | _q_metaDataChanged(); | - | ||||||||||||||||||
1198 | } executed 787 times by 6 tests: end of block Executed by:
| 787 | ||||||||||||||||||
1199 | - | |||||||||||||||||||
1200 | void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceived, qint64 bytesTotal) | - | ||||||||||||||||||
1201 | { | - | ||||||||||||||||||
1202 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1203 | - | |||||||||||||||||||
1204 | - | |||||||||||||||||||
1205 | if (!q->isOpen()
| 0-1495 | ||||||||||||||||||
1206 | return; never executed: return; | 0 | ||||||||||||||||||
1207 | - | |||||||||||||||||||
1208 | - | |||||||||||||||||||
1209 | - | |||||||||||||||||||
1210 | int pendingSignals = (int)pendingDownloadProgressEmissions->fetchAndAddAcquire(-1) - 1; | - | ||||||||||||||||||
1211 | if (pendingSignals > 0
| 199-1296 | ||||||||||||||||||
1212 | - | |||||||||||||||||||
1213 | - | |||||||||||||||||||
1214 | return; executed 199 times by 1 test: return; Executed by:
| 199 | ||||||||||||||||||
1215 | } | - | ||||||||||||||||||
1216 | - | |||||||||||||||||||
1217 | if (!q->isOpen()
| 0-1296 | ||||||||||||||||||
1218 | return; never executed: return; | 0 | ||||||||||||||||||
1219 | - | |||||||||||||||||||
1220 | if (cacheEnabled
| 1-1277 | ||||||||||||||||||
1221 | - | |||||||||||||||||||
1222 | initCacheSaveDevice(); | - | ||||||||||||||||||
1223 | - | |||||||||||||||||||
1224 | if (cacheSaveDevice
| 0-10 | ||||||||||||||||||
1225 | cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal); executed 10 times by 2 tests: cacheSaveDevice->write(downloadZerocopyBuffer, bytesTotal); Executed by:
| 10 | ||||||||||||||||||
1226 | - | |||||||||||||||||||
1227 | } executed 17 times by 2 tests: end of block Executed by:
| 17 | ||||||||||||||||||
1228 | - | |||||||||||||||||||
1229 | if (isHttpRedirectResponse()
| 0-1296 | ||||||||||||||||||
1230 | return; never executed: return; | 0 | ||||||||||||||||||
1231 | - | |||||||||||||||||||
1232 | bytesDownloaded = bytesReceived; | - | ||||||||||||||||||
1233 | - | |||||||||||||||||||
1234 | downloadBufferCurrentSize = bytesReceived; | - | ||||||||||||||||||
1235 | - | |||||||||||||||||||
1236 | - | |||||||||||||||||||
1237 | - | |||||||||||||||||||
1238 | - | |||||||||||||||||||
1239 | if (bytesDownloaded > 0
| 0-1296 | ||||||||||||||||||
1240 | q->readyRead(); executed 1296 times by 3 tests: q->readyRead(); Executed by:
| 1296 | ||||||||||||||||||
1241 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
| 66-1230 | ||||||||||||||||||
1242 | downloadProgressSignalChoke.restart(); | - | ||||||||||||||||||
1243 | q->downloadProgress(bytesDownloaded, bytesTotal); | - | ||||||||||||||||||
1244 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||
1245 | } executed 1296 times by 3 tests: end of block Executed by:
| 1296 | ||||||||||||||||||
1246 | - | |||||||||||||||||||
1247 | void QNetworkReplyHttpImplPrivate::httpAuthenticationRequired(const QHttpNetworkRequest &request, | - | ||||||||||||||||||
1248 | QAuthenticator *auth) | - | ||||||||||||||||||
1249 | { | - | ||||||||||||||||||
1250 | managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication, request.withCredentials()); | - | ||||||||||||||||||
1251 | } executed 124 times by 1 test: end of block Executed by:
| 124 | ||||||||||||||||||
1252 | - | |||||||||||||||||||
1253 | - | |||||||||||||||||||
1254 | void QNetworkReplyHttpImplPrivate::proxyAuthenticationRequired(const QNetworkProxy &proxy, | - | ||||||||||||||||||
1255 | QAuthenticator *authenticator) | - | ||||||||||||||||||
1256 | { | - | ||||||||||||||||||
1257 | managerPrivate->proxyAuthenticationRequired(request.url(), proxy, synchronous, authenticator, &lastProxyAuthentication); | - | ||||||||||||||||||
1258 | } executed 68 times by 2 tests: end of block Executed by:
| 68 | ||||||||||||||||||
1259 | - | |||||||||||||||||||
1260 | - | |||||||||||||||||||
1261 | void QNetworkReplyHttpImplPrivate::httpError(QNetworkReply::NetworkError errorCode, | - | ||||||||||||||||||
1262 | const QString &errorString) | - | ||||||||||||||||||
1263 | { | - | ||||||||||||||||||
1264 | - | |||||||||||||||||||
1265 | - | |||||||||||||||||||
1266 | - | |||||||||||||||||||
1267 | - | |||||||||||||||||||
1268 | - | |||||||||||||||||||
1269 | error(errorCode, errorString); | - | ||||||||||||||||||
1270 | } executed 112 times by 4 tests: end of block Executed by:
| 112 | ||||||||||||||||||
1271 | - | |||||||||||||||||||
1272 | - | |||||||||||||||||||
1273 | void QNetworkReplyHttpImplPrivate::replyEncrypted() | - | ||||||||||||||||||
1274 | { | - | ||||||||||||||||||
1275 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1276 | q->encrypted(); | - | ||||||||||||||||||
1277 | } executed 73 times by 2 tests: end of block Executed by:
| 73 | ||||||||||||||||||
1278 | - | |||||||||||||||||||
1279 | void QNetworkReplyHttpImplPrivate::replySslErrors( | - | ||||||||||||||||||
1280 | const QList<QSslError> &list, bool *ignoreAll, QList<QSslError> *toBeIgnored) | - | ||||||||||||||||||
1281 | { | - | ||||||||||||||||||
1282 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1283 | q->sslErrors(list); | - | ||||||||||||||||||
1284 | - | |||||||||||||||||||
1285 | if (pendingIgnoreAllSslErrors
| 14-32 | ||||||||||||||||||
1286 | * executed 32 times by 2 tests: ignoreAll = true;*ignoreAll = true; Executed by:
executed 32 times by 2 tests: *ignoreAll = true; Executed by:
| 32 | ||||||||||||||||||
1287 | if (!pendingIgnoreSslErrorsList.isEmpty()
| 6-40 | ||||||||||||||||||
1288 | * executed 6 times by 1 test: toBeIgnored = pendingIgnoreSslErrorsList;*toBeIgnored = pendingIgnoreSslErrorsList; Executed by:
executed 6 times by 1 test: *toBeIgnored = pendingIgnoreSslErrorsList; Executed by:
| 6 | ||||||||||||||||||
1289 | } executed 46 times by 2 tests: end of block Executed by:
| 46 | ||||||||||||||||||
1290 | - | |||||||||||||||||||
1291 | void QNetworkReplyHttpImplPrivate::replySslConfigurationChanged(const QSslConfiguration &sslConfiguration) | - | ||||||||||||||||||
1292 | { | - | ||||||||||||||||||
1293 | - | |||||||||||||||||||
1294 | this->sslConfiguration = sslConfiguration; | - | ||||||||||||||||||
1295 | } executed 522 times by 2 tests: end of block Executed by:
| 522 | ||||||||||||||||||
1296 | - | |||||||||||||||||||
1297 | void QNetworkReplyHttpImplPrivate::replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator) | - | ||||||||||||||||||
1298 | { | - | ||||||||||||||||||
1299 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1300 | q->preSharedKeyAuthenticationRequired(authenticator); | - | ||||||||||||||||||
1301 | } never executed: end of block | 0 | ||||||||||||||||||
1302 | - | |||||||||||||||||||
1303 | - | |||||||||||||||||||
1304 | - | |||||||||||||||||||
1305 | void QNetworkReplyHttpImplPrivate::resetUploadDataSlot(bool *r) | - | ||||||||||||||||||
1306 | { | - | ||||||||||||||||||
1307 | *r = uploadByteDevice->reset(); | - | ||||||||||||||||||
1308 | if (*
| 1-126 | ||||||||||||||||||
1309 | - | |||||||||||||||||||
1310 | uploadByteDevicePosition = 0; | - | ||||||||||||||||||
1311 | } executed 126 times by 1 test: end of block Executed by:
| 126 | ||||||||||||||||||
1312 | } executed 127 times by 1 test: end of block Executed by:
| 127 | ||||||||||||||||||
1313 | - | |||||||||||||||||||
1314 | - | |||||||||||||||||||
1315 | void QNetworkReplyHttpImplPrivate::sentUploadDataSlot(qint64 pos, qint64 amount) | - | ||||||||||||||||||
1316 | { | - | ||||||||||||||||||
1317 | if (uploadByteDevicePosition + amount != pos
| 0-2695 | ||||||||||||||||||
1318 | - | |||||||||||||||||||
1319 | error(QNetworkReply::UnknownNetworkError, QString()); | - | ||||||||||||||||||
1320 | return; never executed: return; | 0 | ||||||||||||||||||
1321 | } | - | ||||||||||||||||||
1322 | uploadByteDevice->advanceReadPointer(amount); | - | ||||||||||||||||||
1323 | uploadByteDevicePosition += amount; | - | ||||||||||||||||||
1324 | } executed 2695 times by 2 tests: end of block Executed by:
| 2695 | ||||||||||||||||||
1325 | - | |||||||||||||||||||
1326 | - | |||||||||||||||||||
1327 | void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) | - | ||||||||||||||||||
1328 | { | - | ||||||||||||||||||
1329 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1330 | - | |||||||||||||||||||
1331 | - | |||||||||||||||||||
1332 | qint64 currentUploadDataLength = 0; | - | ||||||||||||||||||
1333 | char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength)); | - | ||||||||||||||||||
1334 | - | |||||||||||||||||||
1335 | if (currentUploadDataLength == 0
| 4-2710 | ||||||||||||||||||
1336 | uploadDeviceChoking = true; | - | ||||||||||||||||||
1337 | - | |||||||||||||||||||
1338 | - | |||||||||||||||||||
1339 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||
1340 | } else { | - | ||||||||||||||||||
1341 | uploadDeviceChoking = false; | - | ||||||||||||||||||
1342 | } executed 2710 times by 3 tests: end of block Executed by:
| 2710 | ||||||||||||||||||
1343 | - | |||||||||||||||||||
1344 | - | |||||||||||||||||||
1345 | QByteArray dataArray(data, currentUploadDataLength); | - | ||||||||||||||||||
1346 | - | |||||||||||||||||||
1347 | - | |||||||||||||||||||
1348 | q->haveUploadData(uploadByteDevicePosition, dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); | - | ||||||||||||||||||
1349 | } executed 2710 times by 3 tests: end of block Executed by:
| 2710 | ||||||||||||||||||
1350 | - | |||||||||||||||||||
1351 | void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot() | - | ||||||||||||||||||
1352 | { | - | ||||||||||||||||||
1353 | - | |||||||||||||||||||
1354 | - | |||||||||||||||||||
1355 | - | |||||||||||||||||||
1356 | if (uploadDeviceChoking
| 4-6 | ||||||||||||||||||
1357 | uploadDeviceChoking = false; | - | ||||||||||||||||||
1358 | wantUploadDataSlot(1024); | - | ||||||||||||||||||
1359 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
1360 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
1361 | - | |||||||||||||||||||
1362 | - | |||||||||||||||||||
1363 | - | |||||||||||||||||||
1364 | - | |||||||||||||||||||
1365 | - | |||||||||||||||||||
1366 | bool QNetworkReplyHttpImplPrivate::sendCacheContents(const QNetworkCacheMetaData &metaData) | - | ||||||||||||||||||
1367 | { | - | ||||||||||||||||||
1368 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1369 | - | |||||||||||||||||||
1370 | setCachingEnabled(false); | - | ||||||||||||||||||
1371 | if (!metaData.isValid()
| 0-27 | ||||||||||||||||||
1372 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1373 | - | |||||||||||||||||||
1374 | QAbstractNetworkCache *nc = managerPrivate->networkCache; | - | ||||||||||||||||||
1375 | ((!(nc)) ? qt_assert("nc",__FILE__,1433) : qt_noop()); | - | ||||||||||||||||||
1376 | QIODevice *contents = nc->data(url); | - | ||||||||||||||||||
1377 | if (!contents
| 0-27 | ||||||||||||||||||
1378 | - | |||||||||||||||||||
1379 | - | |||||||||||||||||||
1380 | - | |||||||||||||||||||
1381 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1382 | } | - | ||||||||||||||||||
1383 | contents->setParent(q); | - | ||||||||||||||||||
1384 | - | |||||||||||||||||||
1385 | QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); | - | ||||||||||||||||||
1386 | int status = attributes.value(QNetworkRequest::HttpStatusCodeAttribute).toInt(); | - | ||||||||||||||||||
1387 | if (status < 100
| 8-19 | ||||||||||||||||||
1388 | status = 200; executed 8 times by 1 test: status = 200; Executed by:
| 8 | ||||||||||||||||||
1389 | - | |||||||||||||||||||
1390 | statusCode = status; | - | ||||||||||||||||||
1391 | - | |||||||||||||||||||
1392 | q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status); | - | ||||||||||||||||||
1393 | q->setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); | - | ||||||||||||||||||
1394 | q->setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); | - | ||||||||||||||||||
1395 | - | |||||||||||||||||||
1396 | QNetworkCacheMetaData::RawHeaderList rawHeaders = metaData.rawHeaders(); | - | ||||||||||||||||||
1397 | QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(), | - | ||||||||||||||||||
1398 | end = rawHeaders.constEnd(); | - | ||||||||||||||||||
1399 | QUrl redirectUrl; | - | ||||||||||||||||||
1400 | for ( ; it != end
| 27-100 | ||||||||||||||||||
1401 | if (httpRequest.isFollowRedirects()
| 0-100 | ||||||||||||||||||
1402 | !qstricmp(it->first.toLower().constData(), "location")
| 0 | ||||||||||||||||||
1403 | redirectUrl = QUrl::fromEncoded(it->second); never executed: redirectUrl = QUrl::fromEncoded(it->second); | 0 | ||||||||||||||||||
1404 | setRawHeader(it->first, it->second); | - | ||||||||||||||||||
1405 | } executed 100 times by 2 tests: end of block Executed by:
| 100 | ||||||||||||||||||
1406 | - | |||||||||||||||||||
1407 | if (!isHttpRedirectResponse()
| 0-27 | ||||||||||||||||||
1408 | checkForRedirect(status); executed 27 times by 2 tests: checkForRedirect(status); Executed by:
| 27 | ||||||||||||||||||
1409 | - | |||||||||||||||||||
1410 | cacheLoadDevice = contents; | - | ||||||||||||||||||
1411 | q->connect(cacheLoadDevice, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "1469"), qFlagLocation("1""_q_cacheLoadReadyRead()" "\0" __FILE__ ":" "1469")); | - | ||||||||||||||||||
1412 | q->connect(cacheLoadDevice, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "1470"), qFlagLocation("1""_q_cacheLoadReadyRead()" "\0" __FILE__ ":" "1470")); | - | ||||||||||||||||||
1413 | - | |||||||||||||||||||
1414 | - | |||||||||||||||||||
1415 | - | |||||||||||||||||||
1416 | - | |||||||||||||||||||
1417 | QMetaObject::invokeMethod(q, "_q_metaDataChanged", Qt::QueuedConnection); | - | ||||||||||||||||||
1418 | QMetaObject::invokeMethod(q, "_q_cacheLoadReadyRead", Qt::QueuedConnection); | - | ||||||||||||||||||
1419 | - | |||||||||||||||||||
1420 | - | |||||||||||||||||||
1421 | - | |||||||||||||||||||
1422 | - | |||||||||||||||||||
1423 | - | |||||||||||||||||||
1424 | - | |||||||||||||||||||
1425 | - | |||||||||||||||||||
1426 | if (httpRequest.isFollowRedirects()
| 0-27 | ||||||||||||||||||
1427 | QMetaObject::invokeMethod(q, "onRedirected", Qt::QueuedConnection, | - | ||||||||||||||||||
1428 | QArgument<QUrl >("QUrl", redirectUrl), | - | ||||||||||||||||||
1429 | QArgument<int >("int", status), | - | ||||||||||||||||||
1430 | QArgument<int >("int", httpRequest.redirectCount() - 1)); | - | ||||||||||||||||||
1431 | } never executed: end of block | 0 | ||||||||||||||||||
1432 | - | |||||||||||||||||||
1433 | - | |||||||||||||||||||
1434 | - | |||||||||||||||||||
1435 | loadingFromCache = true; | - | ||||||||||||||||||
1436 | return executed 27 times by 2 tests: true;return true; Executed by:
executed 27 times by 2 tests: return true; Executed by:
| 27 | ||||||||||||||||||
1437 | } | - | ||||||||||||||||||
1438 | - | |||||||||||||||||||
1439 | QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNetworkCacheMetaData &oldMetaData) const | - | ||||||||||||||||||
1440 | { | - | ||||||||||||||||||
1441 | const QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1442 | - | |||||||||||||||||||
1443 | QNetworkCacheMetaData metaData = oldMetaData; | - | ||||||||||||||||||
1444 | - | |||||||||||||||||||
1445 | QNetworkHeadersPrivate cacheHeaders; | - | ||||||||||||||||||
1446 | cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); | - | ||||||||||||||||||
1447 | QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; | - | ||||||||||||||||||
1448 | - | |||||||||||||||||||
1449 | QList<QByteArray> newHeaders = q->rawHeaderList(); | - | ||||||||||||||||||
1450 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(newHeaders)>::type> _container_((newHeaders)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QByteArray header = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
1451 | QByteArray originalHeader = header; | - | ||||||||||||||||||
1452 | header = header.toLower(); | - | ||||||||||||||||||
1453 | bool hop_by_hop = | - | ||||||||||||||||||
1454 | (header == "connection"
| 69-387 | ||||||||||||||||||
1455 | || header == "keep-alive"
| 62-325 | ||||||||||||||||||
1456 | || header == "proxy-authenticate"
| 0-325 | ||||||||||||||||||
1457 | || header == "proxy-authorization"
| 0-325 | ||||||||||||||||||
1458 | || header == "te"
| 0-325 | ||||||||||||||||||
1459 | || header == "trailers"
| 0-325 | ||||||||||||||||||
1460 | || header == "transfer-encoding"
| 41-284 | ||||||||||||||||||
1461 | || header == "upgrade"
| 0-284 | ||||||||||||||||||
1462 | if (hop_by_hop
| 172-284 | ||||||||||||||||||
1463 | continue; executed 172 times by 2 tests: continue; Executed by:
| 172 | ||||||||||||||||||
1464 | - | |||||||||||||||||||
1465 | if (header == "set-cookie"
| 0-284 | ||||||||||||||||||
1466 | continue; never executed: continue; | 0 | ||||||||||||||||||
1467 | if (header == "warning"
| 0-284 | ||||||||||||||||||
1468 | QByteArray v = q->rawHeader(header); | - | ||||||||||||||||||
1469 | if (v.length() == 3
| 0 | ||||||||||||||||||
1470 | && v[0] == '1'
| 0 | ||||||||||||||||||
1471 | && v[1] >= '0'
| 0 | ||||||||||||||||||
1472 | && v[2] >= '0'
| 0 | ||||||||||||||||||
1473 | continue; never executed: continue; | 0 | ||||||||||||||||||
1474 | } never executed: end of block | 0 | ||||||||||||||||||
1475 | - | |||||||||||||||||||
1476 | it = cacheHeaders.findRawHeader(header); | - | ||||||||||||||||||
1477 | if (it != cacheHeaders.rawHeaders.constEnd()
| 13-271 | ||||||||||||||||||
1478 | - | |||||||||||||||||||
1479 | if (header == "content-encoding"
| 0-13 | ||||||||||||||||||
1480 | || header == "content-range"
| 0-13 | ||||||||||||||||||
1481 | || header == "content-type"
| 0-13 | ||||||||||||||||||
1482 | continue; never executed: continue; | 0 | ||||||||||||||||||
1483 | - | |||||||||||||||||||
1484 | - | |||||||||||||||||||
1485 | - | |||||||||||||||||||
1486 | if (header == "content-length"
| 0-13 | ||||||||||||||||||
1487 | continue; never executed: continue; | 0 | ||||||||||||||||||
1488 | } executed 13 times by 1 test: end of block Executed by:
| 13 | ||||||||||||||||||
1489 | cacheHeaders.setRawHeader(originalHeader, q->rawHeader(header)); | - | ||||||||||||||||||
1490 | } executed 284 times by 3 tests: end of block Executed by:
| 284 | ||||||||||||||||||
1491 | metaData.setRawHeaders(cacheHeaders.rawHeaders); | - | ||||||||||||||||||
1492 | - | |||||||||||||||||||
1493 | bool checkExpired = true; | - | ||||||||||||||||||
1494 | - | |||||||||||||||||||
1495 | QHash<QByteArray, QByteArray> cacheControl; | - | ||||||||||||||||||
1496 | it = cacheHeaders.findRawHeader("Cache-Control"); | - | ||||||||||||||||||
1497 | if (it != cacheHeaders.rawHeaders.constEnd()
| 28-42 | ||||||||||||||||||
1498 | cacheControl = parseHttpOptionHeader(it->second); | - | ||||||||||||||||||
1499 | QByteArray maxAge = cacheControl.value("max-age"); | - | ||||||||||||||||||
1500 | if (!maxAge.isEmpty()
| 7-21 | ||||||||||||||||||
1501 | checkExpired = false; | - | ||||||||||||||||||
1502 | QDateTime dt = QDateTime::currentDateTimeUtc(); | - | ||||||||||||||||||
1503 | dt = dt.addSecs(maxAge.toInt()); | - | ||||||||||||||||||
1504 | metaData.setExpirationDate(dt); | - | ||||||||||||||||||
1505 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||||||||
1506 | } executed 28 times by 2 tests: end of block Executed by:
| 28 | ||||||||||||||||||
1507 | if (checkExpired
| 21-49 | ||||||||||||||||||
1508 | it = cacheHeaders.findRawHeader("expires"); | - | ||||||||||||||||||
1509 | if (it != cacheHeaders.rawHeaders.constEnd()
| 17-32 | ||||||||||||||||||
1510 | QDateTime expiredDateTime = QNetworkHeadersPrivate::fromHttpDate(it->second); | - | ||||||||||||||||||
1511 | metaData.setExpirationDate(expiredDateTime); | - | ||||||||||||||||||
1512 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||
1513 | } executed 49 times by 2 tests: end of block Executed by:
| 49 | ||||||||||||||||||
1514 | - | |||||||||||||||||||
1515 | it = cacheHeaders.findRawHeader("last-modified"); | - | ||||||||||||||||||
1516 | if (it != cacheHeaders.rawHeaders.constEnd()
| 29-41 | ||||||||||||||||||
1517 | metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second)); executed 29 times by 1 test: metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second)); Executed by:
| 29 | ||||||||||||||||||
1518 | - | |||||||||||||||||||
1519 | bool canDiskCache; | - | ||||||||||||||||||
1520 | - | |||||||||||||||||||
1521 | - | |||||||||||||||||||
1522 | if (httpRequest.operation() == QHttpNetworkRequest::Get
| 0-70 | ||||||||||||||||||
1523 | - | |||||||||||||||||||
1524 | canDiskCache = true; | - | ||||||||||||||||||
1525 | - | |||||||||||||||||||
1526 | - | |||||||||||||||||||
1527 | - | |||||||||||||||||||
1528 | it = cacheHeaders.findRawHeader("pragma"); | - | ||||||||||||||||||
1529 | if (it != cacheHeaders.rawHeaders.constEnd()
| 0-70 | ||||||||||||||||||
1530 | && it->second == "no-cache"
| 0 | ||||||||||||||||||
1531 | canDiskCache = false; never executed: canDiskCache = false; | 0 | ||||||||||||||||||
1532 | - | |||||||||||||||||||
1533 | - | |||||||||||||||||||
1534 | if (cacheControl.contains("no-cache")
| 7-63 | ||||||||||||||||||
1535 | canDiskCache = false; executed 7 times by 1 test: canDiskCache = false; Executed by:
| 7 | ||||||||||||||||||
1536 | else if (cacheControl.contains("no-store")
| 0-63 | ||||||||||||||||||
1537 | canDiskCache = false; never executed: canDiskCache = false; | 0 | ||||||||||||||||||
1538 | - | |||||||||||||||||||
1539 | - | |||||||||||||||||||
1540 | } executed 70 times by 3 tests: else if (httpRequest.operation() == QHttpNetworkRequest::Postend of block Executed by:
| 0-70 | ||||||||||||||||||
1541 | - | |||||||||||||||||||
1542 | canDiskCache = false; | - | ||||||||||||||||||
1543 | - | |||||||||||||||||||
1544 | - | |||||||||||||||||||
1545 | if (cacheControl.contains("max-age")
| 0 | ||||||||||||||||||
1546 | canDiskCache = true; never executed: canDiskCache = true; | 0 | ||||||||||||||||||
1547 | - | |||||||||||||||||||
1548 | - | |||||||||||||||||||
1549 | } never executed: else {end of block | 0 | ||||||||||||||||||
1550 | canDiskCache = false; | - | ||||||||||||||||||
1551 | } never executed: end of block | 0 | ||||||||||||||||||
1552 | - | |||||||||||||||||||
1553 | metaData.setSaveToDisk(canDiskCache); | - | ||||||||||||||||||
1554 | QNetworkCacheMetaData::AttributesMap attributes; | - | ||||||||||||||||||
1555 | if (statusCode != 304
| 9-61 | ||||||||||||||||||
1556 | - | |||||||||||||||||||
1557 | attributes.insert(QNetworkRequest::HttpStatusCodeAttribute, statusCode); | - | ||||||||||||||||||
1558 | attributes.insert(QNetworkRequest::HttpReasonPhraseAttribute, reasonPhrase); | - | ||||||||||||||||||
1559 | } executed 61 times by 3 tests: else {end of block Executed by:
| 61 | ||||||||||||||||||
1560 | - | |||||||||||||||||||
1561 | attributes = oldMetaData.attributes(); | - | ||||||||||||||||||
1562 | } executed 9 times by 2 tests: end of block Executed by:
| 9 | ||||||||||||||||||
1563 | metaData.setAttributes(attributes); | - | ||||||||||||||||||
1564 | return executed 70 times by 3 tests: metaData;return metaData; Executed by:
executed 70 times by 3 tests: return metaData; Executed by:
| 70 | ||||||||||||||||||
1565 | } | - | ||||||||||||||||||
1566 | - | |||||||||||||||||||
1567 | bool QNetworkReplyHttpImplPrivate::canResume() const | - | ||||||||||||||||||
1568 | { | - | ||||||||||||||||||
1569 | const QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1570 | - | |||||||||||||||||||
1571 | - | |||||||||||||||||||
1572 | if (operation != QNetworkAccessManager::GetOperation
| 0 | ||||||||||||||||||
1573 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1574 | - | |||||||||||||||||||
1575 | - | |||||||||||||||||||
1576 | QByteArray acceptRangesheaderName("Accept-Ranges"); | - | ||||||||||||||||||
1577 | if (!q->hasRawHeader(acceptRangesheaderName)
| 0 | ||||||||||||||||||
1578 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1579 | - | |||||||||||||||||||
1580 | - | |||||||||||||||||||
1581 | if (request.hasRawHeader("Range")
| 0 | ||||||||||||||||||
1582 | QByteArray range = request.rawHeader("Range"); | - | ||||||||||||||||||
1583 | if (!range.startsWith("bytes=")
| 0 | ||||||||||||||||||
1584 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1585 | } never executed: end of block | 0 | ||||||||||||||||||
1586 | - | |||||||||||||||||||
1587 | - | |||||||||||||||||||
1588 | - | |||||||||||||||||||
1589 | if (downloadZerocopyBuffer
| 0 | ||||||||||||||||||
1590 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1591 | - | |||||||||||||||||||
1592 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
1593 | } | - | ||||||||||||||||||
1594 | - | |||||||||||||||||||
1595 | void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset) | - | ||||||||||||||||||
1596 | { | - | ||||||||||||||||||
1597 | resumeOffset = offset; | - | ||||||||||||||||||
1598 | } never executed: end of block | 0 | ||||||||||||||||||
1599 | - | |||||||||||||||||||
1600 | - | |||||||||||||||||||
1601 | - | |||||||||||||||||||
1602 | - | |||||||||||||||||||
1603 | - | |||||||||||||||||||
1604 | - | |||||||||||||||||||
1605 | bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) | - | ||||||||||||||||||
1606 | { | - | ||||||||||||||||||
1607 | - | |||||||||||||||||||
1608 | QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession()); | - | ||||||||||||||||||
1609 | if (!networkSession
| 0-946 | ||||||||||||||||||
1610 | - | |||||||||||||||||||
1611 | postRequest(newHttpRequest); | - | ||||||||||||||||||
1612 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
1613 | - | |||||||||||||||||||
1614 | } | - | ||||||||||||||||||
1615 | - | |||||||||||||||||||
1616 | - | |||||||||||||||||||
1617 | const QString host = url.host(); | - | ||||||||||||||||||
1618 | if (host == QLatin1String("localhost")
| 138-808 | ||||||||||||||||||
1619 | QHostAddress(host).isLoopback()
| 43-765 | ||||||||||||||||||
1620 | - | |||||||||||||||||||
1621 | postRequest(newHttpRequest); | - | ||||||||||||||||||
1622 | return executed 181 times by 4 tests: true;return true; Executed by:
executed 181 times by 4 tests: return true; Executed by:
| 181 | ||||||||||||||||||
1623 | } | - | ||||||||||||||||||
1624 | - | |||||||||||||||||||
1625 | if (networkSession->isOpen()
| 56-709 | ||||||||||||||||||
1626 | networkSession->state() == QNetworkSession::Connected
| 0-709 | ||||||||||||||||||
1627 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1628 | QObject::connect(networkSession.data(), qFlagLocation("2""usagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "1709"), | - | ||||||||||||||||||
1629 | q, qFlagLocation("1""_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "1710")); | - | ||||||||||||||||||
1630 | postRequest(newHttpRequest); | - | ||||||||||||||||||
1631 | return executed 709 times by 5 tests: true;return true; Executed by:
executed 709 times by 5 tests: return true; Executed by:
| 709 | ||||||||||||||||||
1632 | } else if (synchronous
| 0-56 | ||||||||||||||||||
1633 | - | |||||||||||||||||||
1634 | networkSession->open(); | - | ||||||||||||||||||
1635 | if (networkSession->waitForOpened()
| 0 | ||||||||||||||||||
1636 | postRequest(newHttpRequest); | - | ||||||||||||||||||
1637 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
1638 | } | - | ||||||||||||||||||
1639 | } never executed: end of block | 0 | ||||||||||||||||||
1640 | return executed 56 times by 5 tests: false;return false; Executed by:
executed 56 times by 5 tests: return false; Executed by:
| 56 | ||||||||||||||||||
1641 | - | |||||||||||||||||||
1642 | } | - | ||||||||||||||||||
1643 | - | |||||||||||||||||||
1644 | void QNetworkReplyHttpImplPrivate::_q_startOperation() | - | ||||||||||||||||||
1645 | { | - | ||||||||||||||||||
1646 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1647 | - | |||||||||||||||||||
1648 | - | |||||||||||||||||||
1649 | if (state == Working
| 0-943 | ||||||||||||||||||
1650 | QMessageLogger(__FILE__, 1731, __PRETTY_FUNCTION__).debug("QNetworkReplyImpl::_q_startOperation was called more than once"); | - | ||||||||||||||||||
1651 | return; never executed: return; | 0 | ||||||||||||||||||
1652 | } | - | ||||||||||||||||||
1653 | state = Working; | - | ||||||||||||||||||
1654 | - | |||||||||||||||||||
1655 | - | |||||||||||||||||||
1656 | - | |||||||||||||||||||
1657 | QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); | - | ||||||||||||||||||
1658 | QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false)); | - | ||||||||||||||||||
1659 | if (isBackground.toBool()
| 0-935 | ||||||||||||||||||
1660 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - | ||||||||||||||||||
1661 | QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::BackgroundRequestNotAllowedError), | - | ||||||||||||||||||
1662 | QArgument<QString >("QString", QCoreApplication::translate("QNetworkReply", "Background request not allowed."))); | - | ||||||||||||||||||
1663 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - | ||||||||||||||||||
1664 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
1665 | } | - | ||||||||||||||||||
1666 | - | |||||||||||||||||||
1667 | if (!start(request)
| 56-885 | ||||||||||||||||||
1668 | - | |||||||||||||||||||
1669 | - | |||||||||||||||||||
1670 | - | |||||||||||||||||||
1671 | state = WaitingForSession; | - | ||||||||||||||||||
1672 | - | |||||||||||||||||||
1673 | if (session
| 0-56 | ||||||||||||||||||
1674 | QObject::connect(session.data(), qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1755"), | - | ||||||||||||||||||
1675 | q, qFlagLocation("1""_q_networkSessionFailed()" "\0" __FILE__ ":" "1756"), Qt::QueuedConnection); | - | ||||||||||||||||||
1676 | - | |||||||||||||||||||
1677 | if (!session->isOpen()
| 0-56 | ||||||||||||||||||
1678 | session->setSessionProperty(([]() -> QString { enum { Size = sizeof(u"" "ConnectInBackground")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ConnectInBackground" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 56 times by 5 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 56 times by 5 tests: }()), isBackground);return qstring_literal_temp; Executed by:
| 56 | ||||||||||||||||||
1679 | session->open(); | - | ||||||||||||||||||
1680 | } executed 56 times by 5 tests: end of block Executed by:
| 56 | ||||||||||||||||||
1681 | } executed 56 times by 5 tests: else {end of block Executed by:
| 56 | ||||||||||||||||||
1682 | QMessageLogger(__FILE__, 1763, __PRETTY_FUNCTION__).warning("Backend is waiting for QNetworkSession to connect, but there is none!"); | - | ||||||||||||||||||
1683 | QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, | - | ||||||||||||||||||
1684 | QArgument<QNetworkReply::NetworkError >("QNetworkReply::NetworkError", QNetworkReply::NetworkSessionFailedError), | - | ||||||||||||||||||
1685 | QArgument<QString >("QString", QCoreApplication::translate("QNetworkReply", "Network session error."))); | - | ||||||||||||||||||
1686 | QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); | - | ||||||||||||||||||
1687 | return; never executed: return; | 0 | ||||||||||||||||||
1688 | } | - | ||||||||||||||||||
1689 | } else if (session
| 0-885 | ||||||||||||||||||
1690 | QObject::connect(session.data(), qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1771"), | - | ||||||||||||||||||
1691 | q, qFlagLocation("1""_q_networkSessionStateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1772"), | - | ||||||||||||||||||
1692 | Qt::QueuedConnection); | - | ||||||||||||||||||
1693 | } executed 885 times by 8 tests: end of block Executed by:
| 885 | ||||||||||||||||||
1694 | if (synchronous
| 76-865 | ||||||||||||||||||
1695 | state = Finished; | - | ||||||||||||||||||
1696 | q_func()->setFinished(true); | - | ||||||||||||||||||
1697 | } executed 76 times by 1 test: end of block Executed by:
| 76 | ||||||||||||||||||
1698 | } executed 941 times by 8 tests: end of block Executed by:
| 941 | ||||||||||||||||||
1699 | - | |||||||||||||||||||
1700 | void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead() | - | ||||||||||||||||||
1701 | { | - | ||||||||||||||||||
1702 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1703 | - | |||||||||||||||||||
1704 | if (state != Working
| 0-27 | ||||||||||||||||||
1705 | return; never executed: return; | 0 | ||||||||||||||||||
1706 | if (!cacheLoadDevice
| 0-27 | ||||||||||||||||||
1707 | return; never executed: return; | 0 | ||||||||||||||||||
1708 | - | |||||||||||||||||||
1709 | - | |||||||||||||||||||
1710 | - | |||||||||||||||||||
1711 | - | |||||||||||||||||||
1712 | - | |||||||||||||||||||
1713 | - | |||||||||||||||||||
1714 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - | ||||||||||||||||||
1715 | - | |||||||||||||||||||
1716 | - | |||||||||||||||||||
1717 | - | |||||||||||||||||||
1718 | - | |||||||||||||||||||
1719 | if (!(isHttpRedirectResponse())
| 0-27 | ||||||||||||||||||
1720 | - | |||||||||||||||||||
1721 | q->readyRead(); | - | ||||||||||||||||||
1722 | - | |||||||||||||||||||
1723 | if (downloadProgressSignalChoke.elapsed() >= progressSignalInterval
| 0-27 | ||||||||||||||||||
1724 | downloadProgressSignalChoke.restart(); | - | ||||||||||||||||||
1725 | q->downloadProgress(bytesDownloaded, | - | ||||||||||||||||||
1726 | totalSize.isNull() ? static_cast<long long>(-1LL) : totalSize.toLongLong()); | - | ||||||||||||||||||
1727 | } never executed: end of block | 0 | ||||||||||||||||||
1728 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||
1729 | - | |||||||||||||||||||
1730 | - | |||||||||||||||||||
1731 | - | |||||||||||||||||||
1732 | while (cacheLoadDevice->bytesAvailable()
| 0-27 | ||||||||||||||||||
1733 | downloadMultiBuffer.append(cacheLoadDevice->readAll()); | - | ||||||||||||||||||
1734 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||
1735 | - | |||||||||||||||||||
1736 | if (cacheLoadDevice->isSequential()
| 0-27 | ||||||||||||||||||
1737 | - | |||||||||||||||||||
1738 | char c; | - | ||||||||||||||||||
1739 | qint64 actualCount = cacheLoadDevice->read(&c, 1); | - | ||||||||||||||||||
1740 | if (actualCount < 0
| 0 | ||||||||||||||||||
1741 | cacheLoadDevice->deleteLater(); | - | ||||||||||||||||||
1742 | cacheLoadDevice = 0; | - | ||||||||||||||||||
1743 | QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); | - | ||||||||||||||||||
1744 | } never executed: else if (actualCount == 1end of block
| 0 | ||||||||||||||||||
1745 | - | |||||||||||||||||||
1746 | - | |||||||||||||||||||
1747 | cacheLoadDevice->ungetChar(c); | - | ||||||||||||||||||
1748 | } never executed: end of block | 0 | ||||||||||||||||||
1749 | } never executed: else if ((!cacheLoadDevice->isSequential()end of block
| 0-27 | ||||||||||||||||||
1750 | - | |||||||||||||||||||
1751 | cacheLoadDevice->deleteLater(); | - | ||||||||||||||||||
1752 | cacheLoadDevice = 0; | - | ||||||||||||||||||
1753 | QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection); | - | ||||||||||||||||||
1754 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||
1755 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||
1756 | - | |||||||||||||||||||
1757 | - | |||||||||||||||||||
1758 | void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingDataFinished() | - | ||||||||||||||||||
1759 | { | - | ||||||||||||||||||
1760 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1761 | - | |||||||||||||||||||
1762 | - | |||||||||||||||||||
1763 | - | |||||||||||||||||||
1764 | if (state != Buffering
| 0-58 | ||||||||||||||||||
1765 | return; never executed: return; | 0 | ||||||||||||||||||
1766 | - | |||||||||||||||||||
1767 | - | |||||||||||||||||||
1768 | QObject::disconnect(outgoingData, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "1860"), q, qFlagLocation("1""_q_bufferOutgoingData()" "\0" __FILE__ ":" "1860")); | - | ||||||||||||||||||
1769 | QObject::disconnect(outgoingData, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "1861"), q, qFlagLocation("1""_q_bufferOutgoingDataFinished()" "\0" __FILE__ ":" "1861")); | - | ||||||||||||||||||
1770 | - | |||||||||||||||||||
1771 | - | |||||||||||||||||||
1772 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - | ||||||||||||||||||
1773 | } executed 58 times by 1 test: end of block Executed by:
| 58 | ||||||||||||||||||
1774 | - | |||||||||||||||||||
1775 | void QNetworkReplyHttpImplPrivate::_q_cacheSaveDeviceAboutToClose() | - | ||||||||||||||||||
1776 | { | - | ||||||||||||||||||
1777 | - | |||||||||||||||||||
1778 | - | |||||||||||||||||||
1779 | cacheSaveDevice = 0; | - | ||||||||||||||||||
1780 | } executed 54 times by 3 tests: end of block Executed by:
| 54 | ||||||||||||||||||
1781 | - | |||||||||||||||||||
1782 | void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData() | - | ||||||||||||||||||
1783 | { | - | ||||||||||||||||||
1784 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1785 | - | |||||||||||||||||||
1786 | if (!outgoingDataBuffer
| 48-58 | ||||||||||||||||||
1787 | - | |||||||||||||||||||
1788 | outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); | - | ||||||||||||||||||
1789 | - | |||||||||||||||||||
1790 | QObject::connect(outgoingData, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "1882"), q, qFlagLocation("1""_q_bufferOutgoingData()" "\0" __FILE__ ":" "1882")); | - | ||||||||||||||||||
1791 | QObject::connect(outgoingData, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "1883"), q, qFlagLocation("1""_q_bufferOutgoingDataFinished()" "\0" __FILE__ ":" "1883")); | - | ||||||||||||||||||
1792 | } executed 58 times by 1 test: end of block Executed by:
| 58 | ||||||||||||||||||
1793 | - | |||||||||||||||||||
1794 | qint64 bytesBuffered = 0; | - | ||||||||||||||||||
1795 | qint64 bytesToBuffer = 0; | - | ||||||||||||||||||
1796 | - | |||||||||||||||||||
1797 | - | |||||||||||||||||||
1798 | for(;;) { | - | ||||||||||||||||||
1799 | bytesToBuffer = outgoingData->bytesAvailable(); | - | ||||||||||||||||||
1800 | - | |||||||||||||||||||
1801 | if (bytesToBuffer <= 0
| 48-106 | ||||||||||||||||||
1802 | bytesToBuffer = 2*1024; executed 106 times by 1 test: bytesToBuffer = 2*1024; Executed by:
| 106 | ||||||||||||||||||
1803 | - | |||||||||||||||||||
1804 | char *dst = outgoingDataBuffer->reserve(bytesToBuffer); | - | ||||||||||||||||||
1805 | bytesBuffered = outgoingData->read(dst, bytesToBuffer); | - | ||||||||||||||||||
1806 | - | |||||||||||||||||||
1807 | if (bytesBuffered == -1
| 0-154 | ||||||||||||||||||
1808 | - | |||||||||||||||||||
1809 | outgoingDataBuffer->chop(bytesToBuffer); | - | ||||||||||||||||||
1810 | - | |||||||||||||||||||
1811 | _q_bufferOutgoingDataFinished(); | - | ||||||||||||||||||
1812 | break; never executed: break; | 0 | ||||||||||||||||||
1813 | } else if (bytesBuffered == 0
| 48-106 | ||||||||||||||||||
1814 | - | |||||||||||||||||||
1815 | outgoingDataBuffer->chop(bytesToBuffer); | - | ||||||||||||||||||
1816 | - | |||||||||||||||||||
1817 | break; executed 106 times by 1 test: break; Executed by:
| 106 | ||||||||||||||||||
1818 | } else { | - | ||||||||||||||||||
1819 | - | |||||||||||||||||||
1820 | outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered); | - | ||||||||||||||||||
1821 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||
1822 | } | - | ||||||||||||||||||
1823 | } executed 106 times by 1 test: end of block Executed by:
| 106 | ||||||||||||||||||
1824 | - | |||||||||||||||||||
1825 | - | |||||||||||||||||||
1826 | void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected() | - | ||||||||||||||||||
1827 | { | - | ||||||||||||||||||
1828 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1829 | - | |||||||||||||||||||
1830 | if (!manager
| 0-158 | ||||||||||||||||||
1831 | return; never executed: return; | 0 | ||||||||||||||||||
1832 | - | |||||||||||||||||||
1833 | QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); | - | ||||||||||||||||||
1834 | if (!session
| 0-158 | ||||||||||||||||||
1835 | return; never executed: return; | 0 | ||||||||||||||||||
1836 | - | |||||||||||||||||||
1837 | if (session->state() != QNetworkSession::Connected
| 0-158 | ||||||||||||||||||
1838 | return; never executed: return; | 0 | ||||||||||||||||||
1839 | - | |||||||||||||||||||
1840 | switch (state) { | - | ||||||||||||||||||
1841 | case never executed: QNetworkReplyPrivate::Buffering:case QNetworkReplyPrivate::Buffering: never executed: case QNetworkReplyPrivate::Buffering: | 0 | ||||||||||||||||||
1842 | case never executed: QNetworkReplyPrivate::Working:case QNetworkReplyPrivate::Working: never executed: case QNetworkReplyPrivate::Working: | 0 | ||||||||||||||||||
1843 | case never executed: QNetworkReplyPrivate::Reconnecting:case QNetworkReplyPrivate::Reconnecting: never executed: case QNetworkReplyPrivate::Reconnecting: | 0 | ||||||||||||||||||
1844 | - | |||||||||||||||||||
1845 | migrateBackend(); | - | ||||||||||||||||||
1846 | break; never executed: break; | 0 | ||||||||||||||||||
1847 | case executed 56 times by 5 tests: QNetworkReplyPrivate::WaitingForSession:case QNetworkReplyPrivate::WaitingForSession: Executed by:
executed 56 times by 5 tests: case QNetworkReplyPrivate::WaitingForSession: Executed by:
| 56 | ||||||||||||||||||
1848 | - | |||||||||||||||||||
1849 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - | ||||||||||||||||||
1850 | break; executed 56 times by 5 tests: break; Executed by:
| 56 | ||||||||||||||||||
1851 | default executed 102 times by 1 test: :default: Executed by:
executed 102 times by 1 test: default: Executed by:
| 102 | ||||||||||||||||||
1852 | ; | - | ||||||||||||||||||
1853 | } executed 102 times by 1 test: end of block Executed by:
| 102 | ||||||||||||||||||
1854 | } | - | ||||||||||||||||||
1855 | - | |||||||||||||||||||
1856 | void QNetworkReplyHttpImplPrivate::_q_networkSessionStateChanged(QNetworkSession::State sessionState) | - | ||||||||||||||||||
1857 | { | - | ||||||||||||||||||
1858 | if (sessionState == QNetworkSession::Disconnected
| 0 | ||||||||||||||||||
1859 | && state != Idle
| 0 | ||||||||||||||||||
1860 | error(QNetworkReplyImpl::NetworkSessionFailedError, | - | ||||||||||||||||||
1861 | QCoreApplication::translate("QNetworkReply", "Network session error.")); | - | ||||||||||||||||||
1862 | finished(); | - | ||||||||||||||||||
1863 | } never executed: end of block | 0 | ||||||||||||||||||
1864 | } never executed: end of block | 0 | ||||||||||||||||||
1865 | - | |||||||||||||||||||
1866 | void QNetworkReplyHttpImplPrivate::_q_networkSessionFailed() | - | ||||||||||||||||||
1867 | { | - | ||||||||||||||||||
1868 | - | |||||||||||||||||||
1869 | if (state == WaitingForSession
| 0 | ||||||||||||||||||
1870 | state = Working; | - | ||||||||||||||||||
1871 | QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); | - | ||||||||||||||||||
1872 | QString errorStr; | - | ||||||||||||||||||
1873 | if (session
| 0 | ||||||||||||||||||
1874 | errorStr = session->errorString(); never executed: errorStr = session->errorString(); | 0 | ||||||||||||||||||
1875 | else | - | ||||||||||||||||||
1876 | errorStr = QCoreApplication::translate("QNetworkReply", "Network session error."); never executed: errorStr = QCoreApplication::translate("QNetworkReply", "Network session error."); | 0 | ||||||||||||||||||
1877 | error(QNetworkReplyImpl::NetworkSessionFailedError, errorStr); | - | ||||||||||||||||||
1878 | finished(); | - | ||||||||||||||||||
1879 | } never executed: end of block | 0 | ||||||||||||||||||
1880 | } never executed: end of block | 0 | ||||||||||||||||||
1881 | - | |||||||||||||||||||
1882 | void QNetworkReplyHttpImplPrivate::_q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies newPolicies) | - | ||||||||||||||||||
1883 | { | - | ||||||||||||||||||
1884 | if (request.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()
| 4-6 | ||||||||||||||||||
1885 | if (newPolicies & QNetworkSession::NoBackgroundTrafficPolicy
| 2 | ||||||||||||||||||
1886 | - | |||||||||||||||||||
1887 | if (state == WaitingForSession
| 0-2 | ||||||||||||||||||
1888 | state = Working; | - | ||||||||||||||||||
1889 | error(QNetworkReply::BackgroundRequestNotAllowedError, | - | ||||||||||||||||||
1890 | QCoreApplication::translate("QNetworkReply", "Background request not allowed.")); | - | ||||||||||||||||||
1891 | finished(); | - | ||||||||||||||||||
1892 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1893 | - | |||||||||||||||||||
1894 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1895 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
1896 | - | |||||||||||||||||||
1897 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
1898 | - | |||||||||||||||||||
1899 | - | |||||||||||||||||||
1900 | - | |||||||||||||||||||
1901 | - | |||||||||||||||||||
1902 | - | |||||||||||||||||||
1903 | void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) | - | ||||||||||||||||||
1904 | { | - | ||||||||||||||||||
1905 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1906 | if (isFinished
| 0-2695 | ||||||||||||||||||
1907 | return; never executed: return; | 0 | ||||||||||||||||||
1908 | - | |||||||||||||||||||
1909 | if (!emitAllUploadProgressSignals
| 64-2631 | ||||||||||||||||||
1910 | - | |||||||||||||||||||
1911 | if (uploadProgressSignalChoke.isValid()
| 133-2498 | ||||||||||||||||||
1912 | if (bytesSent != bytesTotal
| 21-2425 | ||||||||||||||||||
1913 | return; executed 2404 times by 2 tests: return; Executed by:
| 2404 | ||||||||||||||||||
1914 | } | - | ||||||||||||||||||
1915 | uploadProgressSignalChoke.restart(); | - | ||||||||||||||||||
1916 | } executed 94 times by 2 tests: else {end of block Executed by:
| 94 | ||||||||||||||||||
1917 | uploadProgressSignalChoke.start(); | - | ||||||||||||||||||
1918 | } executed 133 times by 2 tests: end of block Executed by:
| 133 | ||||||||||||||||||
1919 | } | - | ||||||||||||||||||
1920 | - | |||||||||||||||||||
1921 | q->uploadProgress(bytesSent, bytesTotal); | - | ||||||||||||||||||
1922 | } executed 291 times by 2 tests: end of block Executed by:
| 291 | ||||||||||||||||||
1923 | - | |||||||||||||||||||
1924 | QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice() | - | ||||||||||||||||||
1925 | { | - | ||||||||||||||||||
1926 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1927 | - | |||||||||||||||||||
1928 | if (outgoingDataBuffer
| 99-101 | ||||||||||||||||||
1929 | uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingDataBuffer); executed 99 times by 1 test: uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingDataBuffer); Executed by:
| 99 | ||||||||||||||||||
1930 | else if (outgoingData
| 4-97 | ||||||||||||||||||
1931 | uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingData); | - | ||||||||||||||||||
1932 | } executed 97 times by 3 tests: else {end of block Executed by:
| 97 | ||||||||||||||||||
1933 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 4 | ||||||||||||||||||
1934 | } | - | ||||||||||||||||||
1935 | - | |||||||||||||||||||
1936 | - | |||||||||||||||||||
1937 | if (!synchronous
| 41-155 | ||||||||||||||||||
1938 | QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "2030"), executed 155 times by 3 tests: QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "2030"), q, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "2031")); Executed by:
| 155 | ||||||||||||||||||
1939 | q, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "2031")); executed 155 times by 3 tests: QObject::connect(uploadByteDevice.data(), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "2030"), q, qFlagLocation("1""emitReplyUploadProgress(qint64,qint64)" "\0" __FILE__ ":" "2031")); Executed by:
| 155 | ||||||||||||||||||
1940 | - | |||||||||||||||||||
1941 | return executed 196 times by 3 tests: uploadByteDevice.data();return uploadByteDevice.data(); Executed by:
executed 196 times by 3 tests: return uploadByteDevice.data(); Executed by:
| 196 | ||||||||||||||||||
1942 | } | - | ||||||||||||||||||
1943 | - | |||||||||||||||||||
1944 | void QNetworkReplyHttpImplPrivate::_q_finished() | - | ||||||||||||||||||
1945 | { | - | ||||||||||||||||||
1946 | - | |||||||||||||||||||
1947 | finished(); | - | ||||||||||||||||||
1948 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||||||||
1949 | - | |||||||||||||||||||
1950 | void QNetworkReplyHttpImplPrivate::finished() | - | ||||||||||||||||||
1951 | { | - | ||||||||||||||||||
1952 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
1953 | - | |||||||||||||||||||
1954 | if (state == Finished
| 0-869 | ||||||||||||||||||
1955 | return; never executed: return; | 0 | ||||||||||||||||||
1956 | - | |||||||||||||||||||
1957 | QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); | - | ||||||||||||||||||
1958 | if (preMigrationDownloaded != static_cast<long long>(-1LL)
| 0-869 | ||||||||||||||||||
1959 | totalSize = totalSize.toLongLong() + preMigrationDownloaded; never executed: totalSize = totalSize.toLongLong() + preMigrationDownloaded; | 0 | ||||||||||||||||||
1960 | - | |||||||||||||||||||
1961 | if (manager
| 0-869 | ||||||||||||||||||
1962 | - | |||||||||||||||||||
1963 | QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); | - | ||||||||||||||||||
1964 | if (session
| 0-869 | ||||||||||||||||||
1965 | state == Working
| 0 | ||||||||||||||||||
1966 | - | |||||||||||||||||||
1967 | if (!totalSize.isNull()
| 0 | ||||||||||||||||||
1968 | if (bytesDownloaded != totalSize
| 0 | ||||||||||||||||||
1969 | if (migrateBackend()
| 0 | ||||||||||||||||||
1970 | - | |||||||||||||||||||
1971 | if (state == Reconnecting
| 0 | ||||||||||||||||||
1972 | return; never executed: return; | 0 | ||||||||||||||||||
1973 | } | - | ||||||||||||||||||
1974 | } never executed: else {end of block | 0 | ||||||||||||||||||
1975 | error(QNetworkReply::TemporaryNetworkFailureError, | - | ||||||||||||||||||
1976 | QNetworkReply::tr("Temporary network failure.")); | - | ||||||||||||||||||
1977 | } never executed: end of block | 0 | ||||||||||||||||||
1978 | } | - | ||||||||||||||||||
1979 | } never executed: end of block | 0 | ||||||||||||||||||
1980 | } never executed: end of block | 0 | ||||||||||||||||||
1981 | - | |||||||||||||||||||
1982 | } executed 869 times by 7 tests: end of block Executed by:
| 869 | ||||||||||||||||||
1983 | - | |||||||||||||||||||
1984 | - | |||||||||||||||||||
1985 | if (totalSize.isNull()
| 0-550 | ||||||||||||||||||
1986 | completeCacheSave(); executed 837 times by 7 tests: completeCacheSave(); Executed by:
| 837 | ||||||||||||||||||
1987 | - | |||||||||||||||||||
1988 | - | |||||||||||||||||||
1989 | - | |||||||||||||||||||
1990 | if (isHttpRedirectResponse()
| 1-863 | ||||||||||||||||||
1991 | return; executed 5 times by 1 test: return; Executed by:
| 5 | ||||||||||||||||||
1992 | - | |||||||||||||||||||
1993 | state = Finished; | - | ||||||||||||||||||
1994 | q->setFinished(true); | - | ||||||||||||||||||
1995 | - | |||||||||||||||||||
1996 | if (totalSize.isNull()
| 0-550 | ||||||||||||||||||
1997 | q->downloadProgress(bytesDownloaded, bytesDownloaded); | - | ||||||||||||||||||
1998 | } executed 314 times by 5 tests: else {end of block Executed by:
| 314 | ||||||||||||||||||
1999 | q->downloadProgress(bytesDownloaded, totalSize.toLongLong()); | - | ||||||||||||||||||
2000 | } executed 550 times by 6 tests: end of block Executed by:
| 550 | ||||||||||||||||||
2001 | - | |||||||||||||||||||
2002 | if (bytesUploaded == -1
| 0-864 | ||||||||||||||||||
2003 | q->uploadProgress(0, 0); executed 195 times by 2 tests: q->uploadProgress(0, 0); Executed by:
| 195 | ||||||||||||||||||
2004 | - | |||||||||||||||||||
2005 | q->readChannelFinished(); | - | ||||||||||||||||||
2006 | q->finished(); | - | ||||||||||||||||||
2007 | } executed 864 times by 7 tests: end of block Executed by:
| 864 | ||||||||||||||||||
2008 | - | |||||||||||||||||||
2009 | void QNetworkReplyHttpImplPrivate::_q_error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage) | - | ||||||||||||||||||
2010 | { | - | ||||||||||||||||||
2011 | this->error(code, errorMessage); | - | ||||||||||||||||||
2012 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
2013 | - | |||||||||||||||||||
2014 | - | |||||||||||||||||||
2015 | void QNetworkReplyHttpImplPrivate::error(QNetworkReplyImpl::NetworkError code, const QString &errorMessage) | - | ||||||||||||||||||
2016 | { | - | ||||||||||||||||||
2017 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
2018 | - | |||||||||||||||||||
2019 | if (errorCode != QNetworkReply::NoError
| 0-122 | ||||||||||||||||||
2020 | QMessageLogger(__FILE__, 2112, __PRETTY_FUNCTION__).warning("QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once."); | - | ||||||||||||||||||
2021 | return; never executed: return; | 0 | ||||||||||||||||||
2022 | } | - | ||||||||||||||||||
2023 | - | |||||||||||||||||||
2024 | errorCode = code; | - | ||||||||||||||||||
2025 | q->setErrorString(errorMessage); | - | ||||||||||||||||||
2026 | - | |||||||||||||||||||
2027 | - | |||||||||||||||||||
2028 | - | |||||||||||||||||||
2029 | - | |||||||||||||||||||
2030 | q->error(code); | - | ||||||||||||||||||
2031 | } executed 122 times by 4 tests: end of block Executed by:
| 122 | ||||||||||||||||||
2032 | - | |||||||||||||||||||
2033 | void QNetworkReplyHttpImplPrivate::_q_metaDataChanged() | - | ||||||||||||||||||
2034 | { | - | ||||||||||||||||||
2035 | - | |||||||||||||||||||
2036 | - | |||||||||||||||||||
2037 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
2038 | - | |||||||||||||||||||
2039 | - | |||||||||||||||||||
2040 | if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader)
| 0-801 | ||||||||||||||||||
2041 | && (static_cast<
| 0-13 | ||||||||||||||||||
2042 | (request.attribute(QNetworkRequest::CookieSaveControlAttribute,
| 0-13 | ||||||||||||||||||
2043 | QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic)
| 0-13 | ||||||||||||||||||
2044 | QList<QNetworkCookie> cookies = | - | ||||||||||||||||||
2045 | qvariant_cast<QList<QNetworkCookie> >(cookedHeaders.value(QNetworkRequest::SetCookieHeader)); | - | ||||||||||||||||||
2046 | QNetworkCookieJar *jar = manager->cookieJar(); | - | ||||||||||||||||||
2047 | if (jar
| 0-13 | ||||||||||||||||||
2048 | jar->setCookiesFromUrl(cookies, url); executed 13 times by 1 test: jar->setCookiesFromUrl(cookies, url); Executed by:
| 13 | ||||||||||||||||||
2049 | } executed 13 times by 1 test: end of block Executed by:
| 13 | ||||||||||||||||||
2050 | q->metaDataChanged(); | - | ||||||||||||||||||
2051 | } executed 814 times by 6 tests: end of block Executed by:
| 814 | ||||||||||||||||||
2052 | - | |||||||||||||||||||
2053 | - | |||||||||||||||||||
2054 | - | |||||||||||||||||||
2055 | - | |||||||||||||||||||
2056 | - | |||||||||||||||||||
2057 | bool QNetworkReplyHttpImplPrivate::migrateBackend() | - | ||||||||||||||||||
2058 | { | - | ||||||||||||||||||
2059 | QNetworkReplyHttpImpl * const q = q_func(); | - | ||||||||||||||||||
2060 | - | |||||||||||||||||||
2061 | - | |||||||||||||||||||
2062 | if (state == Finished
| 0 | ||||||||||||||||||
2063 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
2064 | - | |||||||||||||||||||
2065 | - | |||||||||||||||||||
2066 | if (!canResume()
| 0 | ||||||||||||||||||
2067 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
2068 | - | |||||||||||||||||||
2069 | - | |||||||||||||||||||
2070 | if (outgoingData
| 0 | ||||||||||||||||||
2071 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
2072 | - | |||||||||||||||||||
2073 | - | |||||||||||||||||||
2074 | if (cacheLoadDevice
| 0 | ||||||||||||||||||
2075 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
2076 | - | |||||||||||||||||||
2077 | state = Reconnecting; | - | ||||||||||||||||||
2078 | - | |||||||||||||||||||
2079 | cookedHeaders.clear(); | - | ||||||||||||||||||
2080 | rawHeaders.clear(); | - | ||||||||||||||||||
2081 | - | |||||||||||||||||||
2082 | preMigrationDownloaded = bytesDownloaded; | - | ||||||||||||||||||
2083 | - | |||||||||||||||||||
2084 | setResumeOffset(bytesDownloaded); | - | ||||||||||||||||||
2085 | - | |||||||||||||||||||
2086 | q->abortHttpRequest(); | - | ||||||||||||||||||
2087 | - | |||||||||||||||||||
2088 | QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); | - | ||||||||||||||||||
2089 | - | |||||||||||||||||||
2090 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
2091 | } | - | ||||||||||||||||||
2092 | - | |||||||||||||||||||
2093 | - | |||||||||||||||||||
2094 | void QNetworkReplyHttpImplPrivate::createCache() | - | ||||||||||||||||||
2095 | { | - | ||||||||||||||||||
2096 | - | |||||||||||||||||||
2097 | if (!managerPrivate->networkCache
| 75-712 | ||||||||||||||||||
2098 | || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
| 10-65 | ||||||||||||||||||
2099 | return; executed 722 times by 5 tests: return; Executed by:
| 722 | ||||||||||||||||||
2100 | cacheEnabled = true; | - | ||||||||||||||||||
2101 | } executed 65 times by 3 tests: end of block Executed by:
| 65 | ||||||||||||||||||
2102 | - | |||||||||||||||||||
2103 | bool QNetworkReplyHttpImplPrivate::isCachingEnabled() const | - | ||||||||||||||||||
2104 | { | - | ||||||||||||||||||
2105 | return executed 787 times by 6 tests: (cacheEnabledreturn (cacheEnabled && managerPrivate->networkCache != 0); Executed by:
executed 787 times by 6 tests: return (cacheEnabled && managerPrivate->networkCache != 0); Executed by:
| 0-787 | ||||||||||||||||||
2106 | } | - | ||||||||||||||||||
2107 | - | |||||||||||||||||||
2108 | void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable) | - | ||||||||||||||||||
2109 | { | - | ||||||||||||||||||
2110 | if (!enable
| 0-787 | ||||||||||||||||||
2111 | return; executed 27 times by 2 tests: return; Executed by:
| 27 | ||||||||||||||||||
2112 | if (enable
| 0-787 | ||||||||||||||||||
2113 | return; never executed: return; | 0 | ||||||||||||||||||
2114 | - | |||||||||||||||||||
2115 | if (enable
| 0-787 | ||||||||||||||||||
2116 | if (bytesDownloaded
| 0-787 | ||||||||||||||||||
2117 | QMessageLogger(__FILE__, 2209, __PRETTY_FUNCTION__).debug() << "setCachingEnabled: " << bytesDownloaded << " bytesDownloaded"; | - | ||||||||||||||||||
2118 | - | |||||||||||||||||||
2119 | QMessageLogger(__FILE__, 2211, __PRETTY_FUNCTION__).critical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written"); | - | ||||||||||||||||||
2120 | return; never executed: return; | 0 | ||||||||||||||||||
2121 | } | - | ||||||||||||||||||
2122 | - | |||||||||||||||||||
2123 | createCache(); | - | ||||||||||||||||||
2124 | } executed 787 times by 6 tests: else {end of block Executed by:
| 787 | ||||||||||||||||||
2125 | - | |||||||||||||||||||
2126 | - | |||||||||||||||||||
2127 | QMessageLogger(__FILE__, 2219, __PRETTY_FUNCTION__).debug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)"); | - | ||||||||||||||||||
2128 | managerPrivate->networkCache->remove(url); | - | ||||||||||||||||||
2129 | cacheSaveDevice = 0; | - | ||||||||||||||||||
2130 | cacheEnabled = false; | - | ||||||||||||||||||
2131 | } never executed: end of block | 0 | ||||||||||||||||||
2132 | } | - | ||||||||||||||||||
2133 | - | |||||||||||||||||||
2134 | bool QNetworkReplyHttpImplPrivate::isCachingAllowed() const | - | ||||||||||||||||||
2135 | { | - | ||||||||||||||||||
2136 | return executed 64 times by 3 tests: operation == QNetworkAccessManager::GetOperationreturn operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation; Executed by:
executed 64 times by 3 tests: return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation; Executed by:
| 0-64 | ||||||||||||||||||
2137 | } | - | ||||||||||||||||||
2138 | - | |||||||||||||||||||
2139 | void QNetworkReplyHttpImplPrivate::completeCacheSave() | - | ||||||||||||||||||
2140 | { | - | ||||||||||||||||||
2141 | if (cacheEnabled
| 0-781 | ||||||||||||||||||
2142 | managerPrivate->networkCache->remove(url); | - | ||||||||||||||||||
2143 | } never executed: else if (cacheEnabledend of block
| 0-781 | ||||||||||||||||||
2144 | managerPrivate->networkCache->insert(cacheSaveDevice); | - | ||||||||||||||||||
2145 | } executed 53 times by 2 tests: end of block Executed by:
| 53 | ||||||||||||||||||
2146 | cacheSaveDevice = 0; | - | ||||||||||||||||||
2147 | cacheEnabled = false; | - | ||||||||||||||||||
2148 | } executed 837 times by 7 tests: end of block Executed by:
| 837 | ||||||||||||||||||
2149 | - | |||||||||||||||||||
2150 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |