src/network/access/qhttpnetworkconnectionchannel.cpp
changeset 23 89e065397ea6
parent 22 79de32ba3296
child 25 e24348a560a6
equal deleted inserted replaced
22:79de32ba3296 23:89e065397ea6
   283         if (uploadByteDevice) {
   283         if (uploadByteDevice) {
   284             QObject::disconnect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(_q_uploadDataReadyRead()));
   284             QObject::disconnect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(_q_uploadDataReadyRead()));
   285         }
   285         }
   286 
   286 
   287         // HTTP pipelining
   287         // HTTP pipelining
   288         //connection->d_func()->fillPipeline(socket);
   288         connection->d_func()->fillPipeline(socket);
   289         //socket->flush();
   289         socket->flush();
   290 
   290 
   291         // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called
   291         // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called
   292         // this is needed if the sends an reply before we have finished sending the request. In that
   292         // this is needed if the sends an reply before we have finished sending the request. In that
   293         // case receiveReply had been called before but ignored the server reply
   293         // case receiveReply had been called before but ignored the server reply
   294         QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection);
   294         QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection);
   312     if (!reply) {
   312     if (!reply) {
   313         // heh, how should that happen!
   313         // heh, how should that happen!
   314         qWarning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply,"
   314         qWarning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply,"
   315                 << socket->bytesAvailable() << "bytes on socket.";
   315                 << socket->bytesAvailable() << "bytes on socket.";
   316         close();
   316         close();
       
   317         return;
       
   318     }
       
   319 
       
   320     // only run when the QHttpNetworkConnection is not currently being destructed, e.g.
       
   321     // this function is called from _q_disconnected which is called because
       
   322     // of ~QHttpNetworkConnectionPrivate
       
   323     if (!qobject_cast<QHttpNetworkConnection*>(connection)) {
   317         return;
   324         return;
   318     }
   325     }
   319 
   326 
   320     qint64 bytes = 0;
   327     qint64 bytes = 0;
   321     QAbstractSocket::SocketState socketState = socket->state();
   328     QAbstractSocket::SocketState socketState = socket->state();
   382                 if (replyPrivate->shouldEmitSignals())
   389                 if (replyPrivate->shouldEmitSignals())
   383                     emit reply->headerChanged();
   390                     emit reply->headerChanged();
   384                 if (!replyPrivate->expectContent()) {
   391                 if (!replyPrivate->expectContent()) {
   385                     replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState;
   392                     replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState;
   386                     allDone();
   393                     allDone();
   387                     return;
   394                     break;
   388                 }
   395                 }
   389             }
   396             }
   390             break;
   397             break;
   391         }
   398         }
   392         case QHttpNetworkReplyPrivate::ReadingDataState: {
   399         case QHttpNetworkReplyPrivate::ReadingDataState: {