| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpprotocolhandler.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel) | - | ||||||||||||
| 7 | : QAbstractProtocolHandler(channel) | - | ||||||||||||
| 8 | { | - | ||||||||||||
| 9 | } | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | void QHttpProtocolHandler::_q_receiveReply() | - | ||||||||||||
| 12 | { | - | ||||||||||||
| 13 | ((!(m_socket)) ? qt_assert("m_socket",__FILE__,5056) : qt_noop()); | - | ||||||||||||
| 14 | - | |||||||||||||
| 15 | if (!m_reply) { | - | ||||||||||||
| 16 | if (m_socket->bytesAvailable() > 0) | - | ||||||||||||
| 17 | QMessageLogger(__FILE__, 5460, __PRETTY_FUNCTION__).warning() << "QAbstractProtocolHandler::_q_receiveReply() called without QHttpNetworkReply," | - | ||||||||||||
| 18 | << m_socket->bytesAvailable() << "bytes on socket."; | - | ||||||||||||
| 19 | m_channel->close(); | - | ||||||||||||
| 20 | return; | - | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | if (!qobject_cast<QHttpNetworkConnection*>(m_connection)) { | - | ||||||||||||
| 27 | return; | - | ||||||||||||
| 28 | } | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | QAbstractSocket::SocketState socketState = m_socket->state(); | - | ||||||||||||
| 31 | - | |||||||||||||
| 32 | - | |||||||||||||
| 33 | if (socketState == QAbstractSocket::UnconnectedState) { | - | ||||||||||||
| 34 | if (m_socket->bytesAvailable() <= 0) { | - | ||||||||||||
| 35 | if (m_reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | m_reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; | - | ||||||||||||
| 38 | m_channel->allDone(); | - | ||||||||||||
| 39 | return; | - | ||||||||||||
| 40 | } else { | - | ||||||||||||
| 41 | m_channel->handleUnexpectedEOF(); | - | ||||||||||||
| 42 | return; | - | ||||||||||||
| 43 | } | - | ||||||||||||
| 44 | } else { | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | } | - | ||||||||||||
| 47 | } | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | qint64 bytes = 0; | - | ||||||||||||
| 51 | qint64 lastBytes = bytes; | - | ||||||||||||
| 52 | do { | - | ||||||||||||
| 53 | lastBytes = bytes; | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | QHttpNetworkReplyPrivate::ReplyState state = m_reply->d_func()->state; | - | ||||||||||||
| 56 | switch (state) { | - | ||||||||||||
| 57 | case QHttpNetworkReplyPrivate::NothingDoneState: { | - | ||||||||||||
| 58 | m_reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; | - | ||||||||||||
| 59 | - | |||||||||||||
| 60 | } | - | ||||||||||||
| 61 | case QHttpNetworkReplyPrivate::ReadingStatusState: { | - | ||||||||||||
| 62 | qint64 statusBytes = m_reply->d_func()->readStatus(m_socket); | - | ||||||||||||
| 63 | if (statusBytes == -1) { | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | m_channel->handleUnexpectedEOF(); | - | ||||||||||||
| 66 | return; | - | ||||||||||||
| 67 | } | - | ||||||||||||
| 68 | bytes += statusBytes; | - | ||||||||||||
| 69 | m_channel->lastStatus = m_reply->d_func()->statusCode; | - | ||||||||||||
| 70 | break; | - | ||||||||||||
| 71 | } | - | ||||||||||||
| 72 | case QHttpNetworkReplyPrivate::ReadingHeaderState: { | - | ||||||||||||
| 73 | QHttpNetworkReplyPrivate *replyPrivate = m_reply->d_func(); | - | ||||||||||||
| 74 | qint64 headerBytes = replyPrivate->readHeader(m_socket); | - | ||||||||||||
| 75 | if (headerBytes == -1) { | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | m_channel->handleUnexpectedEOF(); | - | ||||||||||||
| 78 | return; | - | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | bytes += headerBytes; | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) { | - | ||||||||||||
| 83 | if (replyPrivate->isCompressed() && replyPrivate->autoDecompress) { | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | replyPrivate->removeAutoDecompressHeader(); | - | ||||||||||||
| 86 | } else { | - | ||||||||||||
| 87 | replyPrivate->autoDecompress = false; | - | ||||||||||||
| 88 | } | - | ||||||||||||
| 89 | if (replyPrivate->statusCode == 100) { | - | ||||||||||||
| 90 | replyPrivate->clearHttpLayerInformation(); | - | ||||||||||||
| 91 | replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; | - | ||||||||||||
| 92 | break; | - | ||||||||||||
| 93 | } | - | ||||||||||||
| 94 | if (replyPrivate->shouldEmitSignals()) | - | ||||||||||||
| 95 | m_reply->headerChanged(); | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | if (!replyPrivate->expectContent()) { | - | ||||||||||||
| 101 | replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState; | - | ||||||||||||
| 102 | m_channel->allDone(); | - | ||||||||||||
| 103 | break; | - | ||||||||||||
| 104 | } | - | ||||||||||||
| 105 | } | - | ||||||||||||
| 106 | break; | - | ||||||||||||
| 107 | } | - | ||||||||||||
| 108 | case QHttpNetworkReplyPrivate::ReadingDataState: { | - | ||||||||||||
| 109 | QHttpNetworkReplyPrivate *replyPrivate = m_reply->d_func(); | - | ||||||||||||
| 110 | if (m_socket->state() == QAbstractSocket::ConnectedState && | - | ||||||||||||
| 111 | replyPrivate->downstreamLimited && !replyPrivate->responseData.isEmpty() && replyPrivate->shouldEmitSignals()) { | - | ||||||||||||
| 112 | - | |||||||||||||
| 113 | - | |||||||||||||
| 114 | - | |||||||||||||
| 115 | - | |||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | return; | - | ||||||||||||
| 120 | } | - | ||||||||||||
| 121 | - | |||||||||||||
| 122 | if (replyPrivate->userProvidedDownloadBuffer) { | - | ||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | - | |||||||||||||
| 126 | - | |||||||||||||
| 127 | qint64 haveRead = replyPrivate->readBodyVeryFast(m_socket, replyPrivate->userProvidedDownloadBuffer + replyPrivate->totalProgress); | - | ||||||||||||
| 128 | if (haveRead > 0) { | - | ||||||||||||
| 129 | bytes += haveRead; | - | ||||||||||||
| 130 | replyPrivate->totalProgress += haveRead; | - | ||||||||||||
| 131 | - | |||||||||||||
| 132 | m_reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - | ||||||||||||
| 133 | } else if (haveRead == 0) { | - | ||||||||||||
| 134 | - | |||||||||||||
| 135 | } else if (haveRead < 0) { | - | ||||||||||||
| 136 | m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::RemoteHostClosedError); | - | ||||||||||||
| 137 | break; | - | ||||||||||||
| 138 | } | - | ||||||||||||
| 139 | } else if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress | - | ||||||||||||
| 140 | && replyPrivate->bodyLength > 0) { | - | ||||||||||||
| 141 | - | |||||||||||||
| 142 | - | |||||||||||||
| 143 | qint64 haveRead = replyPrivate->readBodyFast(m_socket, &replyPrivate->responseData); | - | ||||||||||||
| 144 | bytes += haveRead; | - | ||||||||||||
| 145 | replyPrivate->totalProgress += haveRead; | - | ||||||||||||
| 146 | if (replyPrivate->shouldEmitSignals()) { | - | ||||||||||||
| 147 | m_reply->readyRead(); | - | ||||||||||||
| 148 | m_reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - | ||||||||||||
| 149 | } | - | ||||||||||||
| 150 | } | - | ||||||||||||
| 151 | else | - | ||||||||||||
| 152 | { | - | ||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | qint64 haveRead = replyPrivate->readBody(m_socket, &replyPrivate->responseData); | - | ||||||||||||
| 156 | if (haveRead > 0) { | - | ||||||||||||
| 157 | bytes += haveRead; | - | ||||||||||||
| 158 | replyPrivate->totalProgress += haveRead; | - | ||||||||||||
| 159 | if (replyPrivate->shouldEmitSignals()) { | - | ||||||||||||
| 160 | m_reply->readyRead(); | - | ||||||||||||
| 161 | m_reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); | - | ||||||||||||
| 162 | } | - | ||||||||||||
| 163 | } else if (haveRead == -1) { | - | ||||||||||||
| 164 | - | |||||||||||||
| 165 | m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::ProtocolFailure); | - | ||||||||||||
| 166 | break; | - | ||||||||||||
| 167 | } | - | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) | - | ||||||||||||
| 171 | break; | - | ||||||||||||
| 172 | - | |||||||||||||
| 173 | - | |||||||||||||
| 174 | } | - | ||||||||||||
| 175 | case QHttpNetworkReplyPrivate::AllDoneState: | - | ||||||||||||
| 176 | m_channel->allDone(); | - | ||||||||||||
| 177 | break; | - | ||||||||||||
| 178 | default: | - | ||||||||||||
| 179 | break; | - | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | } while (bytes != lastBytes && m_reply); | - | ||||||||||||
| 182 | } | - | ||||||||||||
| 183 | - | |||||||||||||
| 184 | void QHttpProtocolHandler::_q_readyRead() | - | ||||||||||||
| 185 | { | - | ||||||||||||
| 186 | if (m_socket->state() == QAbstractSocket::ConnectedState && m_socket->bytesAvailable() == 0) { | - | ||||||||||||
| 187 | - | |||||||||||||
| 188 | - | |||||||||||||
| 189 | - | |||||||||||||
| 190 | - | |||||||||||||
| 191 | char c; | - | ||||||||||||
| 192 | qint64 ret = m_socket->peek(&c, 1); | - | ||||||||||||
| 193 | if (ret < 0) { | - | ||||||||||||
| 194 | m_channel->_q_error(m_socket->error()); | - | ||||||||||||
| 195 | - | |||||||||||||
| 196 | if (m_reply) | - | ||||||||||||
| 197 | _q_receiveReply(); | - | ||||||||||||
| 198 | return; | - | ||||||||||||
| 199 | } | - | ||||||||||||
| 200 | } | - | ||||||||||||
| 201 | - | |||||||||||||
| 202 | if (m_channel->isSocketWaiting() || m_channel->isSocketReading()) { | - | ||||||||||||
| 203 | if (m_socket->bytesAvailable()) { | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | m_channel->state = QHttpNetworkConnectionChannel::ReadingState; | - | ||||||||||||
| 208 | } | - | ||||||||||||
| 209 | if (m_reply) | - | ||||||||||||
| 210 | _q_receiveReply(); | - | ||||||||||||
| 211 | } | - | ||||||||||||
| 212 | } | - | ||||||||||||
| 213 | - | |||||||||||||
| 214 | bool QHttpProtocolHandler::sendRequest() | - | ||||||||||||
| 215 | { | - | ||||||||||||
| 216 | m_reply = m_channel->reply; | - | ||||||||||||
| 217 | - | |||||||||||||
| 218 |     if (!m_reply
  | 0-6085 | ||||||||||||
| 219 | - | |||||||||||||
| 220 | QMessageLogger(__FILE__, 257263, __PRETTY_FUNCTION__).warning() << ("QAbstractProtocolHandler::sendRequest() called without QHttpNetworkReply";); | - | ||||||||||||
| 221 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 222 | } | - | ||||||||||||
| 223 | - | |||||||||||||
| 224 | switch (m_channel->state) { | - | ||||||||||||
| 225 |     case executed 1443 times by 8 tests:   QHttpNetworkConnectionChannel::IdleState:case QHttpNetworkConnectionChannel::IdleState:Executed by: 
 executed 1443 times by 8 tests:   {case QHttpNetworkConnectionChannel::IdleState:Executed by: 
  | 1443 | ||||||||||||
| 226 |         if (!m_channel->ensureConnection()
  | 121-1322 | ||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | - | |||||||||||||
| 230 |             return executed 121 times by 2 tests:   false;return false;Executed by: 
 executed 121 times by 2 tests:  return false;Executed by: 
  | 121 | ||||||||||||
| 231 | } | - | ||||||||||||
| 232 | QString scheme = m_channel->request.url().scheme(); | - | ||||||||||||
| 233 |         if (scheme == QLatin1String("preconnect-http")
  | 0-1322 | ||||||||||||
| 234 |             || scheme == QLatin1String("preconnect-https")
  | 0-1322 | ||||||||||||
| 235 | m_channel->state = QHttpNetworkConnectionChannel::IdleState; | - | ||||||||||||
| 236 | m_reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState; | - | ||||||||||||
| 237 | m_channel->allDone(); | - | ||||||||||||
| 238 | m_connection->preConnectFinished(); | - | ||||||||||||
| 239 | m_reply = 0; | - | ||||||||||||
| 240 |             return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||
| 241 | } | - | ||||||||||||
| 242 | - | |||||||||||||
| 243 | m_channel->written = 0; | - | ||||||||||||
| 244 | m_channel->bytesTotal = 0; | - | ||||||||||||
| 245 | - | |||||||||||||
| 246 | QHttpNetworkReplyPrivate *replyPrivate = m_reply->d_func(); | - | ||||||||||||
| 247 | replyPrivate->clear(); | - | ||||||||||||
| 248 | replyPrivate->connection = m_connection; | - | ||||||||||||
| 249 | replyPrivate->connectionChannel = m_channel; | - | ||||||||||||
| 250 | replyPrivate->autoDecompress = m_channel->request.d->autoDecompress; | - | ||||||||||||
| 251 | replyPrivate->pipeliningUsed = false; | - | ||||||||||||
| 252 | - | |||||||||||||
| 253 | - | |||||||||||||
| 254 | - | |||||||||||||
| 255 |         if (!m_channel->request.url().userInfo().isEmpty()
 
  | 0-1296 | ||||||||||||
| 256 | QUrl url = m_channel->request.url(); | - | ||||||||||||
| 257 | QAuthenticator &auth = m_channel->authenticator; | - | ||||||||||||
| 258 |             if (url.userName() != auth.user()
  | 10-16 | ||||||||||||
| 259 |                 || (!url.password().isEmpty()
 
  | 0-10 | ||||||||||||
| 260 | auth.setUser(url.userName()); | - | ||||||||||||
| 261 | auth.setPassword(url.password()); | - | ||||||||||||
| 262 | m_connection->d_func()->copyCredentials(m_connection->d_func()->indexOf(m_socket), &auth, false); | - | ||||||||||||
| 263 |             } executed 18 times by 1 test:  end of blockExecuted by: 
  | 18 | ||||||||||||
| 264 | - | |||||||||||||
| 265 | - | |||||||||||||
| 266 | url.setUserInfo(QString()); | - | ||||||||||||
| 267 | m_channel->request.setUrl(url); | - | ||||||||||||
| 268 |         } executed 26 times by 1 test:  end of blockExecuted by: 
  | 26 | ||||||||||||
| 269 | - | |||||||||||||
| 270 | - | |||||||||||||
| 271 |         if (m_channel->request.withCredentials()
  | 1-1321 | ||||||||||||
| 272 |             m_connection->d_func()->createAuthorization(m_socket, m_channel->request); executed 1321 times by 8 tests:  m_connection->d_func()->createAuthorization(m_socket, m_channel->request);Executed by: 
  | 1321 | ||||||||||||
| 273 | - | |||||||||||||
| 274 | QByteArray header = QHttpNetworkRequestPrivate::header(m_channel->request, | - | ||||||||||||
| 275 | (m_connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy)); | - | ||||||||||||
| 276 | - | |||||||||||||
| 277 | - | |||||||||||||
| 278 | - | |||||||||||||
| 279 | m_socket->write(header); | - | ||||||||||||
| 280 | - | |||||||||||||
| 281 | - | |||||||||||||
| 282 | QNonContiguousByteDevice* uploadByteDevice = m_channel->request.uploadByteDevice(); | - | ||||||||||||
| 283 |         if (uploadByteDevice
  | 227-1095 | ||||||||||||
| 284 | - | |||||||||||||
| 285 | QObject::connect(uploadByteDevice, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "322""328"), m_channel, qFlagLocation("1""_q_uploadDataReadyRead()" "\0" __FILE__ ":" "322""328")); | - | ||||||||||||
| 286 | - | |||||||||||||
| 287 | m_channel->bytesTotal = m_channel->request.contentLength(); | - | ||||||||||||
| 288 | - | |||||||||||||
| 289 | m_channel->state = QHttpNetworkConnectionChannel::WritingState; | - | ||||||||||||
| 290 | sendRequest(); | - | ||||||||||||
| 291 |         } executed 227 times by 3 tests:   else {end of blockExecuted by: 
  | 227 | ||||||||||||
| 292 | m_channel->state = QHttpNetworkConnectionChannel::WaitingState; | - | ||||||||||||
| 293 | sendRequest(); | - | ||||||||||||
| 294 |         } executed 1095 times by 7 tests:  end of blockExecuted by: 
  | 1095 | ||||||||||||
| 295 | - | |||||||||||||
| 296 |         break; executed 1322 times by 8 tests:  break;Executed by: 
  | 1322 | ||||||||||||
| 297 | } | - | ||||||||||||
| 298 |     case executed 3320 times by 3 tests:   QHttpNetworkConnectionChannel::WritingState:case QHttpNetworkConnectionChannel::WritingState:Executed by: 
 executed 3320 times by 3 tests:  case QHttpNetworkConnectionChannel::WritingState:Executed by: 
  | 3320 | ||||||||||||
| 299 | { | - | ||||||||||||
| 300 | - | |||||||||||||
| 301 | QNonContiguousByteDevice* uploadByteDevice = m_channel->request.uploadByteDevice(); | - | ||||||||||||
| 302 |         if (!uploadByteDevice
 
  | 0-3320 | ||||||||||||
| 303 |             if (uploadByteDevice
  | 0-31 | ||||||||||||
| 304 |                 m_reply->dataSendProgress(m_channel->written, m_channel->bytesTotal); executed 31 times by 1 test:  m_reply->dataSendProgress(m_channel->written, m_channel->bytesTotal);Executed by: 
  | 31 | ||||||||||||
| 305 | m_channel->state = QHttpNetworkConnectionChannel::WaitingState; | - | ||||||||||||
| 306 | sendRequest(); | - | ||||||||||||
| 307 |             break; executed 31 times by 1 test:  break;Executed by: 
  | 31 | ||||||||||||
| 308 | } | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | - | |||||||||||||
| 311 | const qint64 socketBufferFill = 32*1024; | - | ||||||||||||
| 312 | const qint64 socketWriteMaxSize = 16*1024; | - | ||||||||||||
| 313 | - | |||||||||||||
| 314 | - | |||||||||||||
| 315 | - | |||||||||||||
| 316 | QSslSocket *sslSocket = qobject_cast<QSslSocket*>(m_socket); | - | ||||||||||||
| 317 | - | |||||||||||||
| 318 |         while ((
 
  | 341-5428 | ||||||||||||
| 319 |                 <= socketBufferFill
 
  | 0-5428 | ||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | - | |||||||||||||
| 324 | { | - | ||||||||||||
| 325 | - | |||||||||||||
| 326 | qint64 currentReadSize = 0; | - | ||||||||||||
| 327 | qint64 desiredReadSize = qMin(socketWriteMaxSize, m_channel->bytesTotal - m_channel->written); | - | ||||||||||||
| 328 | const char *readPointer = uploadByteDevice->readPointer(desiredReadSize, currentReadSize); | - | ||||||||||||
| 329 | - | |||||||||||||
| 330 |             if (currentReadSize == -1
  | 0-5428 | ||||||||||||
| 331 | - | |||||||||||||
| 332 | m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::UnknownNetworkError); | - | ||||||||||||
| 333 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 334 |             } else if (readPointer == 0
 
  | 0-2752 | ||||||||||||
| 335 | - | |||||||||||||
| 336 |                 break; executed 2752 times by 2 tests:  break;Executed by: 
  | 2752 | ||||||||||||
| 337 | } else { | - | ||||||||||||
| 338 |                 if (m_channel->written != uploadByteDevice->pos()
  | 0-2676 | ||||||||||||
| 339 | - | |||||||||||||
| 340 | QMessageLogger(__FILE__, 377383, __PRETTY_FUNCTION__).warning() << "QHttpProtocolHandler: Internal error in sendRequest. Expected to write at position" << m_channel->written << "but read device is at" << uploadByteDevice->pos(); | - | ||||||||||||
| 341 | ((!(m_channel->written == uploadByteDevice->pos())) ? qt_assert("m_channel->written == uploadByteDevice->pos()",__FILE__,378384) : qt_noop()); | - | ||||||||||||
| 342 | m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::ProtocolFailure); | - | ||||||||||||
| 343 |                     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 344 | } | - | ||||||||||||
| 345 | qint64 currentWriteSize = m_socket->write(readPointer, currentReadSize); | - | ||||||||||||
| 346 |                 if (currentWriteSize == -1
 
  | 0-2676 | ||||||||||||
| 347 | - | |||||||||||||
| 348 | m_connection->d_func()->emitReplyError(m_socket, m_reply, QNetworkReply::UnknownNetworkError); | - | ||||||||||||
| 349 |                     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 350 | } else { | - | ||||||||||||
| 351 | m_channel->written += currentWriteSize; | - | ||||||||||||
| 352 | uploadByteDevice->advanceReadPointer(currentWriteSize); | - | ||||||||||||
| 353 | - | |||||||||||||
| 354 | m_reply->dataSendProgress(m_channel->written, m_channel->bytesTotal); | - | ||||||||||||
| 355 | - | |||||||||||||
| 356 |                     if (m_channel->written == m_channel->bytesTotal
  | 196-2480 | ||||||||||||
| 357 | - | |||||||||||||
| 358 | m_channel->state = QHttpNetworkConnectionChannel::WaitingState; | - | ||||||||||||
| 359 | sendRequest(); | - | ||||||||||||
| 360 |                         break; executed 196 times by 3 tests:  break;Executed by: 
  | 196 | ||||||||||||
| 361 | } | - | ||||||||||||
| 362 |                 } executed 2480 times by 1 test:  end of blockExecuted by: 
  | 2480 | ||||||||||||
| 363 | } | - | ||||||||||||
| 364 | } | - | ||||||||||||
| 365 |         break; executed 3289 times by 3 tests:  break;Executed by: 
  | 3289 | ||||||||||||
| 366 | } | - | ||||||||||||
| 367 | - | |||||||||||||
| 368 |     case executed 1322 times by 8 tests:   QHttpNetworkConnectionChannel::WaitingState:case QHttpNetworkConnectionChannel::WaitingState:Executed by: 
 executed 1322 times by 8 tests:  case QHttpNetworkConnectionChannel::WaitingState:Executed by: 
  | 1322 | ||||||||||||
| 369 | { | - | ||||||||||||
| 370 | QNonContiguousByteDevice* uploadByteDevice = m_channel->request.uploadByteDevice(); | - | ||||||||||||
| 371 |         if (uploadByteDevice
  | 227-1095 | ||||||||||||
| 372 | QObject::disconnect(uploadByteDevice, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "409""415"), m_channel, qFlagLocation("1""_q_uploadDataReadyRead()" "\0" __FILE__ ":" "409""415")); | - | ||||||||||||
| 373 |         } executed 227 times by 3 tests:  end of blockExecuted by: 
  | 227 | ||||||||||||
| 374 |         if (m_socket->bytesAvailable()
  | 197-1125 | ||||||||||||
| 375 |             QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection); executed 197 times by 2 tests:  QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);Executed by: 
  | 197 | ||||||||||||
| 376 |         break; executed 1322 times by 8 tests:  break;Executed by: 
  | 1322 | ||||||||||||
| 377 | } | - | ||||||||||||
| 378 |     case never executed:   QHttpNetworkConnectionChannel::ReadingState:case QHttpNetworkConnectionChannel::ReadingState:never executed:  case QHttpNetworkConnectionChannel::ReadingState: | 0 | ||||||||||||
| 379 | - | |||||||||||||
| 380 | - | |||||||||||||
| 381 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||
| 382 |         break; never executed:  break; | 0 | ||||||||||||
| 383 | } | - | ||||||||||||
| 384 |     return executed 5964 times by 8 tests:   true;return true;Executed by: 
 executed 5964 times by 8 tests:  return true;Executed by: 
  | 5964 | ||||||||||||
| 385 | } | - | ||||||||||||
| 386 | - | |||||||||||||
| 387 | - | |||||||||||||
| Switch to Source code | Preprocessed file |