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