| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpthreaddelegate.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url) | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | QNetworkReply::NetworkError code; | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | switch (httpStatusCode) { | - | ||||||||||||||||||||||||
| 13 | case executed 1 time by 1 test: 400:case 400:Executed by:
executed 1 time by 1 test: case 400:Executed by:
| 1 | ||||||||||||||||||||||||
| 14 | code = QNetworkReply::ProtocolInvalidOperationError; | - | ||||||||||||||||||||||||
| 15 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | case never executed: 401:case 401:never executed: case 401: | 0 | ||||||||||||||||||||||||
| 18 | code = QNetworkReply::AuthenticationRequiredError; | - | ||||||||||||||||||||||||
| 19 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | case executed 1 time by 1 test: 403:case 403:Executed by:
executed 1 time by 1 test: case 403:Executed by:
| 1 | ||||||||||||||||||||||||
| 22 | code = QNetworkReply::ContentOperationNotPermittedError; | - | ||||||||||||||||||||||||
| 23 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | case executed 5 times by 2 tests: 404:case 404:Executed by:
executed 5 times by 2 tests: case 404:Executed by:
| 5 | ||||||||||||||||||||||||
| 26 | code = QNetworkReply::ContentNotFoundError; | - | ||||||||||||||||||||||||
| 27 | break; executed 5 times by 2 tests: break;Executed by:
| 5 | ||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | case executed 1 time by 1 test: 405:case 405:Executed by:
executed 1 time by 1 test: case 405:Executed by:
| 1 | ||||||||||||||||||||||||
| 30 | code = QNetworkReply::ContentOperationNotPermittedError; | - | ||||||||||||||||||||||||
| 31 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | case never executed: 407:case 407:never executed: case 407: | 0 | ||||||||||||||||||||||||
| 34 | code = QNetworkReply::ProxyAuthenticationRequiredError; | - | ||||||||||||||||||||||||
| 35 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | case never executed: 409:case 409:never executed: case 409: | 0 | ||||||||||||||||||||||||
| 38 | code = QNetworkReply::ContentConflictError; | - | ||||||||||||||||||||||||
| 39 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | case never executed: 410:case 410:never executed: case 410: | 0 | ||||||||||||||||||||||||
| 42 | code = QNetworkReply::ContentGoneError; | - | ||||||||||||||||||||||||
| 43 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | case never executed: 418:case 418:never executed: case 418: | 0 | ||||||||||||||||||||||||
| 46 | code = QNetworkReply::ProtocolInvalidOperationError; | - | ||||||||||||||||||||||||
| 47 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | case never executed: 500:case 500:never executed: case 500: | 0 | ||||||||||||||||||||||||
| 50 | code = QNetworkReply::InternalServerError; | - | ||||||||||||||||||||||||
| 51 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | case executed 1 time by 1 test: 501:case 501:Executed by:
executed 1 time by 1 test: case 501:Executed by:
| 1 | ||||||||||||||||||||||||
| 54 | code = QNetworkReply::OperationNotImplementedError; | - | ||||||||||||||||||||||||
| 55 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | case never executed: 503:case 503:never executed: case 503: | 0 | ||||||||||||||||||||||||
| 58 | code = QNetworkReply::ServiceUnavailableError; | - | ||||||||||||||||||||||||
| 59 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 62 | if (httpStatusCode > 500
| 0 | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | code = QNetworkReply::UnknownServerError; | - | ||||||||||||||||||||||||
| 65 | } never executed: else if (httpStatusCode >= 400end of block
| 0 | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | code = QNetworkReply::UnknownContentError; | - | ||||||||||||||||||||||||
| 68 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 69 | QMessageLogger(__FILE__, 117, __PRETTY_FUNCTION__).warning("QNetworkAccess: got HTTP status code %d which is not expected from url: \"%s\"", | - | ||||||||||||||||||||||||
| 70 | httpStatusCode, QString(url.toString()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
| 71 | code = QNetworkReply::ProtocolFailure; | - | ||||||||||||||||||||||||
| 72 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 73 | } | - | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | return executed 9 times by 2 tests: code;return code;Executed by:
executed 9 times by 2 tests: return code;Executed by:
| 9 | ||||||||||||||||||||||||
| 76 | } | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy) | - | ||||||||||||||||||||||||
| 80 | { | - | ||||||||||||||||||||||||
| 81 | QString result; | - | ||||||||||||||||||||||||
| 82 | QUrl copy = url; | - | ||||||||||||||||||||||||
| 83 | QString scheme = copy.scheme(); | - | ||||||||||||||||||||||||
| 84 | bool isEncrypted = scheme == QLatin1String("https"); | - | ||||||||||||||||||||||||
| 85 | copy.setPort(copy.port(isEncrypted ? 443 : 80)); | - | ||||||||||||||||||||||||
| 86 | if (scheme == QLatin1String("preconnect-http")
| 0-872 | ||||||||||||||||||||||||
| 87 | copy.setScheme(QLatin1String("http")); | - | ||||||||||||||||||||||||
| 88 | } never executed: else if (scheme == QLatin1String("preconnect-https")end of block
| 0-872 | ||||||||||||||||||||||||
| 89 | copy.setScheme(QLatin1String("https")); | - | ||||||||||||||||||||||||
| 90 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 91 | result = copy.toString(QUrl::RemoveUserInfo | QUrl::RemovePath | | - | ||||||||||||||||||||||||
| 92 | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::FullyEncoded); | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | if (proxy
| 0-733 | ||||||||||||||||||||||||
| 96 | QUrl key; | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | switch (proxy->type()) { | - | ||||||||||||||||||||||||
| 99 | case executed 62 times by 2 tests: QNetworkProxy::Socks5Proxy:case QNetworkProxy::Socks5Proxy:Executed by:
executed 62 times by 2 tests: case QNetworkProxy::Socks5Proxy:Executed by:
| 62 | ||||||||||||||||||||||||
| 100 | key.setScheme(QLatin1String("proxy-socks5")); | - | ||||||||||||||||||||||||
| 101 | break; executed 62 times by 2 tests: break;Executed by:
| 62 | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | case executed 69 times by 2 tests: QNetworkProxy::HttpProxy:case QNetworkProxy::HttpProxy:Executed by:
executed 69 times by 2 tests: case QNetworkProxy::HttpProxy:Executed by:
| 69 | ||||||||||||||||||||||||
| 104 | case executed 8 times by 1 test: QNetworkProxy::HttpCachingProxy:case QNetworkProxy::HttpCachingProxy:Executed by:
executed 8 times by 1 test: case QNetworkProxy::HttpCachingProxy:Executed by:
| 8 | ||||||||||||||||||||||||
| 105 | key.setScheme(QLatin1String("proxy-http")); | - | ||||||||||||||||||||||||
| 106 | break; executed 77 times by 2 tests: break;Executed by:
| 77 | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 109 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 110 | } | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | if (!key.scheme().isEmpty()
| 0-139 | ||||||||||||||||||||||||
| 113 | key.setUserName(proxy->user()); | - | ||||||||||||||||||||||||
| 114 | key.setHost(proxy->hostName()); | - | ||||||||||||||||||||||||
| 115 | key.setPort(proxy->port()); | - | ||||||||||||||||||||||||
| 116 | key.setQuery(result); | - | ||||||||||||||||||||||||
| 117 | result = key.toString(QUrl::FullyEncoded); | - | ||||||||||||||||||||||||
| 118 | } executed 139 times by 2 tests: end of blockExecuted by:
| 139 | ||||||||||||||||||||||||
| 119 | } executed 139 times by 2 tests: end of blockExecuted by:
| 139 | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | return executed 872 times by 8 tests: "http-connection:" + result.toLatin1();return "http-connection:" + result.toLatin1();Executed by:
executed 872 times by 8 tests: return "http-connection:" + result.toLatin1();Executed by:
| 872 | ||||||||||||||||||||||||
| 125 | } | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection, | - | ||||||||||||||||||||||||
| 128 | public QNetworkAccessCache::CacheableObject | - | ||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | public: | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, | - | ||||||||||||||||||||||||
| 138 | QHttpNetworkConnection::ConnectionType connectionType, | - | ||||||||||||||||||||||||
| 139 | QSharedPointer<QNetworkSession> networkSession) | - | ||||||||||||||||||||||||
| 140 | : QHttpNetworkConnection(hostName, port, encrypt, connectionType, 0, | - | ||||||||||||||||||||||||
| 141 | std::move(networkSession)) | - | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | setExpires(true); | - | ||||||||||||||||||||||||
| 145 | setShareable(true); | - | ||||||||||||||||||||||||
| 146 | } executed 551 times by 8 tests: end of blockExecuted by:
| 551 | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | virtual void dispose() override | - | ||||||||||||||||||||||||
| 149 | { | - | ||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | delete this; | - | ||||||||||||||||||||||||
| 154 | } executed 550 times by 9 tests: end of blockExecuted by:
| 550 | ||||||||||||||||||||||||
| 155 | }; | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | QThreadStorage<QNetworkAccessCache *> QHttpThreadDelegate::connections; | - | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | QHttpThreadDelegate::~QHttpThreadDelegate() | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | if (httpReply
| 8-859 | ||||||||||||||||||||||||
| 165 | delete httpReply; | - | ||||||||||||||||||||||||
| 166 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | if (connections.hasLocalData()
| 0-791 | ||||||||||||||||||||||||
| 171 | connections.localData()->releaseEntry(cacheKey); | - | ||||||||||||||||||||||||
| 172 | } executed 791 times by 8 tests: end of blockExecuted by:
| 791 | ||||||||||||||||||||||||
| 173 | } executed 867 times by 8 tests: end of blockExecuted by:
| 867 | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) : | - | ||||||||||||||||||||||||
| 177 | QObject(parent) | - | ||||||||||||||||||||||||
| 178 | , ssl(false) | - | ||||||||||||||||||||||||
| 179 | , downloadBufferMaximumSize(0) | - | ||||||||||||||||||||||||
| 180 | , readBufferMaxSize(0) | - | ||||||||||||||||||||||||
| 181 | , bytesEmitted(0) | - | ||||||||||||||||||||||||
| 182 | , pendingDownloadData() | - | ||||||||||||||||||||||||
| 183 | , pendingDownloadProgress() | - | ||||||||||||||||||||||||
| 184 | , synchronous(false) | - | ||||||||||||||||||||||||
| 185 | , incomingStatusCode(0) | - | ||||||||||||||||||||||||
| 186 | , isPipeliningUsed(false) | - | ||||||||||||||||||||||||
| 187 | , isSpdyUsed(false) | - | ||||||||||||||||||||||||
| 188 | , incomingContentLength(-1) | - | ||||||||||||||||||||||||
| 189 | , incomingErrorCode(QNetworkReply::NoError) | - | ||||||||||||||||||||||||
| 190 | , downloadBuffer() | - | ||||||||||||||||||||||||
| 191 | , httpConnection(0) | - | ||||||||||||||||||||||||
| 192 | , httpReply(0) | - | ||||||||||||||||||||||||
| 193 | , synchronousRequestLoop(0) | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | } executed 869 times by 8 tests: end of blockExecuted by:
| 869 | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | void QHttpThreadDelegate::startRequestSynchronously() | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | synchronous = true; | - | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | QEventLoop synchronousRequestLoop; | - | ||||||||||||||||||||||||
| 206 | this->synchronousRequestLoop = &synchronousRequestLoop; | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | QTimer::singleShot(30*1000, this, qFlagLocation("1""abortRequest()" "\0" __FILE__ ":" "257")); | - | ||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | QMetaObject::invokeMethod(this, "startRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 212 | synchronousRequestLoop.exec(); | - | ||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | connections.localData()->releaseEntry(cacheKey); | - | ||||||||||||||||||||||||
| 215 | connections.setLocalData(0); | - | ||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | } executed 76 times by 1 test: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | void QHttpThreadDelegate::startRequest() | - | ||||||||||||||||||||||||
| 225 | { | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | if (!connections.hasLocalData()
| 332-540 | ||||||||||||||||||||||||
| 232 | connections.setLocalData(new QNetworkAccessCache()); | - | ||||||||||||||||||||||||
| 233 | } executed 540 times by 8 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | QUrl urlCopy = httpRequest.url(); | - | ||||||||||||||||||||||||
| 237 | urlCopy.setPort(urlCopy.port(ssl ? 443 : 80)); | - | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | QHttpNetworkConnection::ConnectionType connectionType | - | ||||||||||||||||||||||||
| 240 | = QHttpNetworkConnection::ConnectionTypeHTTP; | - | ||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | if (httpRequest.isSPDYAllowed()
| 1-759 | ||||||||||||||||||||||||
| 243 | connectionType = QHttpNetworkConnection::ConnectionTypeSPDY; | - | ||||||||||||||||||||||||
| 244 | urlCopy.setScheme(([]() -> QString { enum { Size = sizeof(u"" "spdy")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "spdy" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 112 times by 1 test: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 112 times by 1 test: }()));return qstring_literal_temp;Executed by:
| 112 | ||||||||||||||||||||||||
| 245 | QList<QByteArray> nextProtocols; | - | ||||||||||||||||||||||||
| 246 | nextProtocols << QSslConfiguration::NextProtocolSpdy3_0 | - | ||||||||||||||||||||||||
| 247 | << QSslConfiguration::NextProtocolHttp1_1; | - | ||||||||||||||||||||||||
| 248 | incomingSslConfiguration.setAllowedNextProtocols(nextProtocols); | - | ||||||||||||||||||||||||
| 249 | } executed 112 times by 1 test: end of blockExecuted by:
| 112 | ||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | if (transparentProxy.type() != QNetworkProxy::NoProxy
| 84-788 | ||||||||||||||||||||||||
| 254 | cacheKey = makeCacheKey(urlCopy, &transparentProxy); executed 84 times by 2 tests: cacheKey = makeCacheKey(urlCopy, &transparentProxy);Executed by:
| 84 | ||||||||||||||||||||||||
| 255 | else if (cacheProxy.type() != QNetworkProxy::NoProxy
| 55-733 | ||||||||||||||||||||||||
| 256 | cacheKey = makeCacheKey(urlCopy, &cacheProxy); executed 55 times by 1 test: cacheKey = makeCacheKey(urlCopy, &cacheProxy);Executed by:
| 55 | ||||||||||||||||||||||||
| 257 | else | - | ||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | cacheKey = makeCacheKey(urlCopy, 0); executed 733 times by 8 tests: cacheKey = makeCacheKey(urlCopy, 0);Executed by:
| 733 | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey)); | - | ||||||||||||||||||||||||
| 264 | if (httpConnection == 0
| 321-551 | ||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, | - | ||||||||||||||||||||||||
| 272 | connectionType, | - | ||||||||||||||||||||||||
| 273 | networkSession); | - | ||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | if (ssl
| 40-454 | ||||||||||||||||||||||||
| 278 | httpConnection->setSslConfiguration(incomingSslConfiguration); | - | ||||||||||||||||||||||||
| 279 | } executed 57 times by 2 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | httpConnection->setTransparentProxy(transparentProxy); | - | ||||||||||||||||||||||||
| 284 | httpConnection->setCacheProxy(cacheProxy); | - | ||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | connections.localData()->addEntry(cacheKey, httpConnection); | - | ||||||||||||||||||||||||
| 289 | } executed 551 times by 8 tests: else {end of blockExecuted by:
| 551 | ||||||||||||||||||||||||
| 290 | if (httpRequest.withCredentials()
| 1-320 | ||||||||||||||||||||||||
| 291 | QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), 0); | - | ||||||||||||||||||||||||
| 292 | if (!credential.user.isEmpty()
| 0-320 | ||||||||||||||||||||||||
| 293 | QAuthenticator auth; | - | ||||||||||||||||||||||||
| 294 | auth.setUser(credential.user); | - | ||||||||||||||||||||||||
| 295 | auth.setPassword(credential.password); | - | ||||||||||||||||||||||||
| 296 | httpConnection->d_func()->copyCredentials(-1, &auth, false); | - | ||||||||||||||||||||||||
| 297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 298 | } executed 320 times by 4 tests: end of blockExecuted by:
| 320 | ||||||||||||||||||||||||
| 299 | } executed 321 times by 4 tests: end of blockExecuted by:
| 321 | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | httpReply = httpConnection->sendRequest(httpRequest); | - | ||||||||||||||||||||||||
| 304 | httpReply->setParent(this); | - | ||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | if (synchronous
| 76-796 | ||||||||||||||||||||||||
| 308 | connect(httpReply,qFlagLocation("2""headerChanged()" "\0" __FILE__ ":" "356"), this, qFlagLocation("1""synchronousHeaderChangedSlot()" "\0" __FILE__ ":" "356")); | - | ||||||||||||||||||||||||
| 309 | connect(httpReply,qFlagLocation("2""finished()" "\0" __FILE__ ":" "357"), this, qFlagLocation("1""synchronousFinishedSlot()" "\0" __FILE__ ":" "357")); | - | ||||||||||||||||||||||||
| 310 | connect(httpReply,qFlagLocation("2""finishedWithError(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "358"), | - | ||||||||||||||||||||||||
| 311 | this, qFlagLocation("1""synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "359")); | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | connect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "361"), | - | ||||||||||||||||||||||||
| 314 | this, qFlagLocation("1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "362")); | - | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | connect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "364"), | - | ||||||||||||||||||||||||
| 317 | this, qFlagLocation("1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "365")); | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | } executed 76 times by 1 test: else if (!synchronousend of blockExecuted by:
| 0-796 | ||||||||||||||||||||||||
| 322 | connect(httpReply,qFlagLocation("2""headerChanged()" "\0" __FILE__ ":" "370"), this, qFlagLocation("1""headerChangedSlot()" "\0" __FILE__ ":" "370")); | - | ||||||||||||||||||||||||
| 323 | connect(httpReply,qFlagLocation("2""finished()" "\0" __FILE__ ":" "371"), this, qFlagLocation("1""finishedSlot()" "\0" __FILE__ ":" "371")); | - | ||||||||||||||||||||||||
| 324 | connect(httpReply,qFlagLocation("2""finishedWithError(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "372"), | - | ||||||||||||||||||||||||
| 325 | this, qFlagLocation("1""finishedWithErrorSlot(QNetworkReply::NetworkError,QString)" "\0" __FILE__ ":" "373")); | - | ||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | connect(httpReply,qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "375"), this, qFlagLocation("1""readyReadSlot()" "\0" __FILE__ ":" "375")); | - | ||||||||||||||||||||||||
| 328 | connect(httpReply,qFlagLocation("2""dataReadProgress(qint64,qint64)" "\0" __FILE__ ":" "376"), this, qFlagLocation("1""dataReadProgressSlot(qint64,qint64)" "\0" __FILE__ ":" "376")); | - | ||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | connect(httpReply,qFlagLocation("2""encrypted()" "\0" __FILE__ ":" "378"), this, qFlagLocation("1""encryptedSlot()" "\0" __FILE__ ":" "378")); | - | ||||||||||||||||||||||||
| 331 | connect(httpReply,qFlagLocation("2""sslErrors(QList<QSslError>)" "\0" __FILE__ ":" "379"), this, qFlagLocation("1""sslErrorsSlot(QList<QSslError>)" "\0" __FILE__ ":" "379")); | - | ||||||||||||||||||||||||
| 332 | connect(httpReply,qFlagLocation("2""preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "380"), | - | ||||||||||||||||||||||||
| 333 | this, qFlagLocation("1""preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*)" "\0" __FILE__ ":" "381")); | - | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | connect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "386"), | - | ||||||||||||||||||||||||
| 339 | this, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "387")); | - | ||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | connect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "389"), | - | ||||||||||||||||||||||||
| 342 | this, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "390")); | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | } executed 796 times by 8 tests: end of blockExecuted by:
| 796 | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | connect(httpReply, qFlagLocation("2""cacheCredentials(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "394"), | - | ||||||||||||||||||||||||
| 347 | this, qFlagLocation("1""cacheCredentialsSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "395")); | - | ||||||||||||||||||||||||
| 348 | } executed 872 times by 8 tests: end of blockExecuted by:
| 872 | ||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | void QHttpThreadDelegate::abortRequest() | - | ||||||||||||||||||||||||
| 352 | { | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | if (httpReply
| 18-112 | ||||||||||||||||||||||||
| 357 | httpReply->abort(); | - | ||||||||||||||||||||||||
| 358 | delete httpReply; | - | ||||||||||||||||||||||||
| 359 | httpReply = 0; | - | ||||||||||||||||||||||||
| 360 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | if (synchronous
| 0-130 | ||||||||||||||||||||||||
| 364 | incomingErrorCode = QNetworkReply::TimeoutError; | - | ||||||||||||||||||||||||
| 365 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 366 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | this->deleteLater(); | - | ||||||||||||||||||||||||
| 369 | } executed 130 times by 2 tests: end of blockExecuted by:
| 130 | ||||||||||||||||||||||||
| 370 | } | - | ||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||
| 372 | void QHttpThreadDelegate::readBufferSizeChanged(qint64 size) | - | ||||||||||||||||||||||||
| 373 | { | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | if (httpReply
| 0-18 | ||||||||||||||||||||||||
| 378 | httpReply->setDownstreamLimited(size > 0); | - | ||||||||||||||||||||||||
| 379 | httpReply->setReadBufferSize(size); | - | ||||||||||||||||||||||||
| 380 | readBufferMaxSize = size; | - | ||||||||||||||||||||||||
| 381 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||
| 382 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | void QHttpThreadDelegate::readBufferFreed(qint64 size) | - | ||||||||||||||||||||||||
| 385 | { | - | ||||||||||||||||||||||||
| 386 | if (readBufferMaxSize
| 0-198 | ||||||||||||||||||||||||
| 387 | bytesEmitted -= size; | - | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | QMetaObject::invokeMethod(this, "readyReadSlot", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 390 | } executed 198 times by 1 test: end of blockExecuted by:
| 198 | ||||||||||||||||||||||||
| 391 | } executed 198 times by 1 test: end of blockExecuted by:
| 198 | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | void QHttpThreadDelegate::readyReadSlot() | - | ||||||||||||||||||||||||
| 394 | { | - | ||||||||||||||||||||||||
| 395 | if (!httpReply
| 0-12708 | ||||||||||||||||||||||||
| 396 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | if (!downloadBuffer.isNull()
| 0-12708 | ||||||||||||||||||||||||
| 400 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | if (readBufferMaxSize
| 654-12054 | ||||||||||||||||||||||||
| 403 | if (bytesEmitted < readBufferMaxSize
| 26-628 | ||||||||||||||||||||||||
| 404 | qint64 sizeEmitted = 0; | - | ||||||||||||||||||||||||
| 405 | while (httpReply->readAnyAvailable()
| 44-584 | ||||||||||||||||||||||||
| 406 | if (httpReply->sizeNextBlock() > (readBufferMaxSize-bytesEmitted)
| 40-211 | ||||||||||||||||||||||||
| 407 | sizeEmitted = readBufferMaxSize-bytesEmitted; | - | ||||||||||||||||||||||||
| 408 | bytesEmitted += sizeEmitted; | - | ||||||||||||||||||||||||
| 409 | pendingDownloadData->fetchAndAddRelease(1); | - | ||||||||||||||||||||||||
| 410 | downloadData(httpReply->read(sizeEmitted)); | - | ||||||||||||||||||||||||
| 411 | } executed 40 times by 1 test: else {end of blockExecuted by:
| 40 | ||||||||||||||||||||||||
| 412 | sizeEmitted = httpReply->sizeNextBlock(); | - | ||||||||||||||||||||||||
| 413 | bytesEmitted += sizeEmitted; | - | ||||||||||||||||||||||||
| 414 | pendingDownloadData->fetchAndAddRelease(1); | - | ||||||||||||||||||||||||
| 415 | downloadData(httpReply->readAny()); | - | ||||||||||||||||||||||||
| 416 | } executed 211 times by 1 test: end of blockExecuted by:
| 211 | ||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||
| 418 | } executed 628 times by 1 test: else {end of blockExecuted by:
| 628 | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | } else { | - | ||||||||||||||||||||||||
| 423 | while (httpReply->readAnyAvailable()
| 6231-12054 | ||||||||||||||||||||||||
| 424 | pendingDownloadData->fetchAndAddRelease(1); | - | ||||||||||||||||||||||||
| 425 | downloadData(httpReply->readAny()); | - | ||||||||||||||||||||||||
| 426 | } executed 6231 times by 4 tests: end of blockExecuted by:
| 6231 | ||||||||||||||||||||||||
| 427 | } executed 12054 times by 4 tests: end of blockExecuted by:
| 12054 | ||||||||||||||||||||||||
| 428 | } | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | void QHttpThreadDelegate::finishedSlot() | - | ||||||||||||||||||||||||
| 431 | { | - | ||||||||||||||||||||||||
| 432 | if (!httpReply
| 0-677 | ||||||||||||||||||||||||
| 433 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | while (httpReply->readAnyAvailable()
| 0-677 | ||||||||||||||||||||||||
| 441 | pendingDownloadData->fetchAndAddRelease(1); | - | ||||||||||||||||||||||||
| 442 | downloadData(httpReply->readAny()); | - | ||||||||||||||||||||||||
| 443 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | if (ssl
| 181-496 | ||||||||||||||||||||||||
| 447 | sslConfigurationChanged(httpReply->sslConfiguration()); executed 181 times by 2 tests: sslConfigurationChanged(httpReply->sslConfiguration());Executed by:
| 181 | ||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | if (httpReply->statusCode() >= 400
| 9-668 | ||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | QString msg = QLatin1String("Error transferring %1 - server replied: %2" | - | ||||||||||||||||||||||||
| 453 | ); | - | ||||||||||||||||||||||||
| 454 | msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); | - | ||||||||||||||||||||||||
| 455 | error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg); | - | ||||||||||||||||||||||||
| 456 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | if (httpRequest.isFollowRedirects()
| 2-670 | ||||||||||||||||||||||||
| 459 | redirected(httpReply->redirectUrl(), httpReply->statusCode(), httpReply->request().redirectCount() - 1); executed 5 times by 1 test: redirected(httpReply->redirectUrl(), httpReply->statusCode(), httpReply->request().redirectCount() - 1);Executed by:
| 5 | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | downloadFinished(); | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 464 | QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 465 | httpReply = 0; | - | ||||||||||||||||||||||||
| 466 | } executed 677 times by 6 tests: end of blockExecuted by:
| 677 | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | void QHttpThreadDelegate::synchronousFinishedSlot() | - | ||||||||||||||||||||||||
| 469 | { | - | ||||||||||||||||||||||||
| 470 | if (!httpReply
| 0-63 | ||||||||||||||||||||||||
| 471 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | if (httpReply->statusCode() >= 400
| 0-63 | ||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | QString msg = QLatin1String("Error transferring %1 - server replied: %2" | - | ||||||||||||||||||||||||
| 479 | ); | - | ||||||||||||||||||||||||
| 480 | incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); | - | ||||||||||||||||||||||||
| 481 | incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()); | - | ||||||||||||||||||||||||
| 482 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | synchronousDownloadData = httpReply->readAll(); | - | ||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 487 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 488 | httpReply = 0; | - | ||||||||||||||||||||||||
| 489 | } executed 63 times by 1 test: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail) | - | ||||||||||||||||||||||||
| 492 | { | - | ||||||||||||||||||||||||
| 493 | if (!httpReply
| 0-91 | ||||||||||||||||||||||||
| 494 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | if (ssl
| 29-62 | ||||||||||||||||||||||||
| 502 | sslConfigurationChanged(httpReply->sslConfiguration()); executed 29 times by 2 tests: sslConfigurationChanged(httpReply->sslConfiguration());Executed by:
| 29 | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | error(errorCode,detail); | - | ||||||||||||||||||||||||
| 505 | downloadFinished(); | - | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 509 | QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 510 | httpReply = 0; | - | ||||||||||||||||||||||||
| 511 | } executed 91 times by 4 tests: end of blockExecuted by:
| 91 | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail) | - | ||||||||||||||||||||||||
| 515 | { | - | ||||||||||||||||||||||||
| 516 | if (!httpReply
| 0-13 | ||||||||||||||||||||||||
| 517 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | incomingErrorCode = errorCode; | - | ||||||||||||||||||||||||
| 523 | incomingErrorDetail = detail; | - | ||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | synchronousDownloadData = httpReply->readAll(); | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | QMetaObject::invokeMethod(httpReply, "deleteLater", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 528 | QMetaObject::invokeMethod(synchronousRequestLoop, "quit", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 529 | httpReply = 0; | - | ||||||||||||||||||||||||
| 530 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||
| 532 | static void downloadBufferDeleter(char *ptr) | - | ||||||||||||||||||||||||
| 533 | { | - | ||||||||||||||||||||||||
| 534 | delete[] ptr; | - | ||||||||||||||||||||||||
| 535 | } executed 364 times by 3 tests: end of blockExecuted by:
| 364 | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | void QHttpThreadDelegate::headerChangedSlot() | - | ||||||||||||||||||||||||
| 538 | { | - | ||||||||||||||||||||||||
| 539 | if (!httpReply
| 0-720 | ||||||||||||||||||||||||
| 540 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | if (ssl
| 193-527 | ||||||||||||||||||||||||
| 548 | sslConfigurationChanged(httpReply->sslConfiguration()); executed 193 times by 2 tests: sslConfigurationChanged(httpReply->sslConfiguration());Executed by:
| 193 | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | if (httpReply->supportsUserProvidedDownloadBuffer()
| 334-386 | ||||||||||||||||||||||||
| 553 | && (
| 0-386 | ||||||||||||||||||||||||
| 554 | if (true) { | - | ||||||||||||||||||||||||
| 555 | char *buf = new char[httpReply->contentLength()]; | - | ||||||||||||||||||||||||
| 556 | if (buf
| 0-364 | ||||||||||||||||||||||||
| 557 | downloadBuffer = QSharedPointer<char>(buf, downloadBufferDeleter); | - | ||||||||||||||||||||||||
| 558 | httpReply->setUserProvidedDownloadBuffer(buf); | - | ||||||||||||||||||||||||
| 559 | } executed 364 times by 3 tests: end of blockExecuted by:
| 364 | ||||||||||||||||||||||||
| 560 | } executed 364 times by 3 tests: else {end of blockExecuted by:
dead code: { } | - | ||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||
| 562 | } dead code: { } | - | ||||||||||||||||||||||||
| 563 | } | - | ||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | incomingHeaders = httpReply->header(); | - | ||||||||||||||||||||||||
| 567 | incomingStatusCode = httpReply->statusCode(); | - | ||||||||||||||||||||||||
| 568 | incomingReasonPhrase = httpReply->reasonPhrase(); | - | ||||||||||||||||||||||||
| 569 | isPipeliningUsed = httpReply->isPipeliningUsed(); | - | ||||||||||||||||||||||||
| 570 | incomingContentLength = httpReply->contentLength(); | - | ||||||||||||||||||||||||
| 571 | isSpdyUsed = httpReply->isSpdyUsed(); | - | ||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | downloadMetaData(incomingHeaders, | - | ||||||||||||||||||||||||
| 574 | incomingStatusCode, | - | ||||||||||||||||||||||||
| 575 | incomingReasonPhrase, | - | ||||||||||||||||||||||||
| 576 | isPipeliningUsed, | - | ||||||||||||||||||||||||
| 577 | downloadBuffer, | - | ||||||||||||||||||||||||
| 578 | incomingContentLength, | - | ||||||||||||||||||||||||
| 579 | isSpdyUsed); | - | ||||||||||||||||||||||||
| 580 | } executed 720 times by 6 tests: end of blockExecuted by:
| 720 | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | void QHttpThreadDelegate::synchronousHeaderChangedSlot() | - | ||||||||||||||||||||||||
| 583 | { | - | ||||||||||||||||||||||||
| 584 | if (!httpReply
| 0-74 | ||||||||||||||||||||||||
| 585 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | - | |||||||||||||||||||||||||
| 591 | incomingHeaders = httpReply->header(); | - | ||||||||||||||||||||||||
| 592 | incomingStatusCode = httpReply->statusCode(); | - | ||||||||||||||||||||||||
| 593 | incomingReasonPhrase = httpReply->reasonPhrase(); | - | ||||||||||||||||||||||||
| 594 | isPipeliningUsed = httpReply->isPipeliningUsed(); | - | ||||||||||||||||||||||||
| 595 | isSpdyUsed = httpReply->isSpdyUsed(); | - | ||||||||||||||||||||||||
| 596 | incomingContentLength = httpReply->contentLength(); | - | ||||||||||||||||||||||||
| 597 | } executed 74 times by 1 test: end of blockExecuted by:
| 74 | ||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | void QHttpThreadDelegate::dataReadProgressSlot(qint64 done, qint64 total) | - | ||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | if (downloadBuffer.isNull()
| 1490-12485 | ||||||||||||||||||||||||
| 605 | return; executed 12485 times by 4 tests: return;Executed by:
| 12485 | ||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||
| 607 | pendingDownloadProgress->fetchAndAddRelease(1); | - | ||||||||||||||||||||||||
| 608 | downloadProgress(done, total); | - | ||||||||||||||||||||||||
| 609 | } executed 1490 times by 3 tests: end of blockExecuted by:
| 1490 | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | void QHttpThreadDelegate::cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator) | - | ||||||||||||||||||||||||
| 612 | { | - | ||||||||||||||||||||||||
| 613 | authenticationManager->cacheCredentials(request.url(), authenticator); | - | ||||||||||||||||||||||||
| 614 | } executed 170 times by 1 test: end of blockExecuted by:
| 170 | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||
| 618 | void QHttpThreadDelegate::encryptedSlot() | - | ||||||||||||||||||||||||
| 619 | { | - | ||||||||||||||||||||||||
| 620 | if (!httpReply
| 0-75 | ||||||||||||||||||||||||
| 621 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | sslConfigurationChanged(httpReply->sslConfiguration()); | - | ||||||||||||||||||||||||
| 624 | encrypted(); | - | ||||||||||||||||||||||||
| 625 | } executed 75 times by 2 tests: end of blockExecuted by:
| 75 | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors) | - | ||||||||||||||||||||||||
| 628 | { | - | ||||||||||||||||||||||||
| 629 | if (!httpReply
| 0-48 | ||||||||||||||||||||||||
| 630 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 | sslConfigurationChanged(httpReply->sslConfiguration()); | - | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | bool ignoreAll = false; | - | ||||||||||||||||||||||||
| 635 | QList<QSslError> specificErrors; | - | ||||||||||||||||||||||||
| 636 | sslErrors(errors, &ignoreAll, &specificErrors); | - | ||||||||||||||||||||||||
| 637 | if (ignoreAll
| 16-32 | ||||||||||||||||||||||||
| 638 | httpReply->ignoreSslErrors(); executed 32 times by 2 tests: httpReply->ignoreSslErrors();Executed by:
| 32 | ||||||||||||||||||||||||
| 639 | if (!specificErrors.isEmpty()
| 6-42 | ||||||||||||||||||||||||
| 640 | httpReply->ignoreSslErrors(specificErrors); executed 6 times by 1 test: httpReply->ignoreSslErrors(specificErrors);Executed by:
| 6 | ||||||||||||||||||||||||
| 641 | } executed 48 times by 2 tests: end of blockExecuted by:
| 48 | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | void QHttpThreadDelegate::preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator) | - | ||||||||||||||||||||||||
| 644 | { | - | ||||||||||||||||||||||||
| 645 | if (!httpReply
| 0 | ||||||||||||||||||||||||
| 646 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | preSharedKeyAuthenticationRequired(authenticator); | - | ||||||||||||||||||||||||
| 649 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *a) | - | ||||||||||||||||||||||||
| 653 | { | - | ||||||||||||||||||||||||
| 654 | if (!httpReply
| 0-17 | ||||||||||||||||||||||||
| 655 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | (void)request;; | - | ||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), a); | - | ||||||||||||||||||||||||
| 664 | if (!credential.isNull()
| 6-11 | ||||||||||||||||||||||||
| 665 | a->setUser(credential.user); | - | ||||||||||||||||||||||||
| 666 | a->setPassword(credential.password); | - | ||||||||||||||||||||||||
| 667 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | QObject::disconnect(httpReply, qFlagLocation("2""authenticationRequired(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "718"), | - | ||||||||||||||||||||||||
| 671 | this, qFlagLocation("1""synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)" "\0" __FILE__ ":" "719")); | - | ||||||||||||||||||||||||
| 672 | } executed 17 times by 1 test: end of blockExecuted by:
| 17 | ||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &p, QAuthenticator *a) | - | ||||||||||||||||||||||||
| 676 | { | - | ||||||||||||||||||||||||
| 677 | if (!httpReply
| 0-1 | ||||||||||||||||||||||||
| 678 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedProxyCredentials(p, a); | - | ||||||||||||||||||||||||
| 685 | if (!credential.isNull()
| 0-1 | ||||||||||||||||||||||||
| 686 | a->setUser(credential.user); | - | ||||||||||||||||||||||||
| 687 | a->setPassword(credential.password); | - | ||||||||||||||||||||||||
| 688 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | QObject::disconnect(httpReply, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "740"), | - | ||||||||||||||||||||||||
| 693 | this, qFlagLocation("1""synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "741")); | - | ||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |