| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpnetworkconnection.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6; | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3; | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2; | - | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, | - | ||||||||||||||||||||||||
| 24 | quint16 port, bool encrypt, | - | ||||||||||||||||||||||||
| 25 | QHttpNetworkConnection::ConnectionType type) | - | ||||||||||||||||||||||||
| 26 | : state(RunningState), | - | ||||||||||||||||||||||||
| 27 | networkLayerState(Unknown), | - | ||||||||||||||||||||||||
| 28 | hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true) | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | , channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY) ? 1 : defaultHttpChannelCount) | - | ||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | , networkProxy(QNetworkProxy::NoProxy) | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | , preConnectRequests(0) | - | ||||||||||||||||||||||||
| 38 | , connectionType(type) | - | ||||||||||||||||||||||||
| 39 | { | - | ||||||||||||||||||||||||
| 40 | channels = new QHttpNetworkConnectionChannel[channelCount]; | - | ||||||||||||||||||||||||
| 41 | } executed 575 times by 8 tests: end of blockExecuted by:
| 575 | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, | - | ||||||||||||||||||||||||
| 44 | quint16 port, bool encrypt, | - | ||||||||||||||||||||||||
| 45 | QHttpNetworkConnection::ConnectionType type) | - | ||||||||||||||||||||||||
| 46 | : state(RunningState), networkLayerState(Unknown), | - | ||||||||||||||||||||||||
| 47 | hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true), | - | ||||||||||||||||||||||||
| 48 | channelCount(channelCount) | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | , networkProxy(QNetworkProxy::NoProxy) | - | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | , preConnectRequests(0) | - | ||||||||||||||||||||||||
| 53 | , connectionType(type) | - | ||||||||||||||||||||||||
| 54 | { | - | ||||||||||||||||||||||||
| 55 | channels = new QHttpNetworkConnectionChannel[channelCount]; | - | ||||||||||||||||||||||||
| 56 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() | - | ||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||
| 62 | for (int i = 0; i < channelCount
| 582-3410 | ||||||||||||||||||||||||
| 63 | if (channels[i].socket
| 752-2658 | ||||||||||||||||||||||||
| 64 | QObject::disconnect(channels[i].socket, nullptr, &channels[i], nullptr); | - | ||||||||||||||||||||||||
| 65 | channels[i].socket->close(); | - | ||||||||||||||||||||||||
| 66 | delete channels[i].socket; | - | ||||||||||||||||||||||||
| 67 | } executed 752 times by 9 tests: end of blockExecuted by:
| 752 | ||||||||||||||||||||||||
| 68 | } executed 3410 times by 9 tests: end of blockExecuted by:
| 3410 | ||||||||||||||||||||||||
| 69 | delete []channels; | - | ||||||||||||||||||||||||
| 70 | } executed 582 times by 9 tests: end of blockExecuted by:
| 582 | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | void QHttpNetworkConnectionPrivate::init() | - | ||||||||||||||||||||||||
| 73 | { | - | ||||||||||||||||||||||||
| 74 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 75 | for (int i = 0; i < channelCount
| 583-3416 | ||||||||||||||||||||||||
| 76 | channels[i].setConnection(this->q_func()); | - | ||||||||||||||||||||||||
| 77 | channels[i].ssl = encrypt; | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | channels[i].networkSession = networkSession; | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | } executed 3416 times by 8 tests: end of blockExecuted by:
| 3416 | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | delayedConnectionTimer.setSingleShot(true); | - | ||||||||||||||||||||||||
| 85 | QObject::connect(&delayedConnectionTimer, qFlagLocation("2""timeout()" "\0" __FILE__ ":" "140"), q, qFlagLocation("1""_q_connectDelayedChannel()" "\0" __FILE__ ":" "140")); | - | ||||||||||||||||||||||||
| 86 | } executed 583 times by 8 tests: end of blockExecuted by:
| 583 | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | void QHttpNetworkConnectionPrivate::pauseConnection() | - | ||||||||||||||||||||||||
| 89 | { | - | ||||||||||||||||||||||||
| 90 | state = PausedState; | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | for (int i = 0; i < channelCount
| 275-1600 | ||||||||||||||||||||||||
| 94 | if (channels[i].socket
| 325-1275 | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | if (encrypt
| 128-197 | ||||||||||||||||||||||||
| 97 | QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket)); executed 128 times by 3 tests: QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));Executed by:
| 128 | ||||||||||||||||||||||||
| 98 | else | - | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket); executed 197 times by 2 tests: QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);Executed by:
| 197 | ||||||||||||||||||||||||
| 101 | } | - | ||||||||||||||||||||||||
| 102 | } executed 1600 times by 3 tests: end of blockExecuted by:
| 1600 | ||||||||||||||||||||||||
| 103 | } executed 275 times by 3 tests: end of blockExecuted by:
| 275 | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | void QHttpNetworkConnectionPrivate::resumeConnection() | - | ||||||||||||||||||||||||
| 106 | { | - | ||||||||||||||||||||||||
| 107 | state = RunningState; | - | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | for (int i = 0; i < channelCount
| 275-1600 | ||||||||||||||||||||||||
| 110 | if (channels[i].socket
| 325-1275 | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | if (encrypt
| 128-197 | ||||||||||||||||||||||||
| 113 | QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket)); executed 128 times by 3 tests: QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));Executed by:
| 128 | ||||||||||||||||||||||||
| 114 | else | - | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket); executed 197 times by 2 tests: QAbstractSocketPrivate::resumeSocketNotifiers(channels[i].socket);Executed by:
| 197 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | if (channels[i].state == QHttpNetworkConnectionChannel::WritingState
| 0-325 | ||||||||||||||||||||||||
| 120 | QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection); never executed: QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection); | 0 | ||||||||||||||||||||||||
| 121 | } executed 325 times by 3 tests: end of blockExecuted by:
| 325 | ||||||||||||||||||||||||
| 122 | } executed 1600 times by 3 tests: end of blockExecuted by:
| 1600 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 126 | } executed 275 times by 3 tests: end of blockExecuted by:
| 275 | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const | - | ||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||
| 130 | for (int i = 0; i < channelCount
| 0-16109 | ||||||||||||||||||||||||
| 131 | if (channels[i].socket == socket
| 7294-8815 | ||||||||||||||||||||||||
| 132 | return executed 7294 times by 8 tests: i;return i;Executed by:
executed 7294 times by 8 tests: return i;Executed by:
| 7294 | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | QMessageLogger(__FILE__, 189, __PRETTY_FUNCTION__).fatal("Called with unknown socket object."); | - | ||||||||||||||||||||||||
| 135 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 136 | } | - | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | bool QHttpNetworkConnectionPrivate::shouldEmitChannelError(QAbstractSocket *socket) | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | bool emitError = true; | - | ||||||||||||||||||||||||
| 147 | int i = indexOf(socket); | - | ||||||||||||||||||||||||
| 148 | int otherSocket = (i == 0
| 27-125 | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | if (delayedConnectionTimer.isActive()
| 30-122 | ||||||||||||||||||||||||
| 152 | delayedConnectionTimer.stop(); | - | ||||||||||||||||||||||||
| 153 | channels[otherSocket].ensureConnection(); | - | ||||||||||||||||||||||||
| 154 | } executed 122 times by 2 tests: end of blockExecuted by:
| 122 | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | if (channelCount == 1
| 3-149 | ||||||||||||||||||||||||
| 157 | if (networkLayerState == HostLookupPending
| 0-3 | ||||||||||||||||||||||||
| 158 | networkLayerState = QHttpNetworkConnectionPrivate::Unknown; never executed: networkLayerState = QHttpNetworkConnectionPrivate::Unknown; | 0 | ||||||||||||||||||||||||
| 159 | channels[0].close(); | - | ||||||||||||||||||||||||
| 160 | emitError = true; | - | ||||||||||||||||||||||||
| 161 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 162 | if (networkLayerState == HostLookupPending
| 0-149 | ||||||||||||||||||||||||
| 163 | if (channels[otherSocket].isSocketBusy()
| 0-122 | ||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | channels[i].close(); | - | ||||||||||||||||||||||||
| 166 | emitError = false; | - | ||||||||||||||||||||||||
| 167 | } executed 122 times by 2 tests: end of blockExecuted by:
| 122 | ||||||||||||||||||||||||
| 168 | else { | - | ||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | networkLayerState = QHttpNetworkConnectionPrivate::Unknown; | - | ||||||||||||||||||||||||
| 171 | channels[i].close(); | - | ||||||||||||||||||||||||
| 172 | emitError = true; | - | ||||||||||||||||||||||||
| 173 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 174 | } else { | - | ||||||||||||||||||||||||
| 175 | if (((
| 0-25 | ||||||||||||||||||||||||
| 176 | || ((
| 0-25 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | channels[i].close(); | - | ||||||||||||||||||||||||
| 179 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 180 | emitError = false; | - | ||||||||||||||||||||||||
| 181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 182 | if (networkLayerState == QHttpNetworkConnectionPrivate::Unknown
| 0-25 | ||||||||||||||||||||||||
| 183 | QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("We got a connection error when networkLayerState is Unknown"); never executed: QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("We got a connection error when networkLayerState is Unknown"); | 0 | ||||||||||||||||||||||||
| 184 | } executed 25 times by 2 tests: end of blockExecuted by:
| 25 | ||||||||||||||||||||||||
| 185 | } | - | ||||||||||||||||||||||||
| 186 | return executed 152 times by 4 tests: emitError;return emitError;Executed by:
executed 152 times by 4 tests: return emitError;Executed by:
| 152 | ||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const | - | ||||||||||||||||||||||||
| 191 | { | - | ||||||||||||||||||||||||
| 192 | return executed 12636 times by 1 test: reply.d_func()->responseData.byteAmount();return reply.d_func()->responseData.byteAmount();Executed by:
executed 12636 times by 1 test: return reply.d_func()->responseData.byteAmount();Executed by:
| 12636 | ||||||||||||||||||||||||
| 193 | } | - | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const | - | ||||||||||||||||||||||||
| 196 | { | - | ||||||||||||||||||||||||
| 197 | return never executed: reply.d_func()->responseData.sizeNextBlock();return reply.d_func()->responseData.sizeNextBlock();never executed: return reply.d_func()->responseData.sizeNextBlock(); | 0 | ||||||||||||||||||||||||
| 198 | } | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) | - | ||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||
| 202 | QHttpNetworkRequest &request = messagePair.first; | - | ||||||||||||||||||||||||
| 203 | QHttpNetworkReply *reply = messagePair.second; | - | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | QByteArray value; | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); | - | ||||||||||||||||||||||||
| 209 | if (uploadByteDevice
| 201-1436 | ||||||||||||||||||||||||
| 210 | const qint64 contentLength = request.contentLength(); | - | ||||||||||||||||||||||||
| 211 | const qint64 uploadDeviceSize = uploadByteDevice->size(); | - | ||||||||||||||||||||||||
| 212 | if (contentLength != -1
| 1-131 | ||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | request.setContentLength(qMin(uploadDeviceSize, contentLength)); | - | ||||||||||||||||||||||||
| 215 | } executed 130 times by 3 tests: else if (contentLength == -1end of blockExecuted by:
| 0-130 | ||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | request.setContentLength(uploadDeviceSize); | - | ||||||||||||||||||||||||
| 218 | } executed 70 times by 2 tests: else if (contentLength != -1end of blockExecuted by:
| 0-70 | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | } executed 1 time by 1 test: else if (__builtin_expect(!!(contentLength == -1 && uploadDeviceSize == -1), false)end of blockExecuted by:
| 0-1 | ||||||||||||||||||||||||
| 221 | QMessageLogger(__FILE__, 276, __PRETTY_FUNCTION__).fatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given"); | - | ||||||||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 223 | } executed 201 times by 4 tests: end of blockExecuted by:
| 201 | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | if (networkProxy.type() == QNetworkProxy::HttpCachingProxy
| 8-1629 | ||||||||||||||||||||||||
| 227 | value = request.headerField("proxy-connection"); | - | ||||||||||||||||||||||||
| 228 | if (value.isEmpty()
| 0-8 | ||||||||||||||||||||||||
| 229 | request.setHeaderField("Proxy-Connection", "Keep-Alive"); executed 8 times by 1 test: request.setHeaderField("Proxy-Connection", "Keep-Alive");Executed by:
| 8 | ||||||||||||||||||||||||
| 230 | } executed 8 times by 1 test: else {end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | value = request.headerField("connection"); | - | ||||||||||||||||||||||||
| 233 | if (value.isEmpty()
| 0-1629 | ||||||||||||||||||||||||
| 234 | request.setHeaderField("Connection", "Keep-Alive"); executed 1629 times by 8 tests: request.setHeaderField("Connection", "Keep-Alive");Executed by:
| 1629 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | } executed 1629 times by 8 tests: end of blockExecuted by:
| 1629 | ||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | value = request.headerField("accept-encoding"); | - | ||||||||||||||||||||||||
| 245 | if (value.isEmpty()
| 2-1635 | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | request.setHeaderField("Accept-Encoding", "gzip, deflate"); | - | ||||||||||||||||||||||||
| 248 | request.d->autoDecompress = true; | - | ||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | } executed 1635 times by 8 tests: end of blockExecuted by:
| 1635 | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | value = request.headerField("accept-language"); | - | ||||||||||||||||||||||||
| 260 | if (value.isEmpty()
| 0-1637 | ||||||||||||||||||||||||
| 261 | QString systemLocale = QLocale::system().name().replace(QChar::fromLatin1('_'),QChar::fromLatin1('-')); | - | ||||||||||||||||||||||||
| 262 | QString acceptLanguage; | - | ||||||||||||||||||||||||
| 263 | if (systemLocale == QLatin1String("C")
| 0-1637 | ||||||||||||||||||||||||
| 264 | acceptLanguage = QString::fromLatin1("en,*"); never executed: acceptLanguage = QString::fromLatin1("en,*"); | 0 | ||||||||||||||||||||||||
| 265 | else if (systemLocale.startsWith(QLatin1String("en-"))
| 0-1637 | ||||||||||||||||||||||||
| 266 | acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale); executed 1637 times by 8 tests: acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);Executed by:
| 1637 | ||||||||||||||||||||||||
| 267 | else | - | ||||||||||||||||||||||||
| 268 | acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale); never executed: acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale); | 0 | ||||||||||||||||||||||||
| 269 | request.setHeaderField("Accept-Language", acceptLanguage.toLatin1()); | - | ||||||||||||||||||||||||
| 270 | } executed 1637 times by 8 tests: end of blockExecuted by:
| 1637 | ||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | value = request.headerField("user-agent"); | - | ||||||||||||||||||||||||
| 274 | if (value.isEmpty()
| 4-1633 | ||||||||||||||||||||||||
| 275 | request.setHeaderField("User-Agent", "Mozilla/5.0"); executed 1633 times by 7 tests: request.setHeaderField("User-Agent", "Mozilla/5.0");Executed by:
| 1633 | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | value = request.headerField("host"); | - | ||||||||||||||||||||||||
| 278 | if (value.isEmpty()
| 1-1636 | ||||||||||||||||||||||||
| 279 | QHostAddress add; | - | ||||||||||||||||||||||||
| 280 | QByteArray host; | - | ||||||||||||||||||||||||
| 281 | if (add.setAddress(hostName)
| 43-1593 | ||||||||||||||||||||||||
| 282 | if (add.protocol() == QAbstractSocket::IPv6Protocol
| 1-42 | ||||||||||||||||||||||||
| 283 | host = '[' + hostName.toLatin1() + ']'; executed 1 time by 1 test: host = '[' + hostName.toLatin1() + ']';Executed by:
| 1 | ||||||||||||||||||||||||
| 284 | else | - | ||||||||||||||||||||||||
| 285 | host = hostName.toLatin1(); executed 42 times by 3 tests: host = hostName.toLatin1();Executed by:
| 42 | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | } else { | - | ||||||||||||||||||||||||
| 288 | host = QUrl::toAce(hostName); | - | ||||||||||||||||||||||||
| 289 | } executed 1593 times by 7 tests: end of blockExecuted by:
| 1593 | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | int port = request.url().port(); | - | ||||||||||||||||||||||||
| 292 | if (port != -1
| 173-1463 | ||||||||||||||||||||||||
| 293 | host += ':'; | - | ||||||||||||||||||||||||
| 294 | host += QByteArray::number(port); | - | ||||||||||||||||||||||||
| 295 | } executed 173 times by 3 tests: end of blockExecuted by:
| 173 | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | request.setHeaderField("Host", host); | - | ||||||||||||||||||||||||
| 298 | } executed 1636 times by 7 tests: end of blockExecuted by:
| 1636 | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | reply->d_func()->requestIsPrepared = true; | - | ||||||||||||||||||||||||
| 301 | } executed 1637 times by 8 tests: end of blockExecuted by:
| 1637 | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 | void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket, | - | ||||||||||||||||||||||||
| 307 | QHttpNetworkReply *reply, | - | ||||||||||||||||||||||||
| 308 | QNetworkReply::NetworkError errorCode) | - | ||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||
| 310 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | int i = 0; | - | ||||||||||||||||||||||||
| 313 | if (socket
| 4-5 | ||||||||||||||||||||||||
| 314 | i = indexOf(socket); executed 5 times by 2 tests: i = indexOf(socket);Executed by:
| 5 | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | if (reply
| 0-9 | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | reply->d_func()->errorString = errorDetail(errorCode, socket); | - | ||||||||||||||||||||||||
| 319 | reply->finishedWithError(errorCode, reply->d_func()->errorString); | - | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | reply->d_func()->eraseData(); | - | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | channels[i].close(); | - | ||||||||||||||||||||||||
| 325 | channels[i].reply = 0; | - | ||||||||||||||||||||||||
| 326 | if (channels[i].protocolHandler
| 4-5 | ||||||||||||||||||||||||
| 327 | channels[i].protocolHandler->setReply(0); executed 5 times by 2 tests: channels[i].protocolHandler->setReply(0);Executed by:
| 5 | ||||||||||||||||||||||||
| 328 | channels[i].request = QHttpNetworkRequest(); | - | ||||||||||||||||||||||||
| 329 | if (socket
| 4-5 | ||||||||||||||||||||||||
| 330 | channels[i].requeueCurrentlyPipelinedRequests(); executed 5 times by 2 tests: channels[i].requeueCurrentlyPipelinedRequests();Executed by:
| 5 | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 334 | } executed 9 times by 4 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 335 | } executed 9 times by 4 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | void QHttpNetworkConnectionPrivate::copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy) | - | ||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||
| 339 | ((!(auth)) ? qt_assert("auth",__FILE__,394) : qt_noop()); | - | ||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | if (fromChannel >= 0
| 0-201 | ||||||||||||||||||||||||
| 343 | if (!isProxy
| 0-135 | ||||||||||||||||||||||||
| 344 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 345 | if (isProxy
| 0-135 | ||||||||||||||||||||||||
| 346 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 347 | } executed 201 times by 3 tests: end of blockExecuted by:
| 201 | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | QAuthenticator* otherAuth = 0; | - | ||||||||||||||||||||||||
| 351 | for (int i = 0; i < channelCount
| 201-1191 | ||||||||||||||||||||||||
| 352 | if (i == fromChannel
| 201-990 | ||||||||||||||||||||||||
| 353 | continue; executed 201 times by 3 tests: continue;Executed by:
| 201 | ||||||||||||||||||||||||
| 354 | if (isProxy
| 315-675 | ||||||||||||||||||||||||
| 355 | otherAuth = &channels[i].proxyAuthenticator; executed 315 times by 1 test: otherAuth = &channels[i].proxyAuthenticator;Executed by:
| 315 | ||||||||||||||||||||||||
| 356 | else | - | ||||||||||||||||||||||||
| 357 | otherAuth = &channels[i].authenticator; executed 675 times by 2 tests: otherAuth = &channels[i].authenticator;Executed by:
| 675 | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | if (otherAuth->user().compare(auth->user())
| 255-735 | ||||||||||||||||||||||||
| 360 | otherAuth->setUser(auth->user()); executed 735 times by 2 tests: otherAuth->setUser(auth->user());Executed by:
| 735 | ||||||||||||||||||||||||
| 361 | if (otherAuth->password().compare(auth->password())
| 245-745 | ||||||||||||||||||||||||
| 362 | otherAuth->setPassword(auth->password()); executed 745 times by 2 tests: otherAuth->setPassword(auth->password());Executed by:
| 745 | ||||||||||||||||||||||||
| 363 | } executed 990 times by 2 tests: end of blockExecuted by:
| 990 | ||||||||||||||||||||||||
| 364 | } executed 201 times by 3 tests: end of blockExecuted by:
| 201 | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, | - | ||||||||||||||||||||||||
| 369 | bool isProxy, bool &resend) | - | ||||||||||||||||||||||||
| 370 | { | - | ||||||||||||||||||||||||
| 371 | ((!(socket)) ? qt_assert("socket",__FILE__,426) : qt_noop()); | - | ||||||||||||||||||||||||
| 372 | ((!(reply)) ? qt_assert("reply",__FILE__,427) : qt_noop()); | - | ||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | resend = false; | - | ||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | QList<QPair<QByteArray, QByteArray> > fields = reply->header(); | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy); | - | ||||||||||||||||||||||||
| 380 | if (authMethod != QAuthenticatorPrivate::None
| 3-353 | ||||||||||||||||||||||||
| 381 | int i = indexOf(socket); | - | ||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | QAuthenticator* auth = 0; | - | ||||||||||||||||||||||||
| 384 | if (isProxy
| 53-300 | ||||||||||||||||||||||||
| 385 | auth = &channels[i].proxyAuthenticator; | - | ||||||||||||||||||||||||
| 386 | channels[i].proxyAuthMethod = authMethod; | - | ||||||||||||||||||||||||
| 387 | } executed 53 times by 1 test: else {end of blockExecuted by:
| 53 | ||||||||||||||||||||||||
| 388 | auth = &channels[i].authenticator; | - | ||||||||||||||||||||||||
| 389 | channels[i].authMethod = authMethod; | - | ||||||||||||||||||||||||
| 390 | } executed 300 times by 2 tests: end of blockExecuted by:
| 300 | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | if (auth->isNull()
| 0-353 | ||||||||||||||||||||||||
| 393 | auth->detach(); never executed: auth->detach(); | 0 | ||||||||||||||||||||||||
| 394 | QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth); | - | ||||||||||||||||||||||||
| 395 | priv->parseHttpResponse(fields, isProxy); | - | ||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||
| 397 | if (priv->phase == QAuthenticatorPrivate::Done
| 174-179 | ||||||||||||||||||||||||
| 398 | pauseConnection(); | - | ||||||||||||||||||||||||
| 399 | if (!isProxy
| 27-152 | ||||||||||||||||||||||||
| 400 | if (channels[i].authenticationCredentialsSent
| 52-100 | ||||||||||||||||||||||||
| 401 | auth->detach(); | - | ||||||||||||||||||||||||
| 402 | priv = QAuthenticatorPrivate::getPrivate(*auth); | - | ||||||||||||||||||||||||
| 403 | priv->hasFailed = true; | - | ||||||||||||||||||||||||
| 404 | priv->phase = QAuthenticatorPrivate::Done; | - | ||||||||||||||||||||||||
| 405 | channels[i].authenticationCredentialsSent = false; | - | ||||||||||||||||||||||||
| 406 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||||||||||||||
| 407 | reply->authenticationRequired(reply->request(), auth); | - | ||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | } executed 152 times by 2 tests: else {end of blockExecuted by:
| 152 | ||||||||||||||||||||||||
| 410 | if (channels[i].proxyCredentialsSent
| 2-25 | ||||||||||||||||||||||||
| 411 | auth->detach(); | - | ||||||||||||||||||||||||
| 412 | priv = QAuthenticatorPrivate::getPrivate(*auth); | - | ||||||||||||||||||||||||
| 413 | priv->hasFailed = true; | - | ||||||||||||||||||||||||
| 414 | priv->phase = QAuthenticatorPrivate::Done; | - | ||||||||||||||||||||||||
| 415 | channels[i].proxyCredentialsSent = false; | - | ||||||||||||||||||||||||
| 416 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 417 | reply->proxyAuthenticationRequired(networkProxy, auth); | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | } executed 27 times by 1 test: end of blockExecuted by:
| 27 | ||||||||||||||||||||||||
| 420 | resumeConnection(); | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | if (priv->phase != QAuthenticatorPrivate::Done
| 38-141 | ||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | copyCredentials(i, auth, isProxy); | - | ||||||||||||||||||||||||
| 425 | } executed 141 times by 2 tests: end of blockExecuted by:
| 141 | ||||||||||||||||||||||||
| 426 | } executed 179 times by 2 tests: else if (priv->phase == QAuthenticatorPrivate::Startend of blockExecuted by:
| 0-179 | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | reply->cacheCredentials(reply->request(), auth); | - | ||||||||||||||||||||||||
| 431 | } executed 174 times by 2 tests: end of blockExecuted by:
| 174 | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | if (priv->phase == QAuthenticatorPrivate::Done
| 0-315 | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | auth = 0; | - | ||||||||||||||||||||||||
| 439 | if (isProxy
| 3-35 | ||||||||||||||||||||||||
| 440 | channels[i].proxyAuthenticator = QAuthenticator(); executed 3 times by 1 test: channels[i].proxyAuthenticator = QAuthenticator();Executed by:
| 3 | ||||||||||||||||||||||||
| 441 | else | - | ||||||||||||||||||||||||
| 442 | channels[i].authenticator = QAuthenticator(); executed 35 times by 2 tests: channels[i].authenticator = QAuthenticator();Executed by:
| 35 | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | channels[i].reply->headerChanged(); | - | ||||||||||||||||||||||||
| 446 | channels[i].reply->readyRead(); | - | ||||||||||||||||||||||||
| 447 | QNetworkReply::NetworkError errorCode = | - | ||||||||||||||||||||||||
| 448 | isProxy
| 3-35 | ||||||||||||||||||||||||
| 449 | ? QNetworkReply::ProxyAuthenticationRequiredError | - | ||||||||||||||||||||||||
| 450 | : QNetworkReply::AuthenticationRequiredError; | - | ||||||||||||||||||||||||
| 451 | reply->d_func()->errorString = errorDetail(errorCode, socket); | - | ||||||||||||||||||||||||
| 452 | reply->finishedWithError(errorCode, reply->d_func()->errorString); | - | ||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | return executed 38 times by 2 tests: true;return true;Executed by:
executed 38 times by 2 tests: return true;Executed by:
| 38 | ||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | resend = true; | - | ||||||||||||||||||||||||
| 458 | return executed 315 times by 2 tests: true;return true;Executed by:
executed 315 times by 2 tests: return true;Executed by:
| 315 | ||||||||||||||||||||||||
| 459 | } | - | ||||||||||||||||||||||||
| 460 | return executed 3 times by 1 test: false;return false;Executed by:
executed 3 times by 1 test: return false;Executed by:
| 3 | ||||||||||||||||||||||||
| 461 | } | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | QUrl QHttpNetworkConnectionPrivate::parseRedirectResponse(QAbstractSocket *socket, QHttpNetworkReply *reply) | - | ||||||||||||||||||||||||
| 464 | { | - | ||||||||||||||||||||||||
| 465 | if (!reply->request().isFollowRedirects()
| 3-6 | ||||||||||||||||||||||||
| 466 | return executed 3 times by 1 test: QUrl();return QUrl();Executed by:
executed 3 times by 1 test: return QUrl();Executed by:
| 3 | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | QUrl rUrl; | - | ||||||||||||||||||||||||
| 469 | const QList<QPair<QByteArray, QByteArray> > fields = reply->header(); | - | ||||||||||||||||||||||||
| 470 | for (const QNetworkReply::RawHeaderPair &header : fields) { | - | ||||||||||||||||||||||||
| 471 | if (header.first.toLower() == "location"
| 6 | ||||||||||||||||||||||||
| 472 | rUrl = QUrl::fromEncoded(header.second); | - | ||||||||||||||||||||||||
| 473 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||||||||
| 474 | } | - | ||||||||||||||||||||||||
| 475 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | if (!rUrl.isValid()
| 0-6 | ||||||||||||||||||||||||
| 479 | emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError); | - | ||||||||||||||||||||||||
| 480 | return never executed: QUrl();return QUrl();never executed: return QUrl(); | 0 | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | if (reply->request().redirectCount() <= 0
| 1-5 | ||||||||||||||||||||||||
| 485 | emitReplyError(socket, reply, QNetworkReply::TooManyRedirectsError); | - | ||||||||||||||||||||||||
| 486 | return executed 1 time by 1 test: QUrl();return QUrl();Executed by:
executed 1 time by 1 test: return QUrl();Executed by:
| 1 | ||||||||||||||||||||||||
| 487 | } | - | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||
| 490 | if (rUrl.isRelative()
| 0-5 | ||||||||||||||||||||||||
| 491 | rUrl = reply->request().url().resolved(rUrl); never executed: rUrl = reply->request().url().resolved(rUrl); | 0 | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | QString scheme = rUrl.scheme(); | - | ||||||||||||||||||||||||
| 495 | if (scheme == QLatin1String("http")
| 0-5 | ||||||||||||||||||||||||
| 496 | QString previousUrlScheme = reply->request().url().scheme(); | - | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | if (previousUrlScheme == QLatin1String("https")
| 0-5 | ||||||||||||||||||||||||
| 499 | && scheme == QLatin1String("http")
| 0 | ||||||||||||||||||||||||
| 500 | emitReplyError(socket, reply, QNetworkReply::InsecureRedirectError); | - | ||||||||||||||||||||||||
| 501 | return never executed: QUrl();return QUrl();never executed: return QUrl(); | 0 | ||||||||||||||||||||||||
| 502 | } | - | ||||||||||||||||||||||||
| 503 | } executed 5 times by 1 test: else {end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 504 | emitReplyError(socket, reply, QNetworkReply::ProtocolUnknownError); | - | ||||||||||||||||||||||||
| 505 | return never executed: QUrl();return QUrl();never executed: return QUrl(); | 0 | ||||||||||||||||||||||||
| 506 | } | - | ||||||||||||||||||||||||
| 507 | return executed 5 times by 1 test: rUrl;return rUrl;Executed by:
executed 5 times by 1 test: return rUrl;Executed by:
| 5 | ||||||||||||||||||||||||
| 508 | } | - | ||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request) | - | ||||||||||||||||||||||||
| 511 | { | - | ||||||||||||||||||||||||
| 512 | ((!(socket)) ? qt_assert("socket",__FILE__,567) : qt_noop()); | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | int i = indexOf(socket); | - | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | if (channels[i].authMethod != QAuthenticatorPrivate::None
| 172-1149 | ||||||||||||||||||||||||
| 518 | if ((channels[i].authMethod != QAuthenticatorPrivate::Ntlm
| 0-172 | ||||||||||||||||||||||||
| 519 | QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator); | - | ||||||||||||||||||||||||
| 520 | if (priv
| 0-172 | ||||||||||||||||||||||||
| 521 | QByteArray response = priv->calculateResponse(request.methodName(), request.uri(false)); | - | ||||||||||||||||||||||||
| 522 | request.setHeaderField("Authorization", response); | - | ||||||||||||||||||||||||
| 523 | channels[i].authenticationCredentialsSent = true; | - | ||||||||||||||||||||||||
| 524 | } executed 152 times by 2 tests: end of blockExecuted by:
| 152 | ||||||||||||||||||||||||
| 525 | } executed 172 times by 2 tests: end of blockExecuted by:
| 172 | ||||||||||||||||||||||||
| 526 | } executed 172 times by 2 tests: end of blockExecuted by:
| 172 | ||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||
| 529 | if (channels[i].proxyAuthMethod != QAuthenticatorPrivate::None
| 40-1281 | ||||||||||||||||||||||||
| 530 | if (!(channels[i].proxyAuthMethod == QAuthenticatorPrivate::Ntlm
| 0-40 | ||||||||||||||||||||||||
| 531 | QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].proxyAuthenticator); | - | ||||||||||||||||||||||||
| 532 | if (priv
| 0-40 | ||||||||||||||||||||||||
| 533 | QByteArray response = priv->calculateResponse(request.methodName(), request.uri(false)); | - | ||||||||||||||||||||||||
| 534 | request.setHeaderField("Proxy-Authorization", response); | - | ||||||||||||||||||||||||
| 535 | channels[i].proxyCredentialsSent = true; | - | ||||||||||||||||||||||||
| 536 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||
| 537 | } executed 40 times by 1 test: end of blockExecuted by:
| 40 | ||||||||||||||||||||||||
| 538 | } executed 40 times by 1 test: end of blockExecuted by:
| 40 | ||||||||||||||||||||||||
| 539 | } executed 1321 times by 8 tests: end of blockExecuted by:
| 1321 | ||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetworkRequest &request) | - | ||||||||||||||||||||||||
| 542 | { | - | ||||||||||||||||||||||||
| 543 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | QHttpNetworkReply *reply = new QHttpNetworkReply(request.url()); | - | ||||||||||||||||||||||||
| 547 | reply->setRequest(request); | - | ||||||||||||||||||||||||
| 548 | reply->d_func()->connection = q; | - | ||||||||||||||||||||||||
| 549 | reply->d_func()->connectionChannel = &channels[0]; | - | ||||||||||||||||||||||||
| 550 | HttpMessagePair pair = qMakePair(request, reply); | - | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | if (request.isPreConnect()
| 0-1646 | ||||||||||||||||||||||||
| 553 | preConnectRequests++; never executed: preConnectRequests++; | 0 | ||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||
| 555 | if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP
| 112-1534 | ||||||||||||||||||||||||
| 556 | switch (request.priority()) { | - | ||||||||||||||||||||||||
| 557 | case executed 116 times by 1 test: QHttpNetworkRequest::HighPriority:case QHttpNetworkRequest::HighPriority:Executed by:
executed 116 times by 1 test: case QHttpNetworkRequest::HighPriority:Executed by:
| 116 | ||||||||||||||||||||||||
| 558 | highPriorityQueue.prepend(pair); | - | ||||||||||||||||||||||||
| 559 | break; executed 116 times by 1 test: break;Executed by:
| 116 | ||||||||||||||||||||||||
| 560 | case executed 1362 times by 8 tests: QHttpNetworkRequest::NormalPriority:case QHttpNetworkRequest::NormalPriority:Executed by:
executed 1362 times by 8 tests: case QHttpNetworkRequest::NormalPriority:Executed by:
| 1362 | ||||||||||||||||||||||||
| 561 | case executed 56 times by 1 test: QHttpNetworkRequest::LowPriority:case QHttpNetworkRequest::LowPriority:Executed by:
executed 56 times by 1 test: case QHttpNetworkRequest::LowPriority:Executed by:
| 56 | ||||||||||||||||||||||||
| 562 | lowPriorityQueue.prepend(pair); | - | ||||||||||||||||||||||||
| 563 | break; executed 1418 times by 8 tests: break;Executed by:
| 1418 | ||||||||||||||||||||||||
| 564 | } | - | ||||||||||||||||||||||||
| 565 | } executed 1534 times by 8 tests: end of blockExecuted by:
| 1534 | ||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||
| 567 | else { | - | ||||||||||||||||||||||||
| 568 | if (!pair.second->d_func()->requestIsPrepared
| 0-112 | ||||||||||||||||||||||||
| 569 | prepareRequest(pair); executed 112 times by 1 test: prepareRequest(pair);Executed by:
| 112 | ||||||||||||||||||||||||
| 570 | channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair); | - | ||||||||||||||||||||||||
| 571 | } executed 112 times by 1 test: end of blockExecuted by:
| 112 | ||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | if (networkLayerState == Unknown
| 0-1063 | ||||||||||||||||||||||||
| 579 | startHostInfoLookup(); | - | ||||||||||||||||||||||||
| 580 | } executed 583 times by 8 tests: else if ( networkLayerState == IPv4end of blockExecuted by:
| 0-1061 | ||||||||||||||||||||||||
| 581 | _q_startNextRequest(); | - | ||||||||||||||||||||||||
| 582 | } executed 1061 times by 4 tests: end of blockExecuted by:
| 1061 | ||||||||||||||||||||||||
| 583 | return executed 1646 times by 8 tests: reply;return reply;Executed by:
executed 1646 times by 8 tests: return reply;Executed by:
| 1646 | ||||||||||||||||||||||||
| 584 | } | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) | - | ||||||||||||||||||||||||
| 587 | { | - | ||||||||||||||||||||||||
| 588 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | QHttpNetworkRequest request = pair.first; | - | ||||||||||||||||||||||||
| 591 | switch (request.priority()) { | - | ||||||||||||||||||||||||
| 592 | case never executed: QHttpNetworkRequest::HighPriority:case QHttpNetworkRequest::HighPriority:never executed: case QHttpNetworkRequest::HighPriority: | 0 | ||||||||||||||||||||||||
| 593 | highPriorityQueue.prepend(pair); | - | ||||||||||||||||||||||||
| 594 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 595 | case never executed: QHttpNetworkRequest::NormalPriority:case QHttpNetworkRequest::NormalPriority:never executed: case QHttpNetworkRequest::NormalPriority: | 0 | ||||||||||||||||||||||||
| 596 | case never executed: QHttpNetworkRequest::LowPriority:case QHttpNetworkRequest::LowPriority:never executed: case QHttpNetworkRequest::LowPriority: | 0 | ||||||||||||||||||||||||
| 597 | lowPriorityQueue.prepend(pair); | - | ||||||||||||||||||||||||
| 598 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 599 | } | - | ||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||
| 601 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 602 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket) | - | ||||||||||||||||||||||||
| 605 | { | - | ||||||||||||||||||||||||
| 606 | int i = 0; | - | ||||||||||||||||||||||||
| 607 | if (socket
| 4-1151 | ||||||||||||||||||||||||
| 608 | i = indexOf(socket); executed 1151 times by 8 tests: i = indexOf(socket);Executed by:
| 1151 | ||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | if (!highPriorityQueue.isEmpty()
| 54-1101 | ||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | HttpMessagePair messagePair = highPriorityQueue.takeLast(); | - | ||||||||||||||||||||||||
| 613 | if (!messagePair.second->d_func()->requestIsPrepared
| 0-54 | ||||||||||||||||||||||||
| 614 | prepareRequest(messagePair); executed 54 times by 1 test: prepareRequest(messagePair);Executed by:
| 54 | ||||||||||||||||||||||||
| 615 | updateChannel(i, messagePair); | - | ||||||||||||||||||||||||
| 616 | return executed 54 times by 1 test: true;return true;Executed by:
executed 54 times by 1 test: return true;Executed by:
| 54 | ||||||||||||||||||||||||
| 617 | } | - | ||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||
| 619 | if (!lowPriorityQueue.isEmpty()
| 32-1069 | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | HttpMessagePair messagePair = lowPriorityQueue.takeLast(); | - | ||||||||||||||||||||||||
| 622 | if (!messagePair.second->d_func()->requestIsPrepared
| 0-1069 | ||||||||||||||||||||||||
| 623 | prepareRequest(messagePair); executed 1069 times by 8 tests: prepareRequest(messagePair);Executed by:
| 1069 | ||||||||||||||||||||||||
| 624 | updateChannel(i, messagePair); | - | ||||||||||||||||||||||||
| 625 | return executed 1069 times by 8 tests: true;return true;Executed by:
executed 1069 times by 8 tests: return true;Executed by:
| 1069 | ||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||
| 627 | return executed 32 times by 3 tests: false;return false;Executed by:
executed 32 times by 3 tests: return false;Executed by:
| 32 | ||||||||||||||||||||||||
| 628 | } | - | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 | void QHttpNetworkConnectionPrivate::updateChannel(int i, const HttpMessagePair &messagePair) | - | ||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||
| 632 | channels[i].request = messagePair.first; | - | ||||||||||||||||||||||||
| 633 | channels[i].reply = messagePair.second; | - | ||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | channels[i].reply->d_func()->connectionChannel = &channels[i]; | - | ||||||||||||||||||||||||
| 637 | } executed 1123 times by 8 tests: end of blockExecuted by:
| 1123 | ||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||
| 639 | QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest() const | - | ||||||||||||||||||||||||
| 640 | { | - | ||||||||||||||||||||||||
| 641 | if (!highPriorityQueue.isEmpty()
| 0-21 | ||||||||||||||||||||||||
| 642 | return never executed: highPriorityQueue.last().first;return highPriorityQueue.last().first;never executed: return highPriorityQueue.last().first; | 0 | ||||||||||||||||||||||||
| 643 | if (!lowPriorityQueue.isEmpty()
| 4-17 | ||||||||||||||||||||||||
| 644 | return executed 17 times by 1 test: lowPriorityQueue.last().first;return lowPriorityQueue.last().first;Executed by:
executed 17 times by 1 test: return lowPriorityQueue.last().first;Executed by:
| 17 | ||||||||||||||||||||||||
| 645 | return executed 4 times by 1 test: QHttpNetworkRequest();return QHttpNetworkRequest();Executed by:
executed 4 times by 1 test: return QHttpNetworkRequest();Executed by:
| 4 | ||||||||||||||||||||||||
| 646 | } | - | ||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket) | - | ||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | if (highPriorityQueue.isEmpty()
| 35-3929 | ||||||||||||||||||||||||
| 653 | return; executed 35 times by 2 tests: return;Executed by:
| 35 | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | int i = indexOf(socket); | - | ||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||
| 658 | if (channels[i].reply == 0
| 33-4219 | ||||||||||||||||||||||||
| 659 | return; executed 33 times by 1 test: return;Executed by:
| 33 | ||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= defaultRePipelineLength)
| 1034-3185 | ||||||||||||||||||||||||
| 662 | return; executed 1034 times by 2 tests: return;Executed by:
| 1034 | ||||||||||||||||||||||||
| 663 | } | - | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported
| 316-2869 | ||||||||||||||||||||||||
| 666 | return; executed 316 times by 2 tests: return;Executed by:
| 316 | ||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | if (!channels[i].request.isPipeliningAllowed()
| 270-2599 | ||||||||||||||||||||||||
| 670 | return; executed 2599 times by 2 tests: return;Executed by:
| 2599 | ||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||
| 673 | if (channels[i].request.operation() != QHttpNetworkRequest::Get
| 64-206 | ||||||||||||||||||||||||
| 674 | return; executed 64 times by 1 test: return;Executed by:
| 64 | ||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||
| 676 | - | |||||||||||||||||||||||||
| 677 | if (socket->state() != QAbstractSocket::ConnectedState
| 0-206 | ||||||||||||||||||||||||
| 678 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | if (channels[i].resendCurrent
| 0-206 | ||||||||||||||||||||||||
| 682 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | if (!channels[i].authenticator.isNull()
| 0-206 | ||||||||||||||||||||||||
| 687 | && (!channels[i].authenticator.user().isEmpty()
| 0-206 | ||||||||||||||||||||||||
| 688 | || !channels[i].authenticator.password().isEmpty()
| 0-206 | ||||||||||||||||||||||||
| 689 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 690 | if (!channels[i].proxyAuthenticator.isNull()
| 0-206 | ||||||||||||||||||||||||
| 691 | && (!channels[i].proxyAuthenticator.user().isEmpty()
| 0-206 | ||||||||||||||||||||||||
| 692 | || !channels[i].proxyAuthenticator.password().isEmpty()
| 0-206 | ||||||||||||||||||||||||
| 693 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 | if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState
| 16-190 | ||||||||||||||||||||||||
| 697 | || channels[i].state == QHttpNetworkConnectionChannel::ReadingState
| 0-190 | ||||||||||||||||||||||||
| 698 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | int lengthBefore; | - | ||||||||||||||||||||||||
| 701 | while (!highPriorityQueue.isEmpty()
| 62-176 | ||||||||||||||||||||||||
| 702 | lengthBefore = channels[i].alreadyPipelinedRequests.length(); | - | ||||||||||||||||||||||||
| 703 | fillPipeline(highPriorityQueue, channels[i]); | - | ||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||
| 705 | if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength
| 30-32 | ||||||||||||||||||||||||
| 706 | channels[i].pipelineFlush(); | - | ||||||||||||||||||||||||
| 707 | return; executed 30 times by 1 test: return;Executed by:
| 30 | ||||||||||||||||||||||||
| 708 | } | - | ||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | if (lengthBefore == channels[i].alreadyPipelinedRequests.length()
| 0-32 | ||||||||||||||||||||||||
| 711 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 712 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||
| 714 | while (!lowPriorityQueue.isEmpty()
| 3-351 | ||||||||||||||||||||||||
| 715 | lengthBefore = channels[i].alreadyPipelinedRequests.length(); | - | ||||||||||||||||||||||||
| 716 | fillPipeline(lowPriorityQueue, channels[i]); | - | ||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength
| 162-189 | ||||||||||||||||||||||||
| 719 | channels[i].pipelineFlush(); | - | ||||||||||||||||||||||||
| 720 | return; executed 162 times by 2 tests: return;Executed by:
| 162 | ||||||||||||||||||||||||
| 721 | } | - | ||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||
| 723 | if (lengthBefore == channels[i].alreadyPipelinedRequests.length()
| 11-178 | ||||||||||||||||||||||||
| 724 | break; executed 11 times by 1 test: break;Executed by:
| 11 | ||||||||||||||||||||||||
| 725 | } executed 178 times by 2 tests: end of blockExecuted by:
| 178 | ||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | channels[i].pipelineFlush(); | - | ||||||||||||||||||||||||
| 729 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue, QHttpNetworkConnectionChannel &channel) | - | ||||||||||||||||||||||||
| 733 | { | - | ||||||||||||||||||||||||
| 734 | if (queue.isEmpty()
| 0-413 | ||||||||||||||||||||||||
| 735 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | for (int i = queue.count() - 1; i >= 0
| 11-772 | ||||||||||||||||||||||||
| 738 | HttpMessagePair messagePair = queue.at(i); | - | ||||||||||||||||||||||||
| 739 | const QHttpNetworkRequest &request = messagePair.first; | - | ||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||
| 742 | if (!request.url().userInfo().isEmpty()
| 0-772 | ||||||||||||||||||||||||
| 743 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | if (request.operation() != QHttpNetworkRequest::Get
| 370-402 | ||||||||||||||||||||||||
| 747 | continue; executed 370 times by 1 test: continue;Executed by:
| 370 | ||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | if (!request.isPipeliningAllowed()
| 0-402 | ||||||||||||||||||||||||
| 750 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||
| 753 | queue.takeAt(i); | - | ||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | if (!messagePair.second->d_func()->requestIsPrepared
| 0-402 | ||||||||||||||||||||||||
| 759 | prepareRequest(messagePair); executed 402 times by 2 tests: prepareRequest(messagePair);Executed by:
| 402 | ||||||||||||||||||||||||
| 760 | channel.pipelineInto(messagePair); | - | ||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | return executed 402 times by 2 tests: false;return false;Executed by:
executed 402 times by 2 tests: return false;Executed by:
| 402 | ||||||||||||||||||||||||
| 764 | } | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | return executed 11 times by 1 test: true;return true;Executed by:
executed 11 times by 1 test: return true;Executed by:
| 11 | ||||||||||||||||||||||||
| 768 | } | - | ||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||
| 771 | QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail) | - | ||||||||||||||||||||||||
| 772 | { | - | ||||||||||||||||||||||||
| 773 | QString errorString; | - | ||||||||||||||||||||||||
| 774 | switch (errorCode) { | - | ||||||||||||||||||||||||
| 775 | case executed 6 times by 3 tests: QNetworkReply::HostNotFoundError:case QNetworkReply::HostNotFoundError:Executed by:
executed 6 times by 3 tests: case QNetworkReply::HostNotFoundError:Executed by:
| 6 | ||||||||||||||||||||||||
| 776 | if (socket
| 2-4 | ||||||||||||||||||||||||
| 777 | errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName()); executed 2 times by 1 test: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());Executed by:
| 2 | ||||||||||||||||||||||||
| 778 | else | - | ||||||||||||||||||||||||
| 779 | errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName); executed 4 times by 3 tests: errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);Executed by:
| 4 | ||||||||||||||||||||||||
| 780 | break; executed 6 times by 3 tests: break;Executed by:
| 6 | ||||||||||||||||||||||||
| 781 | case executed 124 times by 2 tests: QNetworkReply::ConnectionRefusedError:case QNetworkReply::ConnectionRefusedError:Executed by:
executed 124 times by 2 tests: case QNetworkReply::ConnectionRefusedError:Executed by:
| 124 | ||||||||||||||||||||||||
| 782 | errorString = QCoreApplication::translate("QHttp", "Connection refused"); | - | ||||||||||||||||||||||||
| 783 | break; executed 124 times by 2 tests: break;Executed by:
| 124 | ||||||||||||||||||||||||
| 784 | case executed 35 times by 3 tests: QNetworkReply::RemoteHostClosedError:case QNetworkReply::RemoteHostClosedError:Executed by:
executed 35 times by 3 tests: case QNetworkReply::RemoteHostClosedError:Executed by:
| 35 | ||||||||||||||||||||||||
| 785 | errorString = QCoreApplication::translate("QHttp", "Connection closed"); | - | ||||||||||||||||||||||||
| 786 | break; executed 35 times by 3 tests: break;Executed by:
| 35 | ||||||||||||||||||||||||
| 787 | case never executed: QNetworkReply::TimeoutError:case QNetworkReply::TimeoutError:never executed: case QNetworkReply::TimeoutError: | 0 | ||||||||||||||||||||||||
| 788 | errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out"); | - | ||||||||||||||||||||||||
| 789 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 790 | case executed 9 times by 2 tests: QNetworkReply::ProxyAuthenticationRequiredError:case QNetworkReply::ProxyAuthenticationRequiredError:Executed by:
executed 9 times by 2 tests: case QNetworkReply::ProxyAuthenticationRequiredError:Executed by:
| 9 | ||||||||||||||||||||||||
| 791 | errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication"); | - | ||||||||||||||||||||||||
| 792 | break; executed 9 times by 2 tests: break;Executed by:
| 9 | ||||||||||||||||||||||||
| 793 | case executed 37 times by 2 tests: QNetworkReply::AuthenticationRequiredError:case QNetworkReply::AuthenticationRequiredError:Executed by:
executed 37 times by 2 tests: case QNetworkReply::AuthenticationRequiredError:Executed by:
| 37 | ||||||||||||||||||||||||
| 794 | errorString = QCoreApplication::translate("QHttp", "Host requires authentication"); | - | ||||||||||||||||||||||||
| 795 | break; executed 37 times by 2 tests: break;Executed by:
| 37 | ||||||||||||||||||||||||
| 796 | case executed 1 time by 1 test: QNetworkReply::ProtocolFailure:case QNetworkReply::ProtocolFailure:Executed by:
executed 1 time by 1 test: case QNetworkReply::ProtocolFailure:Executed by:
| 1 | ||||||||||||||||||||||||
| 797 | errorString = QCoreApplication::translate("QHttp", "Data corrupted"); | - | ||||||||||||||||||||||||
| 798 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 799 | case never executed: QNetworkReply::ProtocolUnknownError:case QNetworkReply::ProtocolUnknownError:never executed: case QNetworkReply::ProtocolUnknownError: | 0 | ||||||||||||||||||||||||
| 800 | errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified"); | - | ||||||||||||||||||||||||
| 801 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 802 | case executed 12 times by 3 tests: QNetworkReply::SslHandshakeFailedError:case QNetworkReply::SslHandshakeFailedError:Executed by:
executed 12 times by 3 tests: case QNetworkReply::SslHandshakeFailedError:Executed by:
| 12 | ||||||||||||||||||||||||
| 803 | errorString = QCoreApplication::translate("QHttp", "SSL handshake failed"); | - | ||||||||||||||||||||||||
| 804 | break; executed 12 times by 3 tests: break;Executed by:
| 12 | ||||||||||||||||||||||||
| 805 | case executed 1 time by 1 test: QNetworkReply::TooManyRedirectsError:case QNetworkReply::TooManyRedirectsError:Executed by:
executed 1 time by 1 test: case QNetworkReply::TooManyRedirectsError:Executed by:
| 1 | ||||||||||||||||||||||||
| 806 | errorString = QCoreApplication::translate("QHttp", "Too many redirects"); | - | ||||||||||||||||||||||||
| 807 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 808 | case never executed: QNetworkReply::InsecureRedirectError:case QNetworkReply::InsecureRedirectError:never executed: case QNetworkReply::InsecureRedirectError: | 0 | ||||||||||||||||||||||||
| 809 | errorString = QCoreApplication::translate("QHttp", "Insecure redirect"); | - | ||||||||||||||||||||||||
| 810 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 811 | default executed 4 times by 2 tests: :default:Executed by:
executed 4 times by 2 tests: default:Executed by:
| 4 | ||||||||||||||||||||||||
| 812 | - | |||||||||||||||||||||||||
| 813 | errorString = extraDetail; | - | ||||||||||||||||||||||||
| 814 | break; executed 4 times by 2 tests: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 815 | } | - | ||||||||||||||||||||||||
| 816 | return executed 229 times by 4 tests: errorString;return errorString;Executed by:
executed 229 times by 4 tests: return errorString;Executed by:
| 229 | ||||||||||||||||||||||||
| 817 | } | - | ||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||
| 821 | void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) | - | ||||||||||||||||||||||||
| 822 | { | - | ||||||||||||||||||||||||
| 823 | QHttpNetworkConnection * const q = q_func(); | - | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||
| 826 | for (int i = 0; i < channelCount
| 1537-6232 | ||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||
| 828 | if (channels[i].reply == reply
| 25-6207 | ||||||||||||||||||||||||
| 829 | channels[i].reply = 0; | - | ||||||||||||||||||||||||
| 830 | if (channels[i].protocolHandler
| 0-25 | ||||||||||||||||||||||||
| 831 | channels[i].protocolHandler->setReply(0); executed 25 times by 3 tests: channels[i].protocolHandler->setReply(0);Executed by:
| 25 | ||||||||||||||||||||||||
| 832 | channels[i].request = QHttpNetworkRequest(); | - | ||||||||||||||||||||||||
| 833 | channels[i].resendCurrent = false; | - | ||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||
| 835 | if (!reply->isFinished()
| 0-19 | ||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | channels[i].requeueCurrentlyPipelinedRequests(); | - | ||||||||||||||||||||||||
| 839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | - | |||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||
| 843 | - | |||||||||||||||||||||||||
| 844 | if (reply->d_func()->isConnectionCloseEnabled()
| 0-20 | ||||||||||||||||||||||||
| 845 | if (reply->isAborted()
| 12-13 | ||||||||||||||||||||||||
| 846 | channels[i].abort(); | - | ||||||||||||||||||||||||
| 847 | } executed 13 times by 1 test: else {end of blockExecuted by:
| 13 | ||||||||||||||||||||||||
| 848 | channels[i].close(); | - | ||||||||||||||||||||||||
| 849 | } executed 11 times by 3 tests: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 850 | } | - | ||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||
| 852 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 853 | return; executed 24 times by 3 tests: return;Executed by:
| 24 | ||||||||||||||||||||||||
| 854 | } | - | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | - | |||||||||||||||||||||||||
| 857 | for (int j = 0; j < channels[i].alreadyPipelinedRequests.length()
| 105-6207 | ||||||||||||||||||||||||
| 858 | if (channels[i].alreadyPipelinedRequests.at(j).second == reply
| 0-105 | ||||||||||||||||||||||||
| 859 | - | |||||||||||||||||||||||||
| 860 | channels[i].alreadyPipelinedRequests.removeAt(j); | - | ||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | channels[i].requeueCurrentlyPipelinedRequests(); | - | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | - | |||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | if (channels[i].reply
| 0 | ||||||||||||||||||||||||
| 869 | channels[i].reply->d_func()->forceConnectionCloseEnabled = true; never executed: channels[i].reply->d_func()->forceConnectionCloseEnabled = true; | 0 | ||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||
| 871 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 872 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 873 | } | - | ||||||||||||||||||||||||
| 874 | } executed 105 times by 1 test: end of blockExecuted by:
| 105 | ||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||
| 877 | QMultiMap<int, HttpMessagePair>::iterator it = channels[i].spdyRequestsToSend.begin(); | - | ||||||||||||||||||||||||
| 878 | QMultiMap<int, HttpMessagePair>::iterator end = channels[i].spdyRequestsToSend.end(); | - | ||||||||||||||||||||||||
| 879 | for (; it != end
| 5-6202 | ||||||||||||||||||||||||
| 880 | if (it.value().second == reply
| 0-5 | ||||||||||||||||||||||||
| 881 | channels[i].spdyRequestsToSend.remove(it.key()); | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 884 | return; executed 5 times by 1 test: return;Executed by:
| 5 | ||||||||||||||||||||||||
| 885 | } | - | ||||||||||||||||||||||||
| 886 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | } executed 6202 times by 7 tests: end of blockExecuted by:
| 6202 | ||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||
| 890 | if (!highPriorityQueue.isEmpty()
| 0-1537 | ||||||||||||||||||||||||
| 891 | for (int j = highPriorityQueue.count() - 1; j >= 0
| 0 | ||||||||||||||||||||||||
| 892 | HttpMessagePair messagePair = highPriorityQueue.at(j); | - | ||||||||||||||||||||||||
| 893 | if (messagePair.second == reply
| 0 | ||||||||||||||||||||||||
| 894 | highPriorityQueue.removeAt(j); | - | ||||||||||||||||||||||||
| 895 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 896 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 897 | } | - | ||||||||||||||||||||||||
| 898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||
| 901 | if (!lowPriorityQueue.isEmpty()
| 90-1447 | ||||||||||||||||||||||||
| 902 | for (int j = lowPriorityQueue.count() - 1; j >= 0
| 83-437 | ||||||||||||||||||||||||
| 903 | HttpMessagePair messagePair = lowPriorityQueue.at(j); | - | ||||||||||||||||||||||||
| 904 | if (messagePair.second == reply
| 7-430 | ||||||||||||||||||||||||
| 905 | lowPriorityQueue.removeAt(j); | - | ||||||||||||||||||||||||
| 906 | QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 907 | return; executed 7 times by 1 test: return;Executed by:
| 7 | ||||||||||||||||||||||||
| 908 | } | - | ||||||||||||||||||||||||
| 909 | } executed 430 times by 2 tests: end of blockExecuted by:
| 430 | ||||||||||||||||||||||||
| 910 | } executed 83 times by 2 tests: end of blockExecuted by:
| 83 | ||||||||||||||||||||||||
| 911 | } executed 1530 times by 7 tests: end of blockExecuted by:
| 1530 | ||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||
| 918 | void QHttpNetworkConnectionPrivate::_q_startNextRequest() | - | ||||||||||||||||||||||||
| 919 | { | - | ||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | if (networkLayerState == Unknown
| 0-5341 | ||||||||||||||||||||||||
| 922 | return; executed 5 times by 3 tests: return;Executed by:
| 5 | ||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | if (state == PausedState
| 0-5339 | ||||||||||||||||||||||||
| 926 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | for (int i = 0; i < channelCount
| 5339-25349 | ||||||||||||||||||||||||
| 930 | if (channels[i].resendCurrent
| 0-25108 | ||||||||||||||||||||||||
| 931 | channels[i].resendCurrent = false; | - | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||
| 934 | if (!channels[i].resetUploadData()
| 9-232 | ||||||||||||||||||||||||
| 935 | continue; executed 9 times by 2 tests: continue;Executed by:
| 9 | ||||||||||||||||||||||||
| 936 | channels[i].sendRequest(); | - | ||||||||||||||||||||||||
| 937 | } executed 232 times by 2 tests: end of blockExecuted by:
| 232 | ||||||||||||||||||||||||
| 938 | } executed 25340 times by 8 tests: end of blockExecuted by:
| 25340 | ||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||
| 942 | switch (connectionType) { | - | ||||||||||||||||||||||||
| 943 | case executed 5214 times by 8 tests: QHttpNetworkConnection::ConnectionTypeHTTP:case QHttpNetworkConnection::ConnectionTypeHTTP:Executed by:
executed 5214 times by 8 tests: {case QHttpNetworkConnection::ConnectionTypeHTTP:Executed by:
| 5214 | ||||||||||||||||||||||||
| 944 | - | |||||||||||||||||||||||||
| 945 | if (highPriorityQueue.isEmpty()
| 352-4862 | ||||||||||||||||||||||||
| 946 | return; executed 2551 times by 7 tests: return;Executed by:
| 2551 | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 | for (int i = 0; i < channelCount
| 2663-10056 | ||||||||||||||||||||||||
| 950 | if (channels[i].socket
| 3635-6421 | ||||||||||||||||||||||||
| 951 | if (!channels[i].reply
| 56-3587 | ||||||||||||||||||||||||
| 952 | if (dequeueRequest(channels[i].socket)
| 13-461 | ||||||||||||||||||||||||
| 953 | channels[i].sendRequest(); executed 461 times by 4 tests: channels[i].sendRequest();Executed by:
| 461 | ||||||||||||||||||||||||
| 954 | } executed 474 times by 4 tests: end of blockExecuted by:
| 474 | ||||||||||||||||||||||||
| 955 | } executed 6421 times by 4 tests: end of blockExecuted by:
| 6421 | ||||||||||||||||||||||||
| 956 | } executed 10056 times by 7 tests: end of blockExecuted by:
| 10056 | ||||||||||||||||||||||||
| 957 | break; executed 2663 times by 7 tests: break;Executed by:
| 2663 | ||||||||||||||||||||||||
| 958 | } | - | ||||||||||||||||||||||||
| 959 | case executed 125 times by 1 test: QHttpNetworkConnection::ConnectionTypeSPDY:case QHttpNetworkConnection::ConnectionTypeSPDY:Executed by:
executed 125 times by 1 test: {case QHttpNetworkConnection::ConnectionTypeSPDY:Executed by:
| 125 | ||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||
| 961 | if (channels[0].spdyRequestsToSend.isEmpty()
| 6-119 | ||||||||||||||||||||||||
| 962 | return; executed 6 times by 1 test: return;Executed by:
| 6 | ||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||
| 964 | if (networkLayerState == IPv4
| 0-119 | ||||||||||||||||||||||||
| 965 | channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol; executed 119 times by 1 test: channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;Executed by:
| 119 | ||||||||||||||||||||||||
| 966 | else if (networkLayerState == IPv6
| 0 | ||||||||||||||||||||||||
| 967 | channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol; never executed: channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol; | 0 | ||||||||||||||||||||||||
| 968 | channels[0].ensureConnection(); | - | ||||||||||||||||||||||||
| 969 | if (channels[0].socket
| 0-119 | ||||||||||||||||||||||||
| 970 | && !channels[0].pendingEncrypt
| 0-107 | ||||||||||||||||||||||||
| 971 | channels[0].sendRequest(); executed 107 times by 1 test: channels[0].sendRequest();Executed by:
| 107 | ||||||||||||||||||||||||
| 972 | - | |||||||||||||||||||||||||
| 973 | break; executed 119 times by 1 test: break;Executed by:
| 119 | ||||||||||||||||||||||||
| 974 | } | - | ||||||||||||||||||||||||
| 975 | } | - | ||||||||||||||||||||||||
| 976 | if (highPriorityQueue.isEmpty()
| 192-2431 | ||||||||||||||||||||||||
| 977 | return; executed 192 times by 4 tests: return;Executed by:
| 192 | ||||||||||||||||||||||||
| 978 | for (int i = 0; i < channelCount
| 2590-9631 | ||||||||||||||||||||||||
| 979 | if (channels[i].socket
| 2418-6303 | ||||||||||||||||||||||||
| 980 | fillPipeline(channels[i].socket); executed 3885 times by 2 tests: fillPipeline(channels[i].socket);Executed by:
| 3885 | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | int queuedRequests = highPriorityQueue.count() + lowPriorityQueue.count(); | - | ||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||
| 989 | int neededOpenChannels = queuedRequests; | - | ||||||||||||||||||||||||
| 990 | if (preConnectRequests > 0
| 0-2590 | ||||||||||||||||||||||||
| 991 | int normalRequests = queuedRequests - preConnectRequests; | - | ||||||||||||||||||||||||
| 992 | neededOpenChannels = qMax(normalRequests, preConnectRequests); | - | ||||||||||||||||||||||||
| 993 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 994 | for (int i = 0; i < channelCount
| 509-7244 | ||||||||||||||||||||||||
| 995 | bool connectChannel = false; | - | ||||||||||||||||||||||||
| 996 | if (channels[i].socket
| 497-6238 | ||||||||||||||||||||||||
| 997 | if ((
| 2332-3906 | ||||||||||||||||||||||||
| 998 | || (
| 0-3906 | ||||||||||||||||||||||||
| 999 | || channels[i].pendingEncrypt
| 23-3883 | ||||||||||||||||||||||||
| 1000 | neededOpenChannels--; executed 2355 times by 2 tests: neededOpenChannels--;Executed by:
| 2355 | ||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | if (neededOpenChannels <= 0
| 122-6116 | ||||||||||||||||||||||||
| 1003 | break; executed 122 times by 2 tests: break;Executed by:
| 122 | ||||||||||||||||||||||||
| 1004 | if (!channels[i].reply
| 0-3909 | ||||||||||||||||||||||||
| 1005 | connectChannel = true; executed 47 times by 2 tests: connectChannel = true;Executed by:
| 47 | ||||||||||||||||||||||||
| 1006 | } executed 6116 times by 2 tests: else {end of blockExecuted by:
| 6116 | ||||||||||||||||||||||||
| 1007 | connectChannel = true; | - | ||||||||||||||||||||||||
| 1008 | } executed 497 times by 7 tests: end of blockExecuted by:
| 497 | ||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | if (connectChannel
| 544-6069 | ||||||||||||||||||||||||
| 1011 | if (networkLayerState == IPv4
| 1-543 | ||||||||||||||||||||||||
| 1012 | channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol; executed 543 times by 7 tests: channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;Executed by:
| 543 | ||||||||||||||||||||||||
| 1013 | else if (networkLayerState == IPv6
| 0-1 | ||||||||||||||||||||||||
| 1014 | channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol; executed 1 time by 1 test: channels[i].networkLayerPreference = QAbstractSocket::IPv6Protocol;Executed by:
| 1 | ||||||||||||||||||||||||
| 1015 | channels[i].ensureConnection(); | - | ||||||||||||||||||||||||
| 1016 | neededOpenChannels--; | - | ||||||||||||||||||||||||
| 1017 | } executed 544 times by 7 tests: end of blockExecuted by:
| 544 | ||||||||||||||||||||||||
| 1018 | } executed 6613 times by 7 tests: end of blockExecuted by:
| 6613 | ||||||||||||||||||||||||
| 1019 | } executed 2590 times by 7 tests: end of blockExecuted by:
| 2590 | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply) | - | ||||||||||||||||||||||||
| 1023 | { | - | ||||||||||||||||||||||||
| 1024 | for (int i = 0 ; i < channelCount
| 16-289 | ||||||||||||||||||||||||
| 1025 | if (channels[i].reply == reply
| 96-193 | ||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 1028 | return; executed 193 times by 1 test: return;Executed by:
| 193 | ||||||||||||||||||||||||
| 1029 | } | - | ||||||||||||||||||||||||
| 1030 | } executed 96 times by 2 tests: end of blockExecuted by:
| 96 | ||||||||||||||||||||||||
| 1031 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | - | |||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||
| 1039 | void QHttpNetworkConnectionPrivate::startHostInfoLookup() | - | ||||||||||||||||||||||||
| 1040 | { | - | ||||||||||||||||||||||||
| 1041 | networkLayerState = HostLookupPending; | - | ||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||
| 1043 | - | |||||||||||||||||||||||||
| 1044 | QString lookupHost = hostName; | - | ||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||
| 1046 | if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability
| 44-539 | ||||||||||||||||||||||||
| 1047 | lookupHost = networkProxy.hostName(); | - | ||||||||||||||||||||||||
| 1048 | } executed 44 times by 1 test: else if (channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapabilityend of blockExecuted by:
| 44-481 | ||||||||||||||||||||||||
| 1049 | lookupHost = channels[0].proxy.hostName(); | - | ||||||||||||||||||||||||
| 1050 | } executed 58 times by 2 tests: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | QHostAddress temp; | - | ||||||||||||||||||||||||
| 1053 | if (temp.setAddress(lookupHost)
| 108-475 | ||||||||||||||||||||||||
| 1054 | const QAbstractSocket::NetworkLayerProtocol protocol = temp.protocol(); | - | ||||||||||||||||||||||||
| 1055 | if (protocol == QAbstractSocket::IPv4Protocol
| 1-107 | ||||||||||||||||||||||||
| 1056 | networkLayerState = QHttpNetworkConnectionPrivate::IPv4; | - | ||||||||||||||||||||||||
| 1057 | QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 1058 | return; executed 107 times by 5 tests: return;Executed by:
| 107 | ||||||||||||||||||||||||
| 1059 | } else if (protocol == QAbstractSocket::IPv6Protocol
| 0-1 | ||||||||||||||||||||||||
| 1060 | networkLayerState = QHttpNetworkConnectionPrivate::IPv6; | - | ||||||||||||||||||||||||
| 1061 | QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 1062 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||||||||||||||
| 1063 | } | - | ||||||||||||||||||||||||
| 1064 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1065 | int hostLookupId; | - | ||||||||||||||||||||||||
| 1066 | bool immediateResultValid = false; | - | ||||||||||||||||||||||||
| 1067 | QHostInfo hostInfo = qt_qhostinfo_lookup(lookupHost, | - | ||||||||||||||||||||||||
| 1068 | this->q_func(), | - | ||||||||||||||||||||||||
| 1069 | qFlagLocation("1""_q_hostLookupFinished(QHostInfo)" "\0" __FILE__ ":" "1141"), | - | ||||||||||||||||||||||||
| 1070 | &immediateResultValid, | - | ||||||||||||||||||||||||
| 1071 | &hostLookupId); | - | ||||||||||||||||||||||||
| 1072 | if (immediateResultValid
| 15-460 | ||||||||||||||||||||||||
| 1073 | _q_hostLookupFinished(hostInfo); | - | ||||||||||||||||||||||||
| 1074 | } executed 460 times by 6 tests: end of blockExecuted by:
| 460 | ||||||||||||||||||||||||
| 1075 | } executed 475 times by 7 tests: end of blockExecuted by:
| 475 | ||||||||||||||||||||||||
| 1076 | } | - | ||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||
| 1079 | void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info) | - | ||||||||||||||||||||||||
| 1080 | { | - | ||||||||||||||||||||||||
| 1081 | bool bIpv4 = false; | - | ||||||||||||||||||||||||
| 1082 | bool bIpv6 = false; | - | ||||||||||||||||||||||||
| 1083 | bool foundAddress = false; | - | ||||||||||||||||||||||||
| 1084 | if (networkLayerState == IPv4
| 0-475 | ||||||||||||||||||||||||
| 1085 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||
| 1087 | const auto addresses = info.addresses(); | - | ||||||||||||||||||||||||
| 1088 | for (const QHostAddress &address : addresses) { | - | ||||||||||||||||||||||||
| 1089 | const QAbstractSocket::NetworkLayerProtocol protocol = address.protocol(); | - | ||||||||||||||||||||||||
| 1090 | if (protocol == QAbstractSocket::IPv4Protocol
| 130-475 | ||||||||||||||||||||||||
| 1091 | if (!foundAddress
| 126-349 | ||||||||||||||||||||||||
| 1092 | foundAddress = true; | - | ||||||||||||||||||||||||
| 1093 | delayIpv4 = false; | - | ||||||||||||||||||||||||
| 1094 | } executed 349 times by 6 tests: end of blockExecuted by:
| 349 | ||||||||||||||||||||||||
| 1095 | bIpv4 = true; | - | ||||||||||||||||||||||||
| 1096 | } executed 475 times by 7 tests: else if (protocol == QAbstractSocket::IPv6Protocolend of blockExecuted by:
| 0-475 | ||||||||||||||||||||||||
| 1097 | if (!foundAddress
| 8-122 | ||||||||||||||||||||||||
| 1098 | foundAddress = true; | - | ||||||||||||||||||||||||
| 1099 | delayIpv4 = true; | - | ||||||||||||||||||||||||
| 1100 | } executed 122 times by 2 tests: end of blockExecuted by:
| 122 | ||||||||||||||||||||||||
| 1101 | bIpv6 = true; | - | ||||||||||||||||||||||||
| 1102 | } executed 130 times by 3 tests: end of blockExecuted by:
| 130 | ||||||||||||||||||||||||
| 1103 | } executed 605 times by 7 tests: end of blockExecuted by:
| 605 | ||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||
| 1105 | if (bIpv4
| 4-471 | ||||||||||||||||||||||||
| 1106 | startNetworkLayerStateLookup(); executed 126 times by 3 tests: startNetworkLayerStateLookup();Executed by:
| 126 | ||||||||||||||||||||||||
| 1107 | else if (bIpv4
| 4-345 | ||||||||||||||||||||||||
| 1108 | networkLayerState = QHttpNetworkConnectionPrivate::IPv4; | - | ||||||||||||||||||||||||
| 1109 | QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 1110 | } executed 345 times by 5 tests: else if (bIpv6end of blockExecuted by:
| 0-345 | ||||||||||||||||||||||||
| 1111 | networkLayerState = QHttpNetworkConnectionPrivate::IPv6; | - | ||||||||||||||||||||||||
| 1112 | QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 1113 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1114 | if (dequeueRequest(channels[0].socket)
| 2 | ||||||||||||||||||||||||
| 1115 | emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError); | - | ||||||||||||||||||||||||
| 1116 | networkLayerState = QHttpNetworkConnectionPrivate::Unknown; | - | ||||||||||||||||||||||||
| 1117 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY
| 0-2 | ||||||||||||||||||||||||
| 1120 | for (const HttpMessagePair &spdyPair : qAsConst(channels[0].spdyRequestsToSend)) { | - | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | QHttpNetworkReply *currentReply = spdyPair.second; | - | ||||||||||||||||||||||||
| 1123 | ((!(currentReply)) ? qt_assert("currentReply",__FILE__,1195) : qt_noop()); | - | ||||||||||||||||||||||||
| 1124 | emitReplyError(channels[0].socket, currentReply, QNetworkReply::HostNotFoundError); | - | ||||||||||||||||||||||||
| 1125 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1126 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | else { | - | ||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||
| 1130 | QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).warning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not de-queue request"); | - | ||||||||||||||||||||||||
| 1131 | networkLayerState = QHttpNetworkConnectionPrivate::Unknown; | - | ||||||||||||||||||||||||
| 1132 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1133 | } | - | ||||||||||||||||||||||||
| 1134 | } | - | ||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup() | - | ||||||||||||||||||||||||
| 1142 | { | - | ||||||||||||||||||||||||
| 1143 | if (channelCount > 1
| 0-126 | ||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||
| 1145 | ((!(!channels[0].isSocketBusy())) ? qt_assert("!channels[0].isSocketBusy()",__FILE__,1217) : qt_noop()); | - | ||||||||||||||||||||||||
| 1146 | ((!(!channels[1].isSocketBusy())) ? qt_assert("!channels[1].isSocketBusy()",__FILE__,1218) : qt_noop()); | - | ||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||
| 1148 | networkLayerState = IPv4or6; | - | ||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||
| 1150 | channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol; | - | ||||||||||||||||||||||||
| 1151 | channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol; | - | ||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||
| 1153 | int timeout = 300; | - | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | if (networkSession
| 0-126 | ||||||||||||||||||||||||
| 1156 | const QNetworkConfiguration::BearerType bearerType = networkSession->configuration().bearerType(); | - | ||||||||||||||||||||||||
| 1157 | if (bearerType == QNetworkConfiguration::Bearer2G
| 0-126 | ||||||||||||||||||||||||
| 1158 | timeout = 800; never executed: timeout = 800; | 0 | ||||||||||||||||||||||||
| 1159 | else if (bearerType == QNetworkConfiguration::BearerCDMA2000
| 0-126 | ||||||||||||||||||||||||
| 1160 | timeout = 500; never executed: timeout = 500; | 0 | ||||||||||||||||||||||||
| 1161 | else if (bearerType == QNetworkConfiguration::BearerWCDMA
| 0-126 | ||||||||||||||||||||||||
| 1162 | timeout = 500; never executed: timeout = 500; | 0 | ||||||||||||||||||||||||
| 1163 | else if (bearerType == QNetworkConfiguration::BearerHSPA
| 0-126 | ||||||||||||||||||||||||
| 1164 | timeout = 400; never executed: timeout = 400; | 0 | ||||||||||||||||||||||||
| 1165 | } executed 126 times by 3 tests: end of blockExecuted by:
| 126 | ||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | delayedConnectionTimer.start(timeout); | - | ||||||||||||||||||||||||
| 1168 | if (delayIpv4
| 4-122 | ||||||||||||||||||||||||
| 1169 | channels[1].ensureConnection(); executed 122 times by 2 tests: channels[1].ensureConnection();Executed by:
| 122 | ||||||||||||||||||||||||
| 1170 | else | - | ||||||||||||||||||||||||
| 1171 | channels[0].ensureConnection(); executed 4 times by 2 tests: channels[0].ensureConnection();Executed by:
| 4 | ||||||||||||||||||||||||
| 1172 | } else { | - | ||||||||||||||||||||||||
| 1173 | networkLayerState = IPv4or6; | - | ||||||||||||||||||||||||
| 1174 | channels[0].networkLayerPreference = QAbstractSocket::AnyIPProtocol; | - | ||||||||||||||||||||||||
| 1175 | channels[0].ensureConnection(); | - | ||||||||||||||||||||||||
| 1176 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1177 | } | - | ||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | void QHttpNetworkConnectionPrivate::networkLayerDetected(QAbstractSocket::NetworkLayerProtocol protocol) | - | ||||||||||||||||||||||||
| 1180 | { | - | ||||||||||||||||||||||||
| 1181 | for (int i = 0 ; i < channelCount
| 124-744 | ||||||||||||||||||||||||
| 1182 | if ((
| 0-620 | ||||||||||||||||||||||||
| 1183 | channels[i].close(); | - | ||||||||||||||||||||||||
| 1184 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1185 | } executed 744 times by 2 tests: end of blockExecuted by:
| 744 | ||||||||||||||||||||||||
| 1186 | } executed 124 times by 2 tests: end of blockExecuted by:
| 124 | ||||||||||||||||||||||||
| 1187 | - | |||||||||||||||||||||||||
| 1188 | void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel() | - | ||||||||||||||||||||||||
| 1189 | { | - | ||||||||||||||||||||||||
| 1190 | if (delayIpv4
| 0 | ||||||||||||||||||||||||
| 1191 | channels[0].ensureConnection(); never executed: channels[0].ensureConnection(); | 0 | ||||||||||||||||||||||||
| 1192 | else | - | ||||||||||||||||||||||||
| 1193 | channels[1].ensureConnection(); never executed: channels[1].ensureConnection(); | 0 | ||||||||||||||||||||||||
| 1194 | } | - | ||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||
| 1197 | QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, | - | ||||||||||||||||||||||||
| 1198 | QHttpNetworkConnection::ConnectionType connectionType, | - | ||||||||||||||||||||||||
| 1199 | QObject *parent, QSharedPointer<QNetworkSession> networkSession) | - | ||||||||||||||||||||||||
| 1200 | : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent) | - | ||||||||||||||||||||||||
| 1201 | { | - | ||||||||||||||||||||||||
| 1202 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1203 | d->networkSession = std::move(networkSession); | - | ||||||||||||||||||||||||
| 1204 | d->init(); | - | ||||||||||||||||||||||||
| 1205 | } executed 575 times by 8 tests: end of blockExecuted by:
| 575 | ||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||
| 1207 | QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName, | - | ||||||||||||||||||||||||
| 1208 | quint16 port, bool encrypt, QObject *parent, | - | ||||||||||||||||||||||||
| 1209 | QSharedPointer<QNetworkSession> networkSession, | - | ||||||||||||||||||||||||
| 1210 | QHttpNetworkConnection::ConnectionType connectionType) | - | ||||||||||||||||||||||||
| 1211 | : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt, | - | ||||||||||||||||||||||||
| 1212 | connectionType)), parent) | - | ||||||||||||||||||||||||
| 1213 | { | - | ||||||||||||||||||||||||
| 1214 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1215 | d->networkSession = std::move(networkSession); | - | ||||||||||||||||||||||||
| 1216 | d->init(); | - | ||||||||||||||||||||||||
| 1217 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 1218 | QHttpNetworkConnection::~QHttpNetworkConnection() | - | ||||||||||||||||||||||||
| 1219 | { | - | ||||||||||||||||||||||||
| 1220 | } | - | ||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||
| 1222 | QString QHttpNetworkConnection::hostName() const | - | ||||||||||||||||||||||||
| 1223 | { | - | ||||||||||||||||||||||||
| 1224 | const QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1225 | return executed 22 times by 1 test: d->hostName;return d->hostName;Executed by:
executed 22 times by 1 test: return d->hostName;Executed by:
| 22 | ||||||||||||||||||||||||
| 1226 | } | - | ||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||
| 1228 | quint16 QHttpNetworkConnection::port() const | - | ||||||||||||||||||||||||
| 1229 | { | - | ||||||||||||||||||||||||
| 1230 | const QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1231 | return executed 22 times by 1 test: d->port;return d->port;Executed by:
executed 22 times by 1 test: return d->port;Executed by:
| 22 | ||||||||||||||||||||||||
| 1232 | } | - | ||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||
| 1234 | QHttpNetworkReply* QHttpNetworkConnection::sendRequest(const QHttpNetworkRequest &request) | - | ||||||||||||||||||||||||
| 1235 | { | - | ||||||||||||||||||||||||
| 1236 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1237 | return executed 1646 times by 8 tests: d->queueRequest(request);return d->queueRequest(request);Executed by:
executed 1646 times by 8 tests: return d->queueRequest(request);Executed by:
| 1646 | ||||||||||||||||||||||||
| 1238 | } | - | ||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||
| 1240 | bool QHttpNetworkConnection::isSsl() const | - | ||||||||||||||||||||||||
| 1241 | { | - | ||||||||||||||||||||||||
| 1242 | const QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1243 | return executed 22 times by 1 test: d->encrypt;return d->encrypt;Executed by:
executed 22 times by 1 test: return d->encrypt;Executed by:
| 22 | ||||||||||||||||||||||||
| 1244 | } | - | ||||||||||||||||||||||||
| 1245 | - | |||||||||||||||||||||||||
| 1246 | QHttpNetworkConnectionChannel *QHttpNetworkConnection::channels() const | - | ||||||||||||||||||||||||
| 1247 | { | - | ||||||||||||||||||||||||
| 1248 | return never executed: d_func()->channels;return d_func()->channels;never executed: return d_func()->channels; | 0 | ||||||||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||
| 1252 | void QHttpNetworkConnection::setCacheProxy(const QNetworkProxy &networkProxy) | - | ||||||||||||||||||||||||
| 1253 | { | - | ||||||||||||||||||||||||
| 1254 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1255 | d->networkProxy = networkProxy; | - | ||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||
| 1257 | if (!d->networkProxy.user().isEmpty()
| 0-551 | ||||||||||||||||||||||||
| 1258 | for (int i = 0; i < d->channelCount
| 0 | ||||||||||||||||||||||||
| 1259 | d->channels[i].proxyAuthenticator.setUser(d->networkProxy.user()); | - | ||||||||||||||||||||||||
| 1260 | d->channels[i].proxyAuthenticator.setPassword(d->networkProxy.password()); | - | ||||||||||||||||||||||||
| 1261 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1262 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1263 | } executed 551 times by 8 tests: end of blockExecuted by:
| 551 | ||||||||||||||||||||||||
| 1264 | - | |||||||||||||||||||||||||
| 1265 | QNetworkProxy QHttpNetworkConnection::cacheProxy() const | - | ||||||||||||||||||||||||
| 1266 | { | - | ||||||||||||||||||||||||
| 1267 | const QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1268 | return executed 700 times by 8 tests: d->networkProxy;return d->networkProxy;Executed by:
executed 700 times by 8 tests: return d->networkProxy;Executed by:
| 700 | ||||||||||||||||||||||||
| 1269 | } | - | ||||||||||||||||||||||||
| 1270 | - | |||||||||||||||||||||||||
| 1271 | void QHttpNetworkConnection::setTransparentProxy(const QNetworkProxy &networkProxy) | - | ||||||||||||||||||||||||
| 1272 | { | - | ||||||||||||||||||||||||
| 1273 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1274 | for (int i = 0; i < d->channelCount
| 551-3251 | ||||||||||||||||||||||||
| 1275 | d->channels[i].setProxy(networkProxy); executed 3251 times by 8 tests: d->channels[i].setProxy(networkProxy);Executed by:
| 3251 | ||||||||||||||||||||||||
| 1276 | } executed 551 times by 8 tests: end of blockExecuted by:
| 551 | ||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||
| 1278 | QNetworkProxy QHttpNetworkConnection::transparentProxy() const | - | ||||||||||||||||||||||||
| 1279 | { | - | ||||||||||||||||||||||||
| 1280 | const QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1281 | return executed 700 times by 8 tests: d->channels[0].proxy;return d->channels[0].proxy;Executed by:
executed 700 times by 8 tests: return d->channels[0].proxy;Executed by:
| 700 | ||||||||||||||||||||||||
| 1282 | } | - | ||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||
| 1285 | QHttpNetworkConnection::ConnectionType QHttpNetworkConnection::connectionType() | - | ||||||||||||||||||||||||
| 1286 | { | - | ||||||||||||||||||||||||
| 1287 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1288 | return executed 227 times by 4 tests: d->connectionType;return d->connectionType;Executed by:
executed 227 times by 4 tests: return d->connectionType;Executed by:
| 227 | ||||||||||||||||||||||||
| 1289 | } | - | ||||||||||||||||||||||||
| 1290 | - | |||||||||||||||||||||||||
| 1291 | void QHttpNetworkConnection::setConnectionType(ConnectionType type) | - | ||||||||||||||||||||||||
| 1292 | { | - | ||||||||||||||||||||||||
| 1293 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1294 | d->connectionType = type; | - | ||||||||||||||||||||||||
| 1295 | } executed 91 times by 3 tests: end of blockExecuted by:
| 91 | ||||||||||||||||||||||||
| 1296 | - | |||||||||||||||||||||||||
| 1297 | - | |||||||||||||||||||||||||
| 1298 | - | |||||||||||||||||||||||||
| 1299 | void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config) | - | ||||||||||||||||||||||||
| 1300 | { | - | ||||||||||||||||||||||||
| 1301 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1302 | if (!d->encrypt
| 0-57 | ||||||||||||||||||||||||
| 1303 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1304 | - | |||||||||||||||||||||||||
| 1305 | - | |||||||||||||||||||||||||
| 1306 | for (int i = 0; i < d->channelCount
| 57-287 | ||||||||||||||||||||||||
| 1307 | d->channels[i].setSslConfiguration(config); executed 287 times by 2 tests: d->channels[i].setSslConfiguration(config);Executed by:
| 287 | ||||||||||||||||||||||||
| 1308 | } executed 57 times by 2 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 1309 | - | |||||||||||||||||||||||||
| 1310 | QSharedPointer<QSslContext> QHttpNetworkConnection::sslContext() | - | ||||||||||||||||||||||||
| 1311 | { | - | ||||||||||||||||||||||||
| 1312 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1313 | return executed 274 times by 3 tests: d->sslContext;return d->sslContext;Executed by:
executed 274 times by 3 tests: return d->sslContext;Executed by:
| 274 | ||||||||||||||||||||||||
| 1314 | } | - | ||||||||||||||||||||||||
| 1315 | - | |||||||||||||||||||||||||
| 1316 | void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context) | - | ||||||||||||||||||||||||
| 1317 | { | - | ||||||||||||||||||||||||
| 1318 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1319 | d->sslContext = std::move(context); | - | ||||||||||||||||||||||||
| 1320 | } executed 95 times by 3 tests: end of blockExecuted by:
| 95 | ||||||||||||||||||||||||
| 1321 | - | |||||||||||||||||||||||||
| 1322 | void QHttpNetworkConnection::ignoreSslErrors(int channel) | - | ||||||||||||||||||||||||
| 1323 | { | - | ||||||||||||||||||||||||
| 1324 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1325 | if (!d->encrypt
| 0-34 | ||||||||||||||||||||||||
| 1326 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1327 | - | |||||||||||||||||||||||||
| 1328 | if (channel == -1
| 0-34 | ||||||||||||||||||||||||
| 1329 | for (int i = 0; i < d->channelCount
| 34-174 | ||||||||||||||||||||||||
| 1330 | d->channels[i].ignoreSslErrors(); | - | ||||||||||||||||||||||||
| 1331 | } executed 174 times by 3 tests: end of blockExecuted by:
| 174 | ||||||||||||||||||||||||
| 1332 | - | |||||||||||||||||||||||||
| 1333 | } executed 34 times by 3 tests: else {end of blockExecuted by:
| 34 | ||||||||||||||||||||||||
| 1334 | d->channels[channel].ignoreSslErrors(); | - | ||||||||||||||||||||||||
| 1335 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1336 | } | - | ||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||
| 1338 | void QHttpNetworkConnection::ignoreSslErrors(const QList<QSslError> &errors, int channel) | - | ||||||||||||||||||||||||
| 1339 | { | - | ||||||||||||||||||||||||
| 1340 | QHttpNetworkConnectionPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1341 | if (!d->encrypt
| 0-6 | ||||||||||||||||||||||||
| 1342 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||
| 1344 | if (channel == -1
| 0-6 | ||||||||||||||||||||||||
| 1345 | for (int i = 0; i < d->channelCount
| 6-36 | ||||||||||||||||||||||||
| 1346 | d->channels[i].ignoreSslErrors(errors); | - | ||||||||||||||||||||||||
| 1347 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||
| 1349 | } executed 6 times by 1 test: else {end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1350 | d->channels[channel].ignoreSslErrors(errors); | - | ||||||||||||||||||||||||
| 1351 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1352 | } | - | ||||||||||||||||||||||||
| 1353 | - | |||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | - | |||||||||||||||||||||||||
| 1356 | void QHttpNetworkConnection::preConnectFinished() | - | ||||||||||||||||||||||||
| 1357 | { | - | ||||||||||||||||||||||||
| 1358 | d_func()->preConnectRequests--; | - | ||||||||||||||||||||||||
| 1359 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||
| 1362 | - | |||||||||||||||||||||||||
| 1363 | - | |||||||||||||||||||||||||
| 1364 | - | |||||||||||||||||||||||||
| 1365 | void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth) | - | ||||||||||||||||||||||||
| 1366 | { | - | ||||||||||||||||||||||||
| 1367 | - | |||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | pauseConnection(); | - | ||||||||||||||||||||||||
| 1370 | QHttpNetworkReply *reply; | - | ||||||||||||||||||||||||
| 1371 | - | |||||||||||||||||||||||||
| 1372 | if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY
| 3-39 | ||||||||||||||||||||||||
| 1373 | - | |||||||||||||||||||||||||
| 1374 | - | |||||||||||||||||||||||||
| 1375 | - | |||||||||||||||||||||||||
| 1376 | ((!(chan->spdyRequestsToSend.count() > 0)) ? qt_assert("chan->spdyRequestsToSend.count() > 0",__FILE__,1468) : qt_noop()); | - | ||||||||||||||||||||||||
| 1377 | reply = chan->spdyRequestsToSend.cbegin().value().second; | - | ||||||||||||||||||||||||
| 1378 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 1379 | - | |||||||||||||||||||||||||
| 1380 | reply = chan->reply; | - | ||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||
| 1382 | } executed 39 times by 1 test: end of blockExecuted by:
| 39 | ||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||
| 1384 | - | |||||||||||||||||||||||||
| 1385 | ((!(reply)) ? qt_assert("reply",__FILE__,1477) : qt_noop()); | - | ||||||||||||||||||||||||
| 1386 | reply->proxyAuthenticationRequired(proxy, auth); | - | ||||||||||||||||||||||||
| 1387 | resumeConnection(); | - | ||||||||||||||||||||||||
| 1388 | int i = indexOf(chan->socket); | - | ||||||||||||||||||||||||
| 1389 | copyCredentials(i, auth, true); | - | ||||||||||||||||||||||||
| 1390 | } executed 42 times by 2 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |