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