| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkaccesscachebackend.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | QNetworkAccessCacheBackend::QNetworkAccessCacheBackend() | - | ||||||||||||
| 5 | : QNetworkAccessBackend() | - | ||||||||||||
| 6 | { | - | ||||||||||||
| 7 | } executed 14 times by 3 tests: end of blockExecuted by:
| 14 | ||||||||||||
| 8 | - | |||||||||||||
| 9 | QNetworkAccessCacheBackend::~QNetworkAccessCacheBackend() | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | } | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | void QNetworkAccessCacheBackend::open() | - | ||||||||||||
| 14 | { | - | ||||||||||||
| 15 | if (operation() != QNetworkAccessManager::GetOperation
| 0-13 | ||||||||||||
| 16 | QString msg = QCoreApplication::translate("QNetworkAccessCacheBackend", "Error opening %1") | - | ||||||||||||
| 17 | .arg(this->url().toString()); | - | ||||||||||||
| 18 | error(QNetworkReply::ContentNotFoundError, msg); | - | ||||||||||||
| 19 | } executed 4 times by 2 tests: else {end of blockExecuted by:
| 4 | ||||||||||||
| 20 | setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); | - | ||||||||||||
| 21 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||
| 22 | finished(); | - | ||||||||||||
| 23 | } executed 13 times by 2 tests: end of blockExecuted by:
| 13 | ||||||||||||
| 24 | - | |||||||||||||
| 25 | bool QNetworkAccessCacheBackend::sendCacheContents() | - | ||||||||||||
| 26 | { | - | ||||||||||||
| 27 | setCachingEnabled(false); | - | ||||||||||||
| 28 | QAbstractNetworkCache *nc = networkCache(); | - | ||||||||||||
| 29 | if (!nc
| 0-13 | ||||||||||||
| 30 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | QNetworkCacheMetaData item = nc->metaData(url()); | - | ||||||||||||
| 33 | if (!item.isValid()
| 1-12 | ||||||||||||
| 34 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||
| 35 | - | |||||||||||||
| 36 | QNetworkCacheMetaData::AttributesMap attributes = item.attributes(); | - | ||||||||||||
| 37 | setAttribute(QNetworkRequest::HttpStatusCodeAttribute, attributes.value(QNetworkRequest::HttpStatusCodeAttribute)); | - | ||||||||||||
| 38 | setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders(); | - | ||||||||||||
| 42 | QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(), | - | ||||||||||||
| 43 | end = rawHeaders.constEnd(); | - | ||||||||||||
| 44 | for ( ; it != end
| 9-39 | ||||||||||||
| 45 | if (it->first.toLower() == "cache-control"
| 5-34 | ||||||||||||
| 46 | it->second.toLower().contains("must-revalidate")
| 2-3 | ||||||||||||
| 47 | return executed 3 times by 2 tests: false;return false;Executed by:
executed 3 times by 2 tests: return false;Executed by:
| 3 | ||||||||||||
| 48 | } | - | ||||||||||||
| 49 | setRawHeader(it->first, it->second); | - | ||||||||||||
| 50 | } executed 36 times by 2 tests: end of blockExecuted by:
| 36 | ||||||||||||
| 51 | - | |||||||||||||
| 52 | - | |||||||||||||
| 53 | QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute); | - | ||||||||||||
| 54 | if (redirectionTarget.isValid()
| 0-9 | ||||||||||||
| 55 | setAttribute(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); | - | ||||||||||||
| 56 | redirectionRequested(redirectionTarget.toUrl()); | - | ||||||||||||
| 57 | } never executed: end of block | 0 | ||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | metaDataChanged(); | - | ||||||||||||
| 61 | - | |||||||||||||
| 62 | if (operation() == QNetworkAccessManager::GetOperation
| 0-9 | ||||||||||||
| 63 | QIODevice *contents = nc->data(url()); | - | ||||||||||||
| 64 | if (!contents
| 0-9 | ||||||||||||
| 65 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 66 | contents->setParent(this); | - | ||||||||||||
| 67 | writeDownstreamData(contents); | - | ||||||||||||
| 68 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||
| 69 | - | |||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | return executed 9 times by 2 tests: true;return true;Executed by:
executed 9 times by 2 tests: return true;Executed by:
| 9 | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | void QNetworkAccessCacheBackend::closeDownstreamChannel() | - | ||||||||||||
| 77 | { | - | ||||||||||||
| 78 | } | - | ||||||||||||
| 79 | - | |||||||||||||
| 80 | void QNetworkAccessCacheBackend::closeUpstreamChannel() | - | ||||||||||||
| 81 | { | - | ||||||||||||
| 82 | ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,129) : qt_noop()); | - | ||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||
| 84 | - | |||||||||||||
| 85 | void QNetworkAccessCacheBackend::upstreamReadyRead() | - | ||||||||||||
| 86 | { | - | ||||||||||||
| 87 | ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,134) : qt_noop()); | - | ||||||||||||
| 88 | } never executed: end of block | 0 | ||||||||||||
| 89 | - | |||||||||||||
| 90 | void QNetworkAccessCacheBackend::downstreamReadyWrite() | - | ||||||||||||
| 91 | { | - | ||||||||||||
| 92 | ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,139) : qt_noop()); | - | ||||||||||||
| 93 | } never executed: end of block | 0 | ||||||||||||
| 94 | - | |||||||||||||
| 95 | - | |||||||||||||
| Switch to Source code | Preprocessed file |