| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkaccessmanager.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | namespace { namespace Q_QGS_fileBackend { typedef QNetworkAccessFileBackendFactory Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 10 times by 10 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 10 times by 10 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 91 times by 10 tests: &holder.value;return &holder.value;Executed by:
executed 91 times by 10 tests: } } } static QGlobalStatic<QNetworkAccessFileBackendFactory, Q_QGS_fileBackend::innerFunction, Q_QGS_fileBackend::guard> fileBackend;return &holder.value;Executed by:
| 0-91 | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | namespace { namespace Q_QGS_ftpBackend { typedef QNetworkAccessFtpBackendFactory Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 10 times by 10 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 10 times by 10 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 91 times by 10 tests: &holder.value;return &holder.value;Executed by:
executed 91 times by 10 tests: } } } static QGlobalStatic<QNetworkAccessFtpBackendFactory, Q_QGS_ftpBackend::innerFunction, Q_QGS_ftpBackend::guard> ftpBackend;return &holder.value;Executed by:
| 0-91 | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | namespace { namespace Q_QGS_debugpipeBackend { typedef QNetworkAccessDebugPipeBackendFactory Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 10 times by 10 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 10 times by 10 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 91 times by 10 tests: &holder.value;return &holder.value;Executed by:
executed 91 times by 10 tests: } } } static QGlobalStatic<QNetworkAccessDebugPipeBackendFactory, Q_QGS_debugpipeBackend::innerFunction, Q_QGS_debugpipeBackend::guard> debugpipeBackend;return &holder.value;Executed by:
| 0-91 | ||||||||||||||||||
| 19 | static void ensureInitialized() | - | ||||||||||||||||||
| 20 | { | - | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | (void) ftpBackend(); | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | - | |||||||||||||||||||
| 26 | (void) debugpipeBackend(); | - | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | (void) fileBackend(); | - | ||||||||||||||||||
| 31 | } executed 91 times by 10 tests: end of blockExecuted by:
| 91 | ||||||||||||||||||
| 32 | QNetworkAccessManager::QNetworkAccessManager(QObject *parent) | - | ||||||||||||||||||
| 33 | : QObject(*new QNetworkAccessManagerPrivate, parent) | - | ||||||||||||||||||
| 34 | { | - | ||||||||||||||||||
| 35 | ensureInitialized(); | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | qRegisterMetaType<QNetworkReply::NetworkError>(); | - | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | qRegisterMetaType<QNetworkProxy>(); | - | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | qRegisterMetaType<QList<QSslError> >(); | - | ||||||||||||||||||
| 43 | qRegisterMetaType<QSslConfiguration>(); | - | ||||||||||||||||||
| 44 | qRegisterMetaType<QSslPreSharedKeyAuthenticator *>(); | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >(); | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | qRegisterMetaType<QHttpNetworkRequest>(); | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | qRegisterMetaType<QNetworkReply::NetworkError>(); | - | ||||||||||||||||||
| 51 | qRegisterMetaType<QSharedPointer<char> >(); | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | connect(&d->networkConfigurationManager, qFlagLocation("2""onlineStateChanged(bool)" "\0" __FILE__ ":" "477"), | - | ||||||||||||||||||
| 60 | qFlagLocation("1""_q_onlineStateChanged(bool)" "\0" __FILE__ ":" "478")); | - | ||||||||||||||||||
| 61 | connect(&d->networkConfigurationManager, qFlagLocation("2""configurationChanged(const QNetworkConfiguration &)" "\0" __FILE__ ":" "479"), | - | ||||||||||||||||||
| 62 | qFlagLocation("1""_q_configurationChanged(const QNetworkConfiguration &)" "\0" __FILE__ ":" "480")); | - | ||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | } executed 91 times by 10 tests: end of blockExecuted by:
| 91 | ||||||||||||||||||
| 66 | QNetworkAccessManager::~QNetworkAccessManager() | - | ||||||||||||||||||
| 67 | { | - | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | delete d_func()->proxyFactory; | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | qDeleteAll(findChildren<QNetworkReply *>()); | - | ||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 | } executed 92 times by 11 tests: end of blockExecuted by:
| 92 | ||||||||||||||||||
| 81 | QNetworkProxy QNetworkAccessManager::proxy() const | - | ||||||||||||||||||
| 82 | { | - | ||||||||||||||||||
| 83 | return never executed: d_func()->proxy;return d_func()->proxy;never executed: return d_func()->proxy; | 0 | ||||||||||||||||||
| 84 | } | - | ||||||||||||||||||
| 85 | void QNetworkAccessManager::setProxy(const QNetworkProxy &proxy) | - | ||||||||||||||||||
| 86 | { | - | ||||||||||||||||||
| 87 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 88 | delete d->proxyFactory; | - | ||||||||||||||||||
| 89 | d->proxy = proxy; | - | ||||||||||||||||||
| 90 | d->proxyFactory = 0; | - | ||||||||||||||||||
| 91 | } executed 788 times by 2 tests: end of blockExecuted by:
| 788 | ||||||||||||||||||
| 92 | QNetworkProxyFactory *QNetworkAccessManager::proxyFactory() const | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | return never executed: d_func()->proxyFactory;return d_func()->proxyFactory;never executed: return d_func()->proxyFactory; | 0 | ||||||||||||||||||
| 95 | } | - | ||||||||||||||||||
| 96 | void QNetworkAccessManager::setProxyFactory(QNetworkProxyFactory *factory) | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 99 | delete d->proxyFactory; | - | ||||||||||||||||||
| 100 | d->proxyFactory = factory; | - | ||||||||||||||||||
| 101 | d->proxy = QNetworkProxy(); | - | ||||||||||||||||||
| 102 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||
| 103 | QAbstractNetworkCache *QNetworkAccessManager::cache() const | - | ||||||||||||||||||
| 104 | { | - | ||||||||||||||||||
| 105 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 106 | return never executed: d->networkCache;return d->networkCache;never executed: return d->networkCache; | 0 | ||||||||||||||||||
| 107 | } | - | ||||||||||||||||||
| 108 | void QNetworkAccessManager::setCache(QAbstractNetworkCache *cache) | - | ||||||||||||||||||
| 109 | { | - | ||||||||||||||||||
| 110 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 111 | if (d->networkCache != cache
| 94-614 | ||||||||||||||||||
| 112 | delete d->networkCache; | - | ||||||||||||||||||
| 113 | d->networkCache = cache; | - | ||||||||||||||||||
| 114 | if (d->networkCache
| 25-69 | ||||||||||||||||||
| 115 | d->networkCache->setParent(this); executed 69 times by 3 tests: d->networkCache->setParent(this);Executed by:
| 69 | ||||||||||||||||||
| 116 | } executed 94 times by 3 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||
| 117 | } executed 708 times by 3 tests: end of blockExecuted by:
| 708 | ||||||||||||||||||
| 118 | QNetworkCookieJar *QNetworkAccessManager::cookieJar() const | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 121 | if (!d->cookieJar
| 0-13 | ||||||||||||||||||
| 122 | d->createCookieJar(); never executed: d->createCookieJar(); | 0 | ||||||||||||||||||
| 123 | return executed 13 times by 1 test: d->cookieJar;return d->cookieJar;Executed by:
executed 13 times by 1 test: return d->cookieJar;Executed by:
| 13 | ||||||||||||||||||
| 124 | } | - | ||||||||||||||||||
| 125 | void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar) | - | ||||||||||||||||||
| 126 | { | - | ||||||||||||||||||
| 127 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 128 | d->cookieJarCreated = true; | - | ||||||||||||||||||
| 129 | if (d->cookieJar != cookieJar
| 0 | ||||||||||||||||||
| 130 | if (d->cookieJar
| 0 | ||||||||||||||||||
| 131 | delete d->cookieJar; never executed: delete d->cookieJar; | 0 | ||||||||||||||||||
| 132 | d->cookieJar = cookieJar; | - | ||||||||||||||||||
| 133 | if (thread() == cookieJar->thread()
| 0 | ||||||||||||||||||
| 134 | d->cookieJar->setParent(this); never executed: d->cookieJar->setParent(this); | 0 | ||||||||||||||||||
| 135 | } never executed: end of block | 0 | ||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | QNetworkReply *QNetworkAccessManager::head(const QNetworkRequest &request) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | return executed 27 times by 1 test: d_func()->postProcess(createRequest(QNetworkAccessManager::HeadOperation, request));return d_func()->postProcess(createRequest(QNetworkAccessManager::HeadOperation, request));Executed by:
executed 27 times by 1 test: return d_func()->postProcess(createRequest(QNetworkAccessManager::HeadOperation, request));Executed by:
| 27 | ||||||||||||||||||
| 147 | } | - | ||||||||||||||||||
| 148 | QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request) | - | ||||||||||||||||||
| 149 | { | - | ||||||||||||||||||
| 150 | return executed 776 times by 9 tests: d_func()->postProcess(createRequest(QNetworkAccessManager::GetOperation, request));return d_func()->postProcess(createRequest(QNetworkAccessManager::GetOperation, request));Executed by:
executed 776 times by 9 tests: return d_func()->postProcess(createRequest(QNetworkAccessManager::GetOperation, request));Executed by:
| 776 | ||||||||||||||||||
| 151 | } | - | ||||||||||||||||||
| 152 | QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, QIODevice *data) | - | ||||||||||||||||||
| 153 | { | - | ||||||||||||||||||
| 154 | return executed 157 times by 3 tests: d_func()->postProcess(createRequest(QNetworkAccessManager::PostOperation, request, data));return d_func()->postProcess(createRequest(QNetworkAccessManager::PostOperation, request, data));Executed by:
executed 157 times by 3 tests: return d_func()->postProcess(createRequest(QNetworkAccessManager::PostOperation, request, data));Executed by:
| 157 | ||||||||||||||||||
| 155 | } | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | - | |||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const QByteArray &data) | - | ||||||||||||||||||
| 164 | { | - | ||||||||||||||||||
| 165 | QBuffer *buffer = new QBuffer; | - | ||||||||||||||||||
| 166 | buffer->setData(data); | - | ||||||||||||||||||
| 167 | buffer->open(QIODevice::ReadOnly); | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | QNetworkReply *reply = post(request, buffer); | - | ||||||||||||||||||
| 170 | buffer->setParent(reply); | - | ||||||||||||||||||
| 171 | return executed 54 times by 3 tests: reply;return reply;Executed by:
executed 54 times by 3 tests: return reply;Executed by:
| 54 | ||||||||||||||||||
| 172 | } | - | ||||||||||||||||||
| 173 | QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, QHttpMultiPart *multiPart) | - | ||||||||||||||||||
| 174 | { | - | ||||||||||||||||||
| 175 | QNetworkRequest newRequest = d_func()->prepareMultipart(request, multiPart); | - | ||||||||||||||||||
| 176 | QIODevice *device = multiPart->d_func()->device; | - | ||||||||||||||||||
| 177 | QNetworkReply *reply = post(newRequest, device); | - | ||||||||||||||||||
| 178 | return executed 24 times by 2 tests: reply;return reply;Executed by:
executed 24 times by 2 tests: return reply;Executed by:
| 24 | ||||||||||||||||||
| 179 | } | - | ||||||||||||||||||
| 180 | QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QHttpMultiPart *multiPart) | - | ||||||||||||||||||
| 181 | { | - | ||||||||||||||||||
| 182 | QNetworkRequest newRequest = d_func()->prepareMultipart(request, multiPart); | - | ||||||||||||||||||
| 183 | QIODevice *device = multiPart->d_func()->device; | - | ||||||||||||||||||
| 184 | QNetworkReply *reply = put(newRequest, device); | - | ||||||||||||||||||
| 185 | return never executed: reply;return reply;never executed: return reply; | 0 | ||||||||||||||||||
| 186 | } | - | ||||||||||||||||||
| 187 | QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QIODevice *data) | - | ||||||||||||||||||
| 188 | { | - | ||||||||||||||||||
| 189 | return executed 95 times by 2 tests: d_func()->postProcess(createRequest(QNetworkAccessManager::PutOperation, request, data));return d_func()->postProcess(createRequest(QNetworkAccessManager::PutOperation, request, data));Executed by:
executed 95 times by 2 tests: return d_func()->postProcess(createRequest(QNetworkAccessManager::PutOperation, request, data));Executed by:
| 95 | ||||||||||||||||||
| 190 | } | - | ||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, const QByteArray &data) | - | ||||||||||||||||||
| 199 | { | - | ||||||||||||||||||
| 200 | QBuffer *buffer = new QBuffer; | - | ||||||||||||||||||
| 201 | buffer->setData(data); | - | ||||||||||||||||||
| 202 | buffer->open(QIODevice::ReadOnly); | - | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | QNetworkReply *reply = put(request, buffer); | - | ||||||||||||||||||
| 205 | buffer->setParent(reply); | - | ||||||||||||||||||
| 206 | return executed 55 times by 2 tests: reply;return reply;Executed by:
executed 55 times by 2 tests: return reply;Executed by:
| 55 | ||||||||||||||||||
| 207 | } | - | ||||||||||||||||||
| 208 | QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &request) | - | ||||||||||||||||||
| 209 | { | - | ||||||||||||||||||
| 210 | return executed 7 times by 1 test: d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));Executed by:
executed 7 times by 1 test: return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));Executed by:
| 7 | ||||||||||||||||||
| 211 | } | - | ||||||||||||||||||
| 212 | void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) | - | ||||||||||||||||||
| 213 | { | - | ||||||||||||||||||
| 214 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 215 | d->networkConfiguration = config; | - | ||||||||||||||||||
| 216 | d->customNetworkConfiguration = true; | - | ||||||||||||||||||
| 217 | d->createSession(config); | - | ||||||||||||||||||
| 218 | } executed 26 times by 3 tests: end of blockExecuted by:
| 26 | ||||||||||||||||||
| 219 | QNetworkConfiguration QNetworkAccessManager::configuration() const | - | ||||||||||||||||||
| 220 | { | - | ||||||||||||||||||
| 221 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | QSharedPointer<QNetworkSession> session(d->getNetworkSession()); | - | ||||||||||||||||||
| 224 | if (session
| 0 | ||||||||||||||||||
| 225 | return never executed: session->configuration();return session->configuration();never executed: return session->configuration(); | 0 | ||||||||||||||||||
| 226 | } else { | - | ||||||||||||||||||
| 227 | QNetworkConfigurationManager manager; | - | ||||||||||||||||||
| 228 | return never executed: manager.defaultConfiguration();return manager.defaultConfiguration();never executed: return manager.defaultConfiguration(); | 0 | ||||||||||||||||||
| 229 | } | - | ||||||||||||||||||
| 230 | } | - | ||||||||||||||||||
| 231 | QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession()); | - | ||||||||||||||||||
| 236 | QNetworkConfigurationManager manager; | - | ||||||||||||||||||
| 237 | if (networkSession
| 0 | ||||||||||||||||||
| 238 | return never executed: manager.configurationFromIdentifier(return manager.configurationFromIdentifier( networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString());never executed: return manager.configurationFromIdentifier( networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); | 0 | ||||||||||||||||||
| 239 | networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); never executed: return manager.configurationFromIdentifier( networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); | 0 | ||||||||||||||||||
| 240 | } else { | - | ||||||||||||||||||
| 241 | return never executed: manager.defaultConfiguration();return manager.defaultConfiguration();never executed: return manager.defaultConfiguration(); | 0 | ||||||||||||||||||
| 242 | } | - | ||||||||||||||||||
| 243 | } | - | ||||||||||||||||||
| 244 | void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkAccessibility accessible) | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | d->defaultAccessControl = accessible == NotAccessible
| 1-2 | ||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | if (d->networkAccessible != accessible
| 0-3 | ||||||||||||||||||
| 251 | NetworkAccessibility previous = networkAccessible(); | - | ||||||||||||||||||
| 252 | d->networkAccessible = accessible; | - | ||||||||||||||||||
| 253 | NetworkAccessibility current = networkAccessible(); | - | ||||||||||||||||||
| 254 | if (previous != current
| 0-3 | ||||||||||||||||||
| 255 | networkAccessibleChanged(current); executed 3 times by 1 test: networkAccessibleChanged(current);Executed by:
| 3 | ||||||||||||||||||
| 256 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 257 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | - | |||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const | - | ||||||||||||||||||
| 265 | { | - | ||||||||||||||||||
| 266 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | if (d->networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined)
| 0-12 | ||||||||||||||||||
| 269 | return never executed: UnknownAccessibility;return UnknownAccessibility;never executed: return UnknownAccessibility; | 0 | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | if (d->networkSessionRequired
| 0-12 | ||||||||||||||||||
| 272 | QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession()); | - | ||||||||||||||||||
| 273 | if (networkSession
| 0 | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | if (d->online
| 0 | ||||||||||||||||||
| 276 | return never executed: d->networkAccessible;return d->networkAccessible;never executed: return d->networkAccessible; | 0 | ||||||||||||||||||
| 277 | else | - | ||||||||||||||||||
| 278 | return never executed: NotAccessible;return NotAccessible;never executed: return NotAccessible; | 0 | ||||||||||||||||||
| 279 | } else { | - | ||||||||||||||||||
| 280 | if (d->defaultAccessControl
| 0 | ||||||||||||||||||
| 281 | if (d->online
| 0 | ||||||||||||||||||
| 282 | return never executed: d->networkAccessible;return d->networkAccessible;never executed: return d->networkAccessible; | 0 | ||||||||||||||||||
| 283 | else | - | ||||||||||||||||||
| 284 | return never executed: NotAccessible;return NotAccessible;never executed: return NotAccessible; | 0 | ||||||||||||||||||
| 285 | } | - | ||||||||||||||||||
| 286 | return never executed: (d->networkAccessible);return (d->networkAccessible);never executed: return (d->networkAccessible); | 0 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | } else { | - | ||||||||||||||||||
| 289 | if (d->online
| 0-12 | ||||||||||||||||||
| 290 | return executed 12 times by 1 test: d->networkAccessible;return d->networkAccessible;Executed by:
executed 12 times by 1 test: return d->networkAccessible;Executed by:
| 12 | ||||||||||||||||||
| 291 | else | - | ||||||||||||||||||
| 292 | return never executed: NotAccessible;return NotAccessible;never executed: return NotAccessible; | 0 | ||||||||||||||||||
| 293 | } | - | ||||||||||||||||||
| 294 | } | - | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | - | |||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | const QWeakPointer<const QNetworkSession> QNetworkAccessManagerPrivate::getNetworkSession(const QNetworkAccessManager *q) | - | ||||||||||||||||||
| 303 | { | - | ||||||||||||||||||
| 304 | return executed 30 times by 1 test: q->d_func()->networkSessionWeakRef;return q->d_func()->networkSessionWeakRef;Executed by:
executed 30 times by 1 test: return q->d_func()->networkSessionWeakRef;Executed by:
| 30 | ||||||||||||||||||
| 305 | } | - | ||||||||||||||||||
| 306 | - | |||||||||||||||||||
| 307 | QSharedPointer<QNetworkSession> QNetworkAccessManagerPrivate::getNetworkSession() const | - | ||||||||||||||||||
| 308 | { | - | ||||||||||||||||||
| 309 | if (networkSessionStrongRef
| 28-4125 | ||||||||||||||||||
| 310 | return executed 4125 times by 8 tests: networkSessionStrongRef;return networkSessionStrongRef;Executed by:
executed 4125 times by 8 tests: return networkSessionStrongRef;Executed by:
| 4125 | ||||||||||||||||||
| 311 | return executed 28 times by 2 tests: networkSessionWeakRef.toStrongRef();return networkSessionWeakRef.toStrongRef();Executed by:
executed 28 times by 2 tests: return networkSessionWeakRef.toStrongRef();Executed by:
| 28 | ||||||||||||||||||
| 312 | } | - | ||||||||||||||||||
| 313 | void QNetworkAccessManager::connectToHostEncrypted(const QString &hostName, quint16 port, | - | ||||||||||||||||||
| 314 | const QSslConfiguration &sslConfiguration) | - | ||||||||||||||||||
| 315 | { | - | ||||||||||||||||||
| 316 | QUrl url; | - | ||||||||||||||||||
| 317 | url.setHost(hostName); | - | ||||||||||||||||||
| 318 | url.setPort(port); | - | ||||||||||||||||||
| 319 | url.setScheme(QLatin1String("preconnect-https")); | - | ||||||||||||||||||
| 320 | QNetworkRequest request(url); | - | ||||||||||||||||||
| 321 | if (sslConfiguration != QSslConfiguration::defaultConfiguration()
| 0 | ||||||||||||||||||
| 322 | request.setSslConfiguration(sslConfiguration); never executed: request.setSslConfiguration(sslConfiguration); | 0 | ||||||||||||||||||
| 323 | - | |||||||||||||||||||
| 324 | - | |||||||||||||||||||
| 325 | - | |||||||||||||||||||
| 326 | if (sslConfiguration.allowedNextProtocols().contains(
| 0 | ||||||||||||||||||
| 327 | QSslConfiguration::NextProtocolSpdy3_0)
| 0 | ||||||||||||||||||
| 328 | request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true); never executed: request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true); | 0 | ||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | get(request); | - | ||||||||||||||||||
| 331 | } never executed: end of block | 0 | ||||||||||||||||||
| 332 | void QNetworkAccessManager::connectToHost(const QString &hostName, quint16 port) | - | ||||||||||||||||||
| 333 | { | - | ||||||||||||||||||
| 334 | QUrl url; | - | ||||||||||||||||||
| 335 | url.setHost(hostName); | - | ||||||||||||||||||
| 336 | url.setPort(port); | - | ||||||||||||||||||
| 337 | url.setScheme(QLatin1String("preconnect-http")); | - | ||||||||||||||||||
| 338 | QNetworkRequest request(url); | - | ||||||||||||||||||
| 339 | get(request); | - | ||||||||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||||||||
| 341 | QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data) | - | ||||||||||||||||||
| 342 | { | - | ||||||||||||||||||
| 343 | QNetworkRequest newRequest(request); | - | ||||||||||||||||||
| 344 | newRequest.setAttribute(QNetworkRequest::CustomVerbAttribute, verb); | - | ||||||||||||||||||
| 345 | return executed 7 times by 1 test: d_func()->postProcess(createRequest(QNetworkAccessManager::CustomOperation, newRequest, data));return d_func()->postProcess(createRequest(QNetworkAccessManager::CustomOperation, newRequest, data));Executed by:
executed 7 times by 1 test: return d_func()->postProcess(createRequest(QNetworkAccessManager::CustomOperation, newRequest, data));Executed by:
| 7 | ||||||||||||||||||
| 346 | } | - | ||||||||||||||||||
| 347 | QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, | - | ||||||||||||||||||
| 348 | const QNetworkRequest &req, | - | ||||||||||||||||||
| 349 | QIODevice *outgoingData) | - | ||||||||||||||||||
| 350 | { | - | ||||||||||||||||||
| 351 | QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | bool isLocalFile = req.url().isLocalFile(); | - | ||||||||||||||||||
| 354 | QString scheme = req.url().scheme(); | - | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | if (op == QNetworkAccessManager::GetOperation
| 293-776 | ||||||||||||||||||
| 359 | || op == QNetworkAccessManager::HeadOperation
| 27-266 | ||||||||||||||||||
| 360 | if (isLocalFile
| 28-775 | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | - | |||||||||||||||||||
| 364 | || scheme == QLatin1String("qrc")
| 2-773 | ||||||||||||||||||
| 365 | return executed 30 times by 2 tests: new QNetworkReplyFileImpl(this, req, op);return new QNetworkReplyFileImpl(this, req, op);Executed by:
executed 30 times by 2 tests: return new QNetworkReplyFileImpl(this, req, op);Executed by:
| 30 | ||||||||||||||||||
| 366 | } | - | ||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | if (scheme == QLatin1String("data")
| 30-743 | ||||||||||||||||||
| 369 | return executed 30 times by 1 test: new QNetworkReplyDataImpl(this, req, op);return new QNetworkReplyDataImpl(this, req, op);Executed by:
executed 30 times by 1 test: return new QNetworkReplyDataImpl(this, req, op);Executed by:
| 30 | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | QNetworkRequest::CacheLoadControl mode = | - | ||||||||||||||||||
| 373 | static_cast<QNetworkRequest::CacheLoadControl>( | - | ||||||||||||||||||
| 374 | req.attribute(QNetworkRequest::CacheLoadControlAttribute, | - | ||||||||||||||||||
| 375 | QNetworkRequest::PreferNetwork).toInt()); | - | ||||||||||||||||||
| 376 | if (mode == QNetworkRequest::AlwaysCache
| 14-729 | ||||||||||||||||||
| 377 | - | |||||||||||||||||||
| 378 | QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); | - | ||||||||||||||||||
| 379 | QNetworkReplyImplPrivate *priv = reply->d_func(); | - | ||||||||||||||||||
| 380 | priv->manager = this; | - | ||||||||||||||||||
| 381 | priv->backend = new QNetworkAccessCacheBackend(); | - | ||||||||||||||||||
| 382 | priv->backend->manager = this->d_func(); | - | ||||||||||||||||||
| 383 | priv->backend->setParent(reply); | - | ||||||||||||||||||
| 384 | priv->backend->reply = priv; | - | ||||||||||||||||||
| 385 | priv->setup(op, req, outgoingData); | - | ||||||||||||||||||
| 386 | return executed 14 times by 3 tests: reply;return reply;Executed by:
executed 14 times by 3 tests: return reply;Executed by:
| 14 | ||||||||||||||||||
| 387 | } | - | ||||||||||||||||||
| 388 | } executed 729 times by 7 tests: end of blockExecuted by:
| 729 | ||||||||||||||||||
| 389 | - | |||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| 393 | if (d->networkAccessible == NotAccessible
| 0-995 | ||||||||||||||||||
| 394 | return never executed: new QDisabledNetworkReply(this, req, op);return new QDisabledNetworkReply(this, req, op);never executed: return new QDisabledNetworkReply(this, req, op); | 0 | ||||||||||||||||||
| 395 | } | - | ||||||||||||||||||
| 396 | - | |||||||||||||||||||
| 397 | if (!d->networkSessionStrongRef
| 0-799 | ||||||||||||||||||
| 398 | QNetworkConfigurationManager manager; | - | ||||||||||||||||||
| 399 | if (!d->networkConfiguration.identifier().isEmpty()
| 0-196 | ||||||||||||||||||
| 400 | if ((d->networkConfiguration.state() & QNetworkConfiguration::Defined) | - | ||||||||||||||||||
| 401 | && d->networkConfiguration != manager.defaultConfiguration()
| 0-196 | ||||||||||||||||||
| 402 | d->createSession(manager.defaultConfiguration()); never executed: d->createSession(manager.defaultConfiguration()); | 0 | ||||||||||||||||||
| 403 | else | - | ||||||||||||||||||
| 404 | d->createSession(d->networkConfiguration); executed 196 times by 7 tests: d->createSession(d->networkConfiguration);Executed by:
| 196 | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | } else { | - | ||||||||||||||||||
| 407 | if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired
| 0 | ||||||||||||||||||
| 408 | d->createSession(manager.defaultConfiguration()); never executed: d->createSession(manager.defaultConfiguration()); | 0 | ||||||||||||||||||
| 409 | else | - | ||||||||||||||||||
| 410 | d->initializeSession = false; never executed: d->initializeSession = false; | 0 | ||||||||||||||||||
| 411 | } | - | ||||||||||||||||||
| 412 | } | - | ||||||||||||||||||
| 413 | - | |||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | QNetworkRequest request = req; | - | ||||||||||||||||||
| 416 | if (!request.header(QNetworkRequest::ContentLengthHeader).isValid()
| 3-992 | ||||||||||||||||||
| 417 | outgoingData
| 93-740 | ||||||||||||||||||
| 418 | - | |||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | request.setHeader(QNetworkRequest::ContentLengthHeader, outgoingData->size()); | - | ||||||||||||||||||
| 421 | } executed 159 times by 2 tests: end of blockExecuted by:
| 159 | ||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | if (static_cast<
| 0-995 | ||||||||||||||||||
| 424 | (request.attribute(QNetworkRequest::CookieLoadControlAttribute,
| 0-995 | ||||||||||||||||||
| 425 | QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic
| 0-995 | ||||||||||||||||||
| 426 | if (d->cookieJar
| 345-650 | ||||||||||||||||||
| 427 | QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url()); | - | ||||||||||||||||||
| 428 | if (!cookies.isEmpty()
| 8-642 | ||||||||||||||||||
| 429 | request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies)); executed 8 times by 1 test: request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies));Executed by:
| 8 | ||||||||||||||||||
| 430 | } executed 650 times by 1 test: end of blockExecuted by:
| 650 | ||||||||||||||||||
| 431 | } executed 995 times by 8 tests: end of blockExecuted by:
| 995 | ||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | - | |||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | if (scheme == QLatin1String("http")
| 0-655 | ||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | || scheme == QLatin1String("https")
| 0-232 | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | ) { | - | ||||||||||||||||||
| 440 | QNetworkReplyHttpImpl *reply = new QNetworkReplyHttpImpl(this, request, op, outgoingData); | - | ||||||||||||||||||
| 441 | - | |||||||||||||||||||
| 442 | connect(this, qFlagLocation("2""networkSessionConnected()" "\0" __FILE__ ":" "1215"), | - | ||||||||||||||||||
| 443 | reply, qFlagLocation("1""_q_networkSessionConnected()" "\0" __FILE__ ":" "1216")); | - | ||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | return executed 887 times by 8 tests: reply;return reply;Executed by:
executed 887 times by 8 tests: return reply;Executed by:
| 887 | ||||||||||||||||||
| 446 | } | - | ||||||||||||||||||
| 447 | - | |||||||||||||||||||
| 448 | - | |||||||||||||||||||
| 449 | - | |||||||||||||||||||
| 450 | QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); | - | ||||||||||||||||||
| 451 | - | |||||||||||||||||||
| 452 | if (!isLocalFile
| 39-69 | ||||||||||||||||||
| 453 | connect(this, qFlagLocation("2""networkSessionConnected()" "\0" __FILE__ ":" "1226"), | - | ||||||||||||||||||
| 454 | reply, qFlagLocation("1""_q_networkSessionConnected()" "\0" __FILE__ ":" "1227")); | - | ||||||||||||||||||
| 455 | } executed 69 times by 1 test: end of blockExecuted by:
| 69 | ||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | QNetworkReplyImplPrivate *priv = reply->d_func(); | - | ||||||||||||||||||
| 458 | priv->manager = this; | - | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | - | |||||||||||||||||||
| 461 | - | |||||||||||||||||||
| 462 | - | |||||||||||||||||||
| 463 | - | |||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | priv->backend = d->findBackend(op, request); | - | ||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | if (priv->backend
| 4-104 | ||||||||||||||||||
| 468 | priv->backend->setParent(reply); | - | ||||||||||||||||||
| 469 | priv->backend->reply = priv; | - | ||||||||||||||||||
| 470 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||
| 471 | - | |||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | reply->setSslConfiguration(request.sslConfiguration()); | - | ||||||||||||||||||
| 474 | - | |||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | priv->setup(op, request, outgoingData); | - | ||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | return executed 108 times by 1 test: reply;return reply;Executed by:
executed 108 times by 1 test: return reply;Executed by:
| 108 | ||||||||||||||||||
| 480 | } | - | ||||||||||||||||||
| 481 | QStringList QNetworkAccessManager::supportedSchemes() const | - | ||||||||||||||||||
| 482 | { | - | ||||||||||||||||||
| 483 | QStringList schemes; | - | ||||||||||||||||||
| 484 | QNetworkAccessManager *self = const_cast<QNetworkAccessManager *>(this); | - | ||||||||||||||||||
| 485 | QMetaObject::invokeMethod(self, "supportedSchemesImplementation", Qt::DirectConnection, | - | ||||||||||||||||||
| 486 | QReturnArgument<QStringList >("QStringList", schemes)); | - | ||||||||||||||||||
| 487 | schemes.removeDuplicates(); | - | ||||||||||||||||||
| 488 | return never executed: schemes;return schemes;never executed: return schemes; | 0 | ||||||||||||||||||
| 489 | } | - | ||||||||||||||||||
| 490 | QStringList QNetworkAccessManager::supportedSchemesImplementation() const | - | ||||||||||||||||||
| 491 | { | - | ||||||||||||||||||
| 492 | const QNetworkAccessManagerPrivate * const d = d_func(); | - | ||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | QStringList schemes = d->backendSupportedSchemes(); | - | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | schemes << ([]() -> QString { enum { Size = sizeof(u"" "http")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "http" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | if (QSslSocket::supportsSsl()
| 0 | ||||||||||||||||||
| 500 | schemes << ([]() -> QString { enum { Size = sizeof(u"" "https")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "https" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }());return qstring_literal_temp;never executed: schemes << ([]() -> QString { enum { Size = sizeof(u"" "https")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "https" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | 0 | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | - | |||||||||||||||||||
| 503 | schemes << ([]() -> QString { enum { Size = sizeof(u"" "data")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "data" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
| 504 | return never executed: schemes;return schemes;never executed: return schemes; | 0 | ||||||||||||||||||
| 505 | } | - | ||||||||||||||||||
| 506 | void QNetworkAccessManager::clearAccessCache() | - | ||||||||||||||||||
| 507 | { | - | ||||||||||||||||||
| 508 | QNetworkAccessManagerPrivate::clearCache(this); | - | ||||||||||||||||||
| 509 | } executed 644 times by 2 tests: end of blockExecuted by:
| 644 | ||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | void QNetworkAccessManagerPrivate::_q_replyFinished() | - | ||||||||||||||||||
| 512 | { | - | ||||||||||||||||||
| 513 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 514 | - | |||||||||||||||||||
| 515 | QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender()); | - | ||||||||||||||||||
| 516 | if (reply
| 0-931 | ||||||||||||||||||
| 517 | q->finished(reply); executed 931 times by 9 tests: q->finished(reply);Executed by:
| 931 | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | - | |||||||||||||||||||
| 520 | - | |||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | activeReplyCount--; | - | ||||||||||||||||||
| 524 | if (networkSessionStrongRef
| 11-920 | ||||||||||||||||||
| 525 | networkSessionStrongRef.clear(); executed 195 times by 7 tests: networkSessionStrongRef.clear();Executed by:
| 195 | ||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | } executed 931 times by 9 tests: end of blockExecuted by:
| 931 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | void QNetworkAccessManagerPrivate::_q_replyEncrypted() | - | ||||||||||||||||||
| 530 | { | - | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 533 | QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender()); | - | ||||||||||||||||||
| 534 | if (reply
| 0-75 | ||||||||||||||||||
| 535 | q->encrypted(reply); executed 75 times by 2 tests: q->encrypted(reply);Executed by:
| 75 | ||||||||||||||||||
| 536 | - | |||||||||||||||||||
| 537 | } executed 75 times by 2 tests: end of blockExecuted by:
| 75 | ||||||||||||||||||
| 538 | - | |||||||||||||||||||
| 539 | void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList<QSslError> &errors) | - | ||||||||||||||||||
| 540 | { | - | ||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 543 | QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender()); | - | ||||||||||||||||||
| 544 | if (reply
| 0-48 | ||||||||||||||||||
| 545 | q->sslErrors(reply, errors); executed 48 times by 2 tests: q->sslErrors(reply, errors);Executed by:
| 48 | ||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | - | |||||||||||||||||||
| 548 | - | |||||||||||||||||||
| 549 | } executed 48 times by 2 tests: end of blockExecuted by:
| 48 | ||||||||||||||||||
| 550 | - | |||||||||||||||||||
| 551 | void QNetworkAccessManagerPrivate::_q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator) | - | ||||||||||||||||||
| 552 | { | - | ||||||||||||||||||
| 553 | - | |||||||||||||||||||
| 554 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 555 | QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender()); | - | ||||||||||||||||||
| 556 | if (reply
| 0 | ||||||||||||||||||
| 557 | q->preSharedKeyAuthenticationRequired(reply, authenticator); never executed: q->preSharedKeyAuthenticationRequired(reply, authenticator); | 0 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | - | |||||||||||||||||||
| 560 | - | |||||||||||||||||||
| 561 | } never executed: end of block | 0 | ||||||||||||||||||
| 562 | - | |||||||||||||||||||
| 563 | QNetworkReply *QNetworkAccessManagerPrivate::postProcess(QNetworkReply *reply) | - | ||||||||||||||||||
| 564 | { | - | ||||||||||||||||||
| 565 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 566 | QNetworkReplyPrivate::setManager(reply, q); | - | ||||||||||||||||||
| 567 | q->connect(reply, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1376"), qFlagLocation("1""_q_replyFinished()" "\0" __FILE__ ":" "1376")); | - | ||||||||||||||||||
| 568 | - | |||||||||||||||||||
| 569 | - | |||||||||||||||||||
| 570 | - | |||||||||||||||||||
| 571 | q->connect(reply, qFlagLocation("2""encrypted()" "\0" __FILE__ ":" "1380"), qFlagLocation("1""_q_replyEncrypted()" "\0" __FILE__ ":" "1380")); | - | ||||||||||||||||||
| 572 | q->connect(reply, qFlagLocation("2""sslErrors(QList<QSslError>)" "\0" __FILE__ ":" "1381"), qFlagLocation("1""_q_replySslErrors(QList<QSslError>)" "\0" __FILE__ ":" "1381")); | - | ||||||||||||||||||
| 573 | q->connect(reply, qFlagLocation("2""preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "1382"), qFlagLocation("1""_q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "1382")); | - | ||||||||||||||||||
| 574 | - | |||||||||||||||||||
| 575 | - | |||||||||||||||||||
| 576 | activeReplyCount++; | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | - | |||||||||||||||||||
| 579 | return executed 1069 times by 10 tests: reply;return reply;Executed by:
executed 1069 times by 10 tests: return reply;Executed by:
| 1069 | ||||||||||||||||||
| 580 | } | - | ||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | void QNetworkAccessManagerPrivate::createCookieJar() const | - | ||||||||||||||||||
| 583 | { | - | ||||||||||||||||||
| 584 | if (!cookieJarCreated
| 0 | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | QNetworkAccessManagerPrivate *that = const_cast<QNetworkAccessManagerPrivate *>(this); | - | ||||||||||||||||||
| 587 | that->cookieJar = new QNetworkCookieJar(that->q_func()); | - | ||||||||||||||||||
| 588 | that->cookieJarCreated = true; | - | ||||||||||||||||||
| 589 | } never executed: end of block | 0 | ||||||||||||||||||
| 590 | } never executed: end of block | 0 | ||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authenticator, | - | ||||||||||||||||||
| 593 | QNetworkReply *reply, | - | ||||||||||||||||||
| 594 | bool synchronous, | - | ||||||||||||||||||
| 595 | QUrl &url, | - | ||||||||||||||||||
| 596 | QUrl *urlForLastAuthentication, | - | ||||||||||||||||||
| 597 | bool allowAuthenticationReuse) | - | ||||||||||||||||||
| 598 | { | - | ||||||||||||||||||
| 599 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | - | |||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | if (allowAuthenticationReuse
| 1-126 | ||||||||||||||||||
| 605 | || url != *urlForLastAuthentication
| 0-38 | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | if (!url.userName().isEmpty()
| 12-76 | ||||||||||||||||||
| 608 | && !url.password().isEmpty()
| 0-12 | ||||||||||||||||||
| 609 | authenticator->setUser(url.userName(QUrl::FullyDecoded)); | - | ||||||||||||||||||
| 610 | authenticator->setPassword(url.password(QUrl::FullyDecoded)); | - | ||||||||||||||||||
| 611 | *urlForLastAuthentication = url; | - | ||||||||||||||||||
| 612 | authenticationManager->cacheCredentials(url, authenticator); | - | ||||||||||||||||||
| 613 | return; executed 12 times by 1 test: return;Executed by:
| 12 | ||||||||||||||||||
| 614 | } | - | ||||||||||||||||||
| 615 | - | |||||||||||||||||||
| 616 | QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedCredentials(url, authenticator); | - | ||||||||||||||||||
| 617 | if (!cred.isNull()
| 20-56 | ||||||||||||||||||
| 618 | authenticator->setUser(cred.user); | - | ||||||||||||||||||
| 619 | authenticator->setPassword(cred.password); | - | ||||||||||||||||||
| 620 | *urlForLastAuthentication = url; | - | ||||||||||||||||||
| 621 | return; executed 20 times by 1 test: return;Executed by:
| 20 | ||||||||||||||||||
| 622 | } | - | ||||||||||||||||||
| 623 | } executed 56 times by 1 test: end of blockExecuted by:
| 56 | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | - | |||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | if (synchronous
| 0-95 | ||||||||||||||||||
| 628 | return; never executed: return; | 0 | ||||||||||||||||||
| 629 | - | |||||||||||||||||||
| 630 | *urlForLastAuthentication = url; | - | ||||||||||||||||||
| 631 | q->authenticationRequired(reply, authenticator); | - | ||||||||||||||||||
| 632 | if (allowAuthenticationReuse
| 1-94 | ||||||||||||||||||
| 633 | authenticationManager->cacheCredentials(url, authenticator); executed 94 times by 1 test: authenticationManager->cacheCredentials(url, authenticator);Executed by:
| 94 | ||||||||||||||||||
| 634 | } executed 95 times by 1 test: end of blockExecuted by:
| 95 | ||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(const QUrl &url, | - | ||||||||||||||||||
| 638 | const QNetworkProxy &proxy, | - | ||||||||||||||||||
| 639 | bool synchronous, | - | ||||||||||||||||||
| 640 | QAuthenticator *authenticator, | - | ||||||||||||||||||
| 641 | QNetworkProxy *lastProxyAuthentication) | - | ||||||||||||||||||
| 642 | { | - | ||||||||||||||||||
| 643 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 644 | QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*authenticator); | - | ||||||||||||||||||
| 645 | if (proxy != *lastProxyAuthentication
| 2-66 | ||||||||||||||||||
| 646 | QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedProxyCredentials(proxy); | - | ||||||||||||||||||
| 647 | if (!cred.isNull()
| 8-56 | ||||||||||||||||||
| 648 | authenticator->setUser(cred.user); | - | ||||||||||||||||||
| 649 | authenticator->setPassword(cred.password); | - | ||||||||||||||||||
| 650 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||
| 651 | } | - | ||||||||||||||||||
| 652 | } executed 56 times by 2 tests: end of blockExecuted by:
| 56 | ||||||||||||||||||
| 653 | (void)url;; | - | ||||||||||||||||||
| 654 | - | |||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | - | |||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | if (synchronous
| 0-60 | ||||||||||||||||||
| 659 | return; never executed: return; | 0 | ||||||||||||||||||
| 660 | - | |||||||||||||||||||
| 661 | *lastProxyAuthentication = proxy; | - | ||||||||||||||||||
| 662 | q->proxyAuthenticationRequired(proxy, authenticator); | - | ||||||||||||||||||
| 663 | authenticationManager->cacheProxyCredentials(proxy, authenticator); | - | ||||||||||||||||||
| 664 | } executed 60 times by 2 tests: end of blockExecuted by:
| 60 | ||||||||||||||||||
| 665 | - | |||||||||||||||||||
| 666 | QList<QNetworkProxy> QNetworkAccessManagerPrivate::queryProxy(const QNetworkProxyQuery &query) | - | ||||||||||||||||||
| 667 | { | - | ||||||||||||||||||
| 668 | QList<QNetworkProxy> proxies; | - | ||||||||||||||||||
| 669 | if (proxyFactory
| 20-986 | ||||||||||||||||||
| 670 | proxies = proxyFactory->queryProxy(query); | - | ||||||||||||||||||
| 671 | if (proxies.isEmpty()
| 0-20 | ||||||||||||||||||
| 672 | QMessageLogger(__FILE__, 1499, __PRETTY_FUNCTION__).warning("QNetworkAccessManager: factory %p has returned an empty result set", | - | ||||||||||||||||||
| 673 | proxyFactory); | - | ||||||||||||||||||
| 674 | proxies << QNetworkProxy::NoProxy; | - | ||||||||||||||||||
| 675 | } never executed: end of block | 0 | ||||||||||||||||||
| 676 | } executed 20 times by 1 test: else if (proxy.type() == QNetworkProxy::DefaultProxyend of blockExecuted by:
| 20-832 | ||||||||||||||||||
| 677 | - | |||||||||||||||||||
| 678 | return executed 832 times by 8 tests: QNetworkProxyFactory::proxyForQuery(query);return QNetworkProxyFactory::proxyForQuery(query);Executed by:
executed 832 times by 8 tests: return QNetworkProxyFactory::proxyForQuery(query);Executed by:
| 832 | ||||||||||||||||||
| 679 | } else { | - | ||||||||||||||||||
| 680 | proxies << proxy; | - | ||||||||||||||||||
| 681 | } executed 154 times by 2 tests: end of blockExecuted by:
| 154 | ||||||||||||||||||
| 682 | - | |||||||||||||||||||
| 683 | return executed 174 times by 2 tests: proxies;return proxies;Executed by:
executed 174 times by 2 tests: return proxies;Executed by:
| 174 | ||||||||||||||||||
| 684 | } | - | ||||||||||||||||||
| 685 | - | |||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager) | - | ||||||||||||||||||
| 688 | { | - | ||||||||||||||||||
| 689 | manager->d_func()->objectCache.clear(); | - | ||||||||||||||||||
| 690 | manager->d_func()->authenticationManager->clearCache(); | - | ||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | if (manager->d_func()->httpThread
| 252-394 | ||||||||||||||||||
| 693 | manager->d_func()->httpThread->quit(); | - | ||||||||||||||||||
| 694 | manager->d_func()->httpThread->wait(5000); | - | ||||||||||||||||||
| 695 | if (manager->d_func()->httpThread->isFinished()
| 0-394 | ||||||||||||||||||
| 696 | delete manager->d_func()->httpThread; executed 394 times by 2 tests: delete manager->d_func()->httpThread;Executed by:
| 394 | ||||||||||||||||||
| 697 | else | - | ||||||||||||||||||
| 698 | QObject::connect(manager->d_func()->httpThread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1525"), manager->d_func()->httpThread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "1525")); never executed: QObject::connect(manager->d_func()->httpThread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1525"), manager->d_func()->httpThread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "1525")); | 0 | ||||||||||||||||||
| 699 | manager->d_func()->httpThread = 0; | - | ||||||||||||||||||
| 700 | } executed 394 times by 2 tests: end of blockExecuted by:
| 394 | ||||||||||||||||||
| 701 | } executed 646 times by 2 tests: end of blockExecuted by:
| 646 | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() | - | ||||||||||||||||||
| 704 | { | - | ||||||||||||||||||
| 705 | if (httpThread
| 16-76 | ||||||||||||||||||
| 706 | httpThread->quit(); | - | ||||||||||||||||||
| 707 | httpThread->wait(5000); | - | ||||||||||||||||||
| 708 | if (httpThread->isFinished()
| 0-76 | ||||||||||||||||||
| 709 | delete httpThread; executed 76 times by 8 tests: delete httpThread;Executed by:
| 76 | ||||||||||||||||||
| 710 | else | - | ||||||||||||||||||
| 711 | QObject::connect(httpThread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1538"), httpThread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "1538")); never executed: QObject::connect(httpThread, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1538"), httpThread, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "1538")); | 0 | ||||||||||||||||||
| 712 | httpThread = 0; | - | ||||||||||||||||||
| 713 | } executed 76 times by 8 tests: end of blockExecuted by:
| 76 | ||||||||||||||||||
| 714 | } executed 92 times by 11 tests: end of blockExecuted by:
| 92 | ||||||||||||||||||
| 715 | - | |||||||||||||||||||
| 716 | - | |||||||||||||||||||
| 717 | void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) | - | ||||||||||||||||||
| 718 | { | - | ||||||||||||||||||
| 719 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | initializeSession = false; | - | ||||||||||||||||||
| 722 | - | |||||||||||||||||||
| 723 | - | |||||||||||||||||||
| 724 | networkSessionStrongRef = networkSessionWeakRef.toStrongRef(); | - | ||||||||||||||||||
| 725 | - | |||||||||||||||||||
| 726 | QSharedPointer<QNetworkSession> newSession; | - | ||||||||||||||||||
| 727 | if (config.isValid()
| 0-222 | ||||||||||||||||||
| 728 | newSession = QSharedNetworkSessionManager::getSession(config); executed 222 times by 9 tests: newSession = QSharedNetworkSessionManager::getSession(config);Executed by:
| 222 | ||||||||||||||||||
| 729 | - | |||||||||||||||||||
| 730 | if (networkSessionStrongRef
| 99-123 | ||||||||||||||||||
| 731 | - | |||||||||||||||||||
| 732 | if (networkSessionStrongRef == newSession
| 0-123 | ||||||||||||||||||
| 733 | return; executed 123 times by 3 tests: return;Executed by:
| 123 | ||||||||||||||||||
| 734 | - | |||||||||||||||||||
| 735 | QObject::disconnect(networkSessionStrongRef.data(), qFlagLocation("2""opened()" "\0" __FILE__ ":" "1562"), q, qFlagLocation("2""networkSessionConnected()" "\0" __FILE__ ":" "1562")); | - | ||||||||||||||||||
| 736 | QObject::disconnect(networkSessionStrongRef.data(), qFlagLocation("2""closed()" "\0" __FILE__ ":" "1563"), q, qFlagLocation("1""_q_networkSessionClosed()" "\0" __FILE__ ":" "1563")); | - | ||||||||||||||||||
| 737 | QObject::disconnect(networkSessionStrongRef.data(), qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1564"), | - | ||||||||||||||||||
| 738 | q, qFlagLocation("1""_q_networkSessionStateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1565")); | - | ||||||||||||||||||
| 739 | QObject::disconnect(networkSessionStrongRef.data(), qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1566"), | - | ||||||||||||||||||
| 740 | q, qFlagLocation("1""_q_networkSessionFailed(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1567")); | - | ||||||||||||||||||
| 741 | } never executed: end of block | 0 | ||||||||||||||||||
| 742 | - | |||||||||||||||||||
| 743 | - | |||||||||||||||||||
| 744 | networkSessionStrongRef = newSession; | - | ||||||||||||||||||
| 745 | networkSessionWeakRef = networkSessionStrongRef.toWeakRef(); | - | ||||||||||||||||||
| 746 | - | |||||||||||||||||||
| 747 | if (!networkSessionStrongRef
| 0-99 | ||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | if (networkAccessible == QNetworkAccessManager::NotAccessible
| 0 | ||||||||||||||||||
| 750 | q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); never executed: q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); | 0 | ||||||||||||||||||
| 751 | else | - | ||||||||||||||||||
| 752 | q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); never executed: q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); | 0 | ||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | return; never executed: return; | 0 | ||||||||||||||||||
| 755 | } | - | ||||||||||||||||||
| 756 | - | |||||||||||||||||||
| 757 | - | |||||||||||||||||||
| 758 | QObject::connect(networkSessionStrongRef.data(), qFlagLocation("2""opened()" "\0" __FILE__ ":" "1585"), q, qFlagLocation("2""networkSessionConnected()" "\0" __FILE__ ":" "1585"), Qt::QueuedConnection); | - | ||||||||||||||||||
| 759 | - | |||||||||||||||||||
| 760 | QObject::connect(networkSessionStrongRef.data(), qFlagLocation("2""closed()" "\0" __FILE__ ":" "1587"), q, qFlagLocation("1""_q_networkSessionClosed()" "\0" __FILE__ ":" "1587"), Qt::QueuedConnection); | - | ||||||||||||||||||
| 761 | QObject::connect(networkSessionStrongRef.data(), qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1588"), | - | ||||||||||||||||||
| 762 | q, qFlagLocation("1""_q_networkSessionStateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1589"), Qt::QueuedConnection); | - | ||||||||||||||||||
| 763 | QObject::connect(networkSessionStrongRef.data(), qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1590"), | - | ||||||||||||||||||
| 764 | q, qFlagLocation("1""_q_networkSessionFailed(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1591")); | - | ||||||||||||||||||
| 765 | - | |||||||||||||||||||
| 766 | _q_networkSessionStateChanged(networkSessionStrongRef->state()); | - | ||||||||||||||||||
| 767 | } executed 99 times by 9 tests: end of blockExecuted by:
| 99 | ||||||||||||||||||
| 768 | - | |||||||||||||||||||
| 769 | void QNetworkAccessManagerPrivate::_q_networkSessionClosed() | - | ||||||||||||||||||
| 770 | { | - | ||||||||||||||||||
| 771 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 772 | QSharedPointer<QNetworkSession> networkSession(getNetworkSession()); | - | ||||||||||||||||||
| 773 | if (networkSession
| 0-4 | ||||||||||||||||||
| 774 | networkConfiguration = networkSession->configuration(); | - | ||||||||||||||||||
| 775 | - | |||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | QObject::disconnect(networkSession.data(), qFlagLocation("2""opened()" "\0" __FILE__ ":" "1604"), q, qFlagLocation("2""networkSessionConnected()" "\0" __FILE__ ":" "1604")); | - | ||||||||||||||||||
| 778 | QObject::disconnect(networkSession.data(), qFlagLocation("2""closed()" "\0" __FILE__ ":" "1605"), q, qFlagLocation("1""_q_networkSessionClosed()" "\0" __FILE__ ":" "1605")); | - | ||||||||||||||||||
| 779 | QObject::disconnect(networkSession.data(), qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1606"), | - | ||||||||||||||||||
| 780 | q, qFlagLocation("1""_q_networkSessionStateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "1607")); | - | ||||||||||||||||||
| 781 | QObject::disconnect(networkSession.data(), qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1608"), | - | ||||||||||||||||||
| 782 | q, qFlagLocation("1""_q_networkSessionFailed(QNetworkSession::SessionError)" "\0" __FILE__ ":" "1609")); | - | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | networkSessionStrongRef.clear(); | - | ||||||||||||||||||
| 785 | networkSessionWeakRef.clear(); | - | ||||||||||||||||||
| 786 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 787 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state) | - | ||||||||||||||||||
| 790 | { | - | ||||||||||||||||||
| 791 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 792 | bool reallyOnline = false; | - | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | - | |||||||||||||||||||
| 795 | if (state == QNetworkSession::Connected
| 0-99 | ||||||||||||||||||
| 796 | q->networkSessionConnected(); executed 99 times by 9 tests: q->networkSessionConnected();Executed by:
| 99 | ||||||||||||||||||
| 797 | lastSessionState = state; | - | ||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | if (online
| 0-99 | ||||||||||||||||||
| 800 | const auto cfgs = networkConfigurationManager.allConfigurations(); | - | ||||||||||||||||||
| 801 | for (const QNetworkConfiguration &cfg : cfgs) { | - | ||||||||||||||||||
| 802 | if (cfg.state().testFlag(QNetworkConfiguration::Active)
| 0 | ||||||||||||||||||
| 803 | reallyOnline = true; | - | ||||||||||||||||||
| 804 | } never executed: end of block | 0 | ||||||||||||||||||
| 805 | } never executed: end of block | 0 | ||||||||||||||||||
| 806 | } never executed: else if (state == QNetworkSession::Connectedend of block
| 0-99 | ||||||||||||||||||
| 807 | reallyOnline = true; | - | ||||||||||||||||||
| 808 | } executed 99 times by 9 tests: end of blockExecuted by:
| 99 | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | if (!reallyOnline
| 0-99 | ||||||||||||||||||
| 811 | if (state != QNetworkSession::Connected
| 0 | ||||||||||||||||||
| 812 | if (networkAccessible != QNetworkAccessManager::NotAccessible
| 0 | ||||||||||||||||||
| 813 | networkAccessible = QNetworkAccessManager::NotAccessible; | - | ||||||||||||||||||
| 814 | q->networkAccessibleChanged(networkAccessible); | - | ||||||||||||||||||
| 815 | } never executed: end of block | 0 | ||||||||||||||||||
| 816 | } never executed: end of block | 0 | ||||||||||||||||||
| 817 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 818 | if (defaultAccessControl
| 0-99 | ||||||||||||||||||
| 819 | if (networkAccessible != QNetworkAccessManager::Accessible
| 0-99 | ||||||||||||||||||
| 820 | networkAccessible = QNetworkAccessManager::Accessible; | - | ||||||||||||||||||
| 821 | q->networkAccessibleChanged(networkAccessible); | - | ||||||||||||||||||
| 822 | } never executed: end of block | 0 | ||||||||||||||||||
| 823 | } executed 99 times by 9 tests: end of blockExecuted by:
| 99 | ||||||||||||||||||
| 824 | online = reallyOnline; | - | ||||||||||||||||||
| 825 | if (online
| 0-99 | ||||||||||||||||||
| 826 | _q_networkSessionClosed(); | - | ||||||||||||||||||
| 827 | createSession(q->configuration()); | - | ||||||||||||||||||
| 828 | } never executed: end of block | 0 | ||||||||||||||||||
| 829 | } executed 99 times by 9 tests: end of blockExecuted by:
| 99 | ||||||||||||||||||
| 830 | - | |||||||||||||||||||
| 831 | void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline) | - | ||||||||||||||||||
| 832 | { | - | ||||||||||||||||||
| 833 | QNetworkAccessManager * const q = q_func(); | - | ||||||||||||||||||
| 834 | - | |||||||||||||||||||
| 835 | - | |||||||||||||||||||
| 836 | - | |||||||||||||||||||
| 837 | if (customNetworkConfiguration
| 0 | ||||||||||||||||||
| 838 | online = (networkConfiguration.state() & QNetworkConfiguration::Active); | - | ||||||||||||||||||
| 839 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 840 | if (online != isOnline
| 0 | ||||||||||||||||||
| 841 | _q_networkSessionClosed(); | - | ||||||||||||||||||
| 842 | createSession(q->configuration()); | - | ||||||||||||||||||
| 843 | online = isOnline; | - | ||||||||||||||||||
| 844 | } never executed: end of block | 0 | ||||||||||||||||||
| 845 | } never executed: end of block | 0 | ||||||||||||||||||
| 846 | if (online
| 0 | ||||||||||||||||||
| 847 | if (defaultAccessControl
| 0 | ||||||||||||||||||
| 848 | if (networkAccessible != QNetworkAccessManager::Accessible
| 0 | ||||||||||||||||||
| 849 | networkAccessible = QNetworkAccessManager::Accessible; | - | ||||||||||||||||||
| 850 | q->networkAccessibleChanged(networkAccessible); | - | ||||||||||||||||||
| 851 | } never executed: end of block | 0 | ||||||||||||||||||
| 852 | } never executed: end of block | 0 | ||||||||||||||||||
| 853 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 854 | if (networkAccessible != QNetworkAccessManager::NotAccessible
| 0 | ||||||||||||||||||
| 855 | networkAccessible = QNetworkAccessManager::NotAccessible; | - | ||||||||||||||||||
| 856 | q->networkAccessibleChanged(networkAccessible); | - | ||||||||||||||||||
| 857 | } never executed: end of block | 0 | ||||||||||||||||||
| 858 | } never executed: end of block | 0 | ||||||||||||||||||
| 859 | } | - | ||||||||||||||||||
| 860 | - | |||||||||||||||||||
| 861 | void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfiguration &configuration) | - | ||||||||||||||||||
| 862 | { | - | ||||||||||||||||||
| 863 | const QString id = configuration.identifier(); | - | ||||||||||||||||||
| 864 | if (configuration.state().testFlag(QNetworkConfiguration::Active)
| 0 | ||||||||||||||||||
| 865 | if (!onlineConfigurations.contains(id)
| 0 | ||||||||||||||||||
| 866 | - | |||||||||||||||||||
| 867 | QSharedPointer<QNetworkSession> session(getNetworkSession()); | - | ||||||||||||||||||
| 868 | if (session
| 0 | ||||||||||||||||||
| 869 | if (online
| 0 | ||||||||||||||||||
| 870 | != networkConfigurationManager.defaultConfiguration().identifier()
| 0 | ||||||||||||||||||
| 871 | - | |||||||||||||||||||
| 872 | onlineConfigurations.insert(id); | - | ||||||||||||||||||
| 873 | - | |||||||||||||||||||
| 874 | - | |||||||||||||||||||
| 875 | _q_networkSessionClosed(); | - | ||||||||||||||||||
| 876 | createSession(networkConfigurationManager.defaultConfiguration()); | - | ||||||||||||||||||
| 877 | } never executed: end of block | 0 | ||||||||||||||||||
| 878 | } never executed: end of block | 0 | ||||||||||||||||||
| 879 | } never executed: end of block | 0 | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | } never executed: else if (onlineConfigurations.contains(id)end of block
| 0 | ||||||||||||||||||
| 882 | - | |||||||||||||||||||
| 883 | onlineConfigurations.remove(id); | - | ||||||||||||||||||
| 884 | if (!onlineConfigurations.isEmpty()
| 0 | ||||||||||||||||||
| 885 | _q_networkSessionClosed(); | - | ||||||||||||||||||
| 886 | createSession(configuration); | - | ||||||||||||||||||
| 887 | } never executed: end of block | 0 | ||||||||||||||||||
| 888 | } never executed: end of block | 0 | ||||||||||||||||||
| 889 | } never executed: end of block | 0 | ||||||||||||||||||
| 890 | - | |||||||||||||||||||
| 891 | - | |||||||||||||||||||
| 892 | void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::SessionError) | - | ||||||||||||||||||
| 893 | { | - | ||||||||||||||||||
| 894 | const auto cfgs = networkConfigurationManager.allConfigurations(); | - | ||||||||||||||||||
| 895 | for (const QNetworkConfiguration &cfg : cfgs) { | - | ||||||||||||||||||
| 896 | if (cfg.state().testFlag(QNetworkConfiguration::Active)
| 0 | ||||||||||||||||||
| 897 | online = true; | - | ||||||||||||||||||
| 898 | _q_networkSessionClosed(); | - | ||||||||||||||||||
| 899 | createSession(networkConfigurationManager.defaultConfiguration()); | - | ||||||||||||||||||
| 900 | return; never executed: return; | 0 | ||||||||||||||||||
| 901 | } | - | ||||||||||||||||||
| 902 | } never executed: end of block | 0 | ||||||||||||||||||
| 903 | } never executed: end of block | 0 | ||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | - | |||||||||||||||||||
| 906 | - | |||||||||||||||||||
| 907 | QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart) | - | ||||||||||||||||||
| 908 | { | - | ||||||||||||||||||
| 909 | - | |||||||||||||||||||
| 910 | QNetworkRequest newRequest(request); | - | ||||||||||||||||||
| 911 | - | |||||||||||||||||||
| 912 | - | |||||||||||||||||||
| 913 | if (!request.header(QNetworkRequest::ContentTypeHeader).isValid()
| 2-22 | ||||||||||||||||||
| 914 | QByteArray contentType; | - | ||||||||||||||||||
| 915 | contentType.reserve(34 + multiPart->d_func()->boundary.count()); | - | ||||||||||||||||||
| 916 | contentType += "multipart/"; | - | ||||||||||||||||||
| 917 | switch (multiPart->d_func()->contentType) { | - | ||||||||||||||||||
| 918 | case executed 2 times by 1 test: QHttpMultiPart::RelatedType:case QHttpMultiPart::RelatedType:Executed by:
executed 2 times by 1 test: case QHttpMultiPart::RelatedType:Executed by:
| 2 | ||||||||||||||||||
| 919 | contentType += "related"; | - | ||||||||||||||||||
| 920 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 921 | case executed 13 times by 2 tests: QHttpMultiPart::FormDataType:case QHttpMultiPart::FormDataType:Executed by:
executed 13 times by 2 tests: case QHttpMultiPart::FormDataType:Executed by:
| 13 | ||||||||||||||||||
| 922 | contentType += "form-data"; | - | ||||||||||||||||||
| 923 | break; executed 13 times by 2 tests: break;Executed by:
| 13 | ||||||||||||||||||
| 924 | case executed 4 times by 1 test: QHttpMultiPart::AlternativeType:case QHttpMultiPart::AlternativeType:Executed by:
executed 4 times by 1 test: case QHttpMultiPart::AlternativeType:Executed by:
| 4 | ||||||||||||||||||
| 925 | contentType += "alternative"; | - | ||||||||||||||||||
| 926 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||
| 927 | default executed 3 times by 1 test: :default:Executed by:
executed 3 times by 1 test: default:Executed by:
| 3 | ||||||||||||||||||
| 928 | contentType += "mixed"; | - | ||||||||||||||||||
| 929 | break; executed 3 times by 1 test: break;Executed by:
| 3 | ||||||||||||||||||
| 930 | } | - | ||||||||||||||||||
| 931 | - | |||||||||||||||||||
| 932 | contentType += "; boundary=\"" + multiPart->d_func()->boundary + '"'; | - | ||||||||||||||||||
| 933 | newRequest.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(contentType)); | - | ||||||||||||||||||
| 934 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | - | |||||||||||||||||||
| 937 | - | |||||||||||||||||||
| 938 | QByteArray mimeHeader("MIME-Version"); | - | ||||||||||||||||||
| 939 | if (!request.hasRawHeader(mimeHeader)
| 0-24 | ||||||||||||||||||
| 940 | newRequest.setRawHeader(mimeHeader, QByteArray("1.0")); executed 24 times by 2 tests: newRequest.setRawHeader(mimeHeader, QByteArray("1.0"));Executed by:
| 24 | ||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | QIODevice *device = multiPart->d_func()->device; | - | ||||||||||||||||||
| 943 | if (!device->isReadable()
| 0-24 | ||||||||||||||||||
| 944 | if (!device->isOpen()
| 0-24 | ||||||||||||||||||
| 945 | if (!device->open(QIODevice::ReadOnly)
| 0-24 | ||||||||||||||||||
| 946 | QMessageLogger(__FILE__, 1773, __PRETTY_FUNCTION__).warning("could not open device for reading"); never executed: QMessageLogger(__FILE__, 1773, __PRETTY_FUNCTION__).warning("could not open device for reading"); | 0 | ||||||||||||||||||
| 947 | } executed 24 times by 2 tests: else {end of blockExecuted by:
| 24 | ||||||||||||||||||
| 948 | QMessageLogger(__FILE__, 1775, __PRETTY_FUNCTION__).warning("device is not readable"); | - | ||||||||||||||||||
| 949 | } never executed: end of block | 0 | ||||||||||||||||||
| 950 | } | - | ||||||||||||||||||
| 951 | - | |||||||||||||||||||
| 952 | return executed 24 times by 2 tests: newRequest;return newRequest;Executed by:
executed 24 times by 2 tests: return newRequest;Executed by:
| 24 | ||||||||||||||||||
| 953 | } | - | ||||||||||||||||||
| 954 | - | |||||||||||||||||||
| 955 | - | |||||||||||||||||||
| 956 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |