Changeset 651 for trunk/src/network/access
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 56 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/network/access/qabstractnetworkcache.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qabstractnetworkcache.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qabstractnetworkcache_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qfilenetworkreply.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 45 45 #include <QtCore/QCoreApplication> 46 46 #include <QtCore/QFileInfo> 47 #include <QDebug> 47 48 48 49 QT_BEGIN_NAMESPACE 49 50 50 51 QFileNetworkReplyPrivate::QFileNetworkReplyPrivate() 51 : QNetworkReplyPrivate(), realFileSize(0) , finished(false)52 : QNetworkReplyPrivate(), realFileSize(0) 52 53 { 53 }54 55 QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req)56 : QNetworkReply(*new QFileNetworkReplyPrivate(), parent)57 {58 setRequest(req);59 setUrl(req.url());60 setOperation(QNetworkAccessManager::GetOperation);61 QMetaObject::invokeMethod(this, "_q_startOperation", Qt::QueuedConnection);62 QNetworkReply::open(QIODevice::ReadOnly);63 54 } 64 55 … … 67 58 } 68 59 69 // This code is mostly inspired by QNetworkAccessFileBackend 70 // We also use its translation context for error messages 71 void QFileNetworkReplyPrivate::_q_startOperation() 60 QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) 61 : QNetworkReply(*new QFileNetworkReplyPrivate(), parent) 72 62 { 73 Q_Q(QFileNetworkReply); 63 setRequest(req); 64 setUrl(req.url()); 65 setOperation(op); 66 QNetworkReply::open(QIODevice::ReadOnly); 74 67 75 QUrl url = q->url(); 68 qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError"); 69 70 QFileNetworkReplyPrivate *d = (QFileNetworkReplyPrivate*) d_func(); 71 72 QUrl url = req.url(); 76 73 if (url.host() == QLatin1String("localhost")) 77 74 url.setHost(QString()); … … 82 79 // we handle only local files 83 80 QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Request for opening non-local file %1").arg(url.toString()); 84 q->setError(QNetworkReply::ProtocolInvalidOperationError, msg); 85 emit q->error(QNetworkReply::ProtocolInvalidOperationError); 86 doFinished(); 81 setError(QNetworkReply::ProtocolInvalidOperationError, msg); 82 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, 83 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProtocolInvalidOperationError)); 84 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 87 85 return; 88 86 } … … 90 88 if (url.path().isEmpty()) 91 89 url.setPath(QLatin1String("/")); 92 q->setUrl(url);90 setUrl(url); 93 91 94 92 … … 97 95 fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); 98 96 } 99 realFile.setFileName(fileName);97 d->realFile.setFileName(fileName); 100 98 101 QFileInfo fi( realFile);99 QFileInfo fi(d->realFile); 102 100 if (fi.isDir()) { 103 101 QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); 104 q->setError(QNetworkReply::ContentOperationNotPermittedError, msg); 105 emit q->error(QNetworkReply::ContentOperationNotPermittedError); 106 doFinished(); 102 setError(QNetworkReply::ContentOperationNotPermittedError, msg); 103 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, 104 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); 105 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 107 106 return; 108 107 } 109 108 110 bool opened = realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered);109 bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); 111 110 112 111 // could we open the file? 113 112 if (!opened) { 114 113 QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") 115 .arg( realFile.fileName(),realFile.errorString());114 .arg(d->realFile.fileName(), d->realFile.errorString()); 116 115 117 if (realFile.exists()) { 118 q->setError(QNetworkReply::ContentAccessDenied, msg); 119 emit q->error(QNetworkReply::ContentAccessDenied); 116 if (d->realFile.exists()) { 117 setError(QNetworkReply::ContentAccessDenied, msg); 118 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, 119 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); 120 120 } else { 121 q->setError(QNetworkReply::ContentNotFoundError, msg); 122 emit q->error(QNetworkReply::ContentNotFoundError); 121 setError(QNetworkReply::ContentNotFoundError, msg); 122 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, 123 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); 123 124 } 124 doFinished();125 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 125 126 return; 126 127 } 127 128 128 realFileSize = fi.size();129 q->setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified());130 q->setHeader(QNetworkRequest::ContentLengthHeader,realFileSize);129 d->realFileSize = fi.size(); 130 setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); 131 setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize); 131 132 132 emit q->metaDataChanged(); 133 emit q->downloadProgress(realFileSize, realFileSize); 134 emit q->readyRead(); 135 doFinished(); 133 QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); 134 QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, 135 Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize)); 136 QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); 137 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 136 138 } 137 139 138 140 bool QFileNetworkReplyPrivate::isFinished() const 139 141 { 140 return finished;142 return true; 141 143 } 142 143 void QFileNetworkReplyPrivate::doFinished()144 {145 Q_Q(QFileNetworkReply);146 finished = true;147 emit q->finished();148 }149 150 144 151 145 void QFileNetworkReply::close() … … 154 148 QNetworkReply::close(); 155 149 d->realFile.close(); 156 157 if (!d->finished)158 d->doFinished();159 150 } 160 151 … … 164 155 QNetworkReply::close(); 165 156 d->realFile.close(); 166 167 if (!d->finished)168 d->doFinished();169 157 } 170 158 -
trunk/src/network/access/qfilenetworkreply_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 67 67 Q_OBJECT 68 68 public: 69 QFileNetworkReply(QObject *parent, const QNetworkRequest &req );69 QFileNetworkReply(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); 70 70 ~QFileNetworkReply(); 71 71 virtual void abort(); … … 77 77 qint64 size() const; 78 78 79 80 79 virtual qint64 readData(char *data, qint64 maxlen); 81 80 82 81 Q_DECLARE_PRIVATE(QFileNetworkReply) 83 Q_PRIVATE_SLOT(d_func(), void _q_startOperation())84 85 82 }; 86 83 … … 93 90 qint64 realFileSize; 94 91 95 void _q_startOperation();96 97 92 virtual bool isFinished() const; 98 void doFinished();99 bool finished;100 101 93 102 94 Q_DECLARE_PUBLIC(QFileNetworkReply) -
trunk/src/network/access/qftp.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qftp.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttp.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttp.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttpnetworkconnection.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 416 416 break; 417 417 } 418 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); 418 // this used to be called via invokeMethod and a QueuedConnection 419 _q_startNextRequest(); 419 420 return reply; 420 421 } … … 422 423 void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) 423 424 { 424 Q_Q(QHttpNetworkConnection);425 426 425 QHttpNetworkRequest request = pair.first; 427 426 switch (request.priority()) { … … 434 433 break; 435 434 } 436 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); 435 // this used to be called via invokeMethod and a QueuedConnection 436 _q_startNextRequest(); 437 437 } 438 438 … … 565 565 566 566 567 QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket* socket) 567 QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket* socket, 568 const QString &extraDetail) 568 569 { 569 570 Q_ASSERT(socket); … … 582 583 break; 583 584 case QNetworkReply::TimeoutError: 584 errorString = QLatin1String(QT_TRANSLATE_NOOP("Q Http", "HTTP request failed"));585 errorString = QLatin1String(QT_TRANSLATE_NOOP("QAbstractSocket", "Socket operation timed out")); 585 586 break; 586 587 case QNetworkReply::ProxyAuthenticationRequiredError: … … 601 602 default: 602 603 // all other errors are treated as QNetworkReply::UnknownNetworkError 603 errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "HTTP request failed"));604 errorString = extraDetail; 604 605 break; 605 606 } … … 692 693 } 693 694 } 695 696 // dequeue new ones 697 694 698 QAbstractSocket *socket = 0; 695 699 for (int i = 0; i < channelCount; ++i) { 696 700 QAbstractSocket *chSocket = channels[i].socket; 697 // send the request using the idlesocket698 if (!channels[i].isSocketBusy() ) {701 // try to get a free AND connected socket 702 if (!channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) { 699 703 socket = chSocket; 704 dequeueAndSendRequest(socket); 700 705 break; 701 706 } 702 707 } 703 708 704 // this socket is free, 705 if (socket) 706 dequeueAndSendRequest(socket); 709 if (!socket) { 710 for (int i = 0; i < channelCount; ++i) { 711 QAbstractSocket *chSocket = channels[i].socket; 712 // try to get a free unconnected socket 713 if (!channels[i].isSocketBusy()) { 714 socket = chSocket; 715 dequeueAndSendRequest(socket); 716 break; 717 } 718 } 719 } 707 720 708 721 // try to push more into all sockets … … 732 745 } 733 746 747 void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply) 748 { 749 for (int i = 0 ; i < channelCount; ++i) { 750 if (channels[i].reply == reply) { 751 // emulate a readyRead() from the socket 752 QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection); 753 return; 754 } 755 } 756 } 734 757 735 758 QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent) -
trunk/src/network/access/qhttpnetworkconnection_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 175 175 bool fillPipeline(QList<HttpMessagePair> &queue, QHttpNetworkConnectionChannel &channel); 176 176 177 // read more HTTP body after the next event loop spin 178 void readMoreLater(QHttpNetworkReply *reply); 179 177 180 void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy); 178 181 … … 183 186 void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); 184 187 185 QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket); 188 QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, 189 const QString &extraDetail = QString()); 186 190 187 191 #ifndef QT_NO_COMPRESS -
trunk/src/network/access/qhttpnetworkconnectionchannel.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 167 167 #endif 168 168 socket->write(header); 169 // flushing is dangerous (QSslSocket calls transmit which might read or error) 170 // socket->flush(); 169 171 QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); 170 172 if (uploadByteDevice) { … … 259 261 // this is needed if the sends an reply before we have finished sending the request. In that 260 262 // case receiveReply had been called before but ignored the server reply 261 receiveReply();263 QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection); 262 264 break; 263 265 } … … 273 275 274 276 275 void QHttpNetworkConnectionChannel:: receiveReply()277 void QHttpNetworkConnectionChannel::_q_receiveReply() 276 278 { 277 279 Q_ASSERT(socket); … … 325 327 break; 326 328 } 327 case QHttpNetworkReplyPrivate::ReadingHeaderState: 328 bytes += reply->d_func()->readHeader(socket); 329 if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { 330 if (reply->d_func()->isGzipped() && reply->d_func()->autoDecompress) { 329 case QHttpNetworkReplyPrivate::ReadingHeaderState: { 330 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); 331 bytes += replyPrivate->readHeader(socket); 332 if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) { 333 if (replyPrivate->isGzipped() && replyPrivate->autoDecompress) { 331 334 // remove the Content-Length from header 332 reply ->d_func()->removeAutoDecompressHeader();335 replyPrivate->removeAutoDecompressHeader(); 333 336 } else { 334 reply ->d_func()->autoDecompress = false;337 replyPrivate->autoDecompress = false; 335 338 } 336 if (reply && reply->d_func()->statusCode == 100) {337 reply ->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;339 if (replyPrivate->statusCode == 100) { 340 replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; 338 341 break; // ignore 339 342 } 340 if (reply ->d_func()->shouldEmitSignals())343 if (replyPrivate->shouldEmitSignals()) 341 344 emit reply->headerChanged(); 342 if (!reply ->d_func()->expectContent()) {343 reply ->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;345 if (!replyPrivate->expectContent()) { 346 replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState; 344 347 this->state = QHttpNetworkConnectionChannel::IdleState; 345 348 allDone(); … … 348 351 } 349 352 break; 353 } 350 354 case QHttpNetworkReplyPrivate::ReadingDataState: { 351 if (!reply->d_func()->isChunked() && !reply->d_func()->autoDecompress 352 && reply->d_func()->bodyLength > 0) { 355 QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); 356 if (replyPrivate->downstreamLimited && !replyPrivate->responseData.isEmpty() && replyPrivate->shouldEmitSignals()) { 357 // We already have some HTTP body data. We don't read more from the socket until 358 // this is fetched by QHttpNetworkAccessHttpBackend. If we would read more, 359 // we could not limit our read buffer usage. 360 // We only do this when shouldEmitSignals==true because our HTTP parsing 361 // always needs to parse the 401/407 replies. Therefore they don't really obey 362 // to the read buffer maximum size, but we don't care since they should be small. 363 return; 364 } 365 366 if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress 367 && replyPrivate->bodyLength > 0) { 353 368 // bulk files like images should fulfill these properties and 354 369 // we can therefore save on memory copying 355 bytes = reply ->d_func()->readBodyFast(socket, &reply->d_func()->responseData);356 reply ->d_func()->totalProgress += bytes;357 if (reply ->d_func()->shouldEmitSignals()) {370 bytes = replyPrivate->readBodyFast(socket, &replyPrivate->responseData); 371 replyPrivate->totalProgress += bytes; 372 if (replyPrivate->shouldEmitSignals()) { 358 373 QPointer<QHttpNetworkReply> replyPointer = reply; 359 374 emit reply->readyRead(); … … 361 376 if (replyPointer.isNull()) 362 377 return; 363 emit reply->dataReadProgress(reply ->d_func()->totalProgress, reply->d_func()->bodyLength);378 emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); 364 379 // make sure that the reply is valid 365 380 if (replyPointer.isNull()) … … 372 387 // no content-length etc) 373 388 QByteDataBuffer byteDatas; 374 bytes = reply ->d_func()->readBody(socket, &byteDatas);389 bytes = replyPrivate->readBody(socket, &byteDatas); 375 390 if (bytes) { 376 if (reply ->d_func()->autoDecompress)377 reply ->d_func()->appendCompressedReplyData(byteDatas);391 if (replyPrivate->autoDecompress) 392 replyPrivate->appendCompressedReplyData(byteDatas); 378 393 else 379 reply ->d_func()->appendUncompressedReplyData(byteDatas);380 381 if (!reply ->d_func()->autoDecompress) {382 reply ->d_func()->totalProgress += bytes;383 if (reply ->d_func()->shouldEmitSignals()) {394 replyPrivate->appendUncompressedReplyData(byteDatas); 395 396 if (!replyPrivate->autoDecompress) { 397 replyPrivate->totalProgress += bytes; 398 if (replyPrivate->shouldEmitSignals()) { 384 399 QPointer<QHttpNetworkReply> replyPointer = reply; 385 400 // important: At the point of this readyRead(), the byteDatas list must be empty, … … 389 404 if (replyPointer.isNull()) 390 405 return; 391 emit reply->dataReadProgress(reply ->d_func()->totalProgress, reply->d_func()->bodyLength);406 emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength); 392 407 // make sure that the reply is valid 393 408 if (replyPointer.isNull()) … … 402 417 } 403 418 } 404 if (reply ->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState)419 if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState) 405 420 break; 406 421 // everything done, fall through … … 418 433 bool QHttpNetworkConnectionChannel::ensureConnection() 419 434 { 435 QAbstractSocket::SocketState socketState = socket->state(); 436 437 // resend this request after we receive the disconnected signal 438 if (socketState == QAbstractSocket::ClosingState) { 439 resendCurrent = true; 440 return false; 441 } 442 443 // already trying to connect? 444 if (socketState == QAbstractSocket::HostLookupState || 445 socketState == QAbstractSocket::ConnectingState) { 446 return false; 447 } 448 420 449 // make sure that this socket is in a connected state, if not initiate 421 450 // connection to the host. 422 if (socket ->state()!= QAbstractSocket::ConnectedState) {451 if (socketState != QAbstractSocket::ConnectedState) { 423 452 // connect to the host if not already connected. 424 // resend this request after we receive the disconnected signal425 if (socket->state() == QAbstractSocket::ClosingState) {426 resendCurrent = true;427 return false;428 }429 453 state = QHttpNetworkConnectionChannel::ConnectingState; 430 454 pendingEncrypt = connection->d_func()->encrypt; … … 568 592 569 593 // continue reading 570 receiveReply();594 _q_receiveReply(); 571 595 } 572 596 } else if (alreadyPipelinedRequests.isEmpty() && socket->bytesAvailable() > 0) { … … 617 641 { 618 642 char c; 619 while (socket->bytesAvailable()) { 620 if (socket->peek(&c, 1) != 1) 643 do { 644 qint64 ret = socket->peek(&c, 1); 645 646 // nothing read, fine. 647 if (ret == 0) 621 648 return; 649 650 // EOF from socket? 651 if (ret == -1) 652 return; // FIXME, we need to stop processing. however the next stuff done will also do that. 622 653 623 654 // read all whitespace and line endings … … 628 659 break; 629 660 } 630 } 661 } while(true); 631 662 } 632 663 … … 740 771 state = QHttpNetworkConnectionChannel::ReadingState; 741 772 if (reply) 742 receiveReply();773 _q_receiveReply(); 743 774 } 744 775 } … … 759 790 state = QHttpNetworkConnectionChannel::ReadingState; 760 791 if (reply) 761 receiveReply();792 _q_receiveReply(); 762 793 } else if (state == QHttpNetworkConnectionChannel::IdleState && resendCurrent) { 763 794 // re-sending request because the socket was in ClosingState … … 842 873 } 843 874 QPointer<QObject> that = connection; 844 QString errorString = connection->d_func()->errorDetail(errorCode, socket );875 QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); 845 876 if (send2Reply) { 846 877 if (reply) { -
trunk/src/network/access/qhttpnetworkconnectionchannel_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 145 145 146 146 bool sendRequest(); 147 void receiveReply();148 147 149 148 bool ensureConnection(); … … 167 166 168 167 protected slots: 168 void _q_receiveReply(); 169 169 void _q_bytesWritten(qint64 bytes); // proceed sending 170 170 void _q_readyRead(); // pending data to read -
trunk/src/network/access/qhttpnetworkheader.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttpnetworkheader_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttpnetworkreply.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 180 180 { 181 181 Q_D(QHttpNetworkReply); 182 // we'll take the last buffer, so schedule another read from http 183 if (d->downstreamLimited && d->responseData.bufferCount() == 1) 184 d->connection->d_func()->readMoreLater(this); 182 185 return d->responseData.read(); 186 } 187 188 void QHttpNetworkReply::setDownstreamLimited(bool dsl) 189 { 190 Q_D(QHttpNetworkReply); 191 d->downstreamLimited = dsl; 192 d->connection->d_func()->readMoreLater(this); 183 193 } 184 194 … … 202 212 currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), 203 213 autoDecompress(false), responseData(), requestIsPrepared(false) 204 ,pipeliningUsed(false) 214 ,pipeliningUsed(false), downstreamLimited(false) 205 215 { 206 216 } -
trunk/src/network/access/qhttpnetworkreply_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 126 126 qint64 bytesAvailableNextBlock() const; 127 127 QByteArray readAny(); 128 void setDownstreamLimited(bool t); 128 129 129 130 bool isFinished() const; … … 230 231 231 232 bool pipeliningUsed; 233 bool downstreamLimited; 232 234 }; 233 235 -
trunk/src/network/access/qhttpnetworkrequest.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qhttpnetworkrequest_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessbackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 162 162 } 163 163 164 void QNetworkAccessBackend::setDownstreamLimited(bool b) 165 { 166 Q_UNUSED(b); 167 // do nothing 168 } 169 164 170 void QNetworkAccessBackend::copyFinished(QIODevice *) 165 171 { -
trunk/src/network/access/qnetworkaccessbackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 117 117 // slot-like: 118 118 virtual void downstreamReadyWrite(); 119 virtual void setDownstreamLimited(bool b); 119 120 virtual void copyFinished(QIODevice *); 120 121 virtual void ignoreSslErrors(); -
trunk/src/network/access/qnetworkaccesscache.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccesscache_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccesscachebackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccesscachebackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessdatabackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessdatabackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessdebugpipebackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessdebugpipebackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessfilebackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessfilebackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessftpbackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessftpbackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccesshttpbackend.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 145 145 pos = end + 1; 146 146 147 if ( equal != -1) {147 if (uint(equal) < uint(comma)) { 148 148 // case: token "=" (token | quoted-string) 149 149 // skip spaces … … 394 394 httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); 395 395 396 it = cacheHeaders.findRawHeader("Cache-Control"); 397 if (it != cacheHeaders.rawHeaders.constEnd()) { 398 QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); 399 if (cacheControl.contains("must-revalidate")) 400 return; 401 } 402 396 if (CacheLoadControlAttribute == QNetworkRequest::PreferNetwork) { 397 it = cacheHeaders.findRawHeader("Cache-Control"); 398 if (it != cacheHeaders.rawHeaders.constEnd()) { 399 QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); 400 if (cacheControl.contains("must-revalidate")) 401 return; 402 } 403 } 404 405 QDateTime currentDateTime = QDateTime::currentDateTime(); 406 QDateTime expirationDate = metaData.expirationDate(); 407 408 #if 0 403 409 /* 404 410 * age_value … … 416 422 * is the current (local) time 417 423 */ 418 QDateTime currentDateTime = QDateTime::currentDateTime();419 424 int age_value = 0; 420 425 it = cacheHeaders.findRawHeader("age"); 421 426 if (it != cacheHeaders.rawHeaders.constEnd()) 422 age_value = QNetworkHeadersPrivate::fromHttpDate(it->second).toTime_t(); 423 427 age_value = it->second.toInt(); 428 429 QDateTime dateHeader; 424 430 int date_value = 0; 425 431 it = cacheHeaders.findRawHeader("date"); 426 if (it != cacheHeaders.rawHeaders.constEnd()) 427 date_value = QNetworkHeadersPrivate::fromHttpDate(it->second).toTime_t(); 432 if (it != cacheHeaders.rawHeaders.constEnd()) { 433 dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second); 434 date_value = dateHeader.toTime_t(); 435 } 428 436 429 437 int now = currentDateTime.toUTC().toTime_t(); … … 431 439 int response_time = now; 432 440 441 // Algorithm from RFC 2616 section 13.2.3 433 442 int apparent_age = qMax(0, response_time - date_value); 434 443 int corrected_received_age = qMax(apparent_age, age_value); … … 439 448 440 449 // RFC 2616 13.2.4 Expiration Calculations 441 QDateTime expirationDate = metaData.expirationDate();442 450 if (!expirationDate.isValid()) { 443 451 if (lastModified.isValid()) { … … 454 462 } 455 463 456 int freshness_lifetime = currentDateTime.secsTo(expirationDate); 464 // the cache-saving code below sets the expirationDate with date+max_age 465 // if "max-age" is present, or to Expires otherwise 466 int freshness_lifetime = dateHeader.secsTo(expirationDate); 457 467 bool response_is_fresh = (freshness_lifetime > current_age); 458 459 if (!response_is_fresh && CacheLoadControlAttribute == QNetworkRequest::PreferNetwork) 468 #else 469 bool response_is_fresh = currentDateTime.secsTo(expirationDate) >= 0; 470 #endif 471 472 if (!response_is_fresh) 460 473 return; 461 474 … … 582 595 cacheProxy.type() == QNetworkProxy::DefaultProxy) { 583 596 // unsuitable proxies 584 error(QNetworkReply::ProxyNotFoundError, 585 tr("No suitable proxy found")); 586 finished(); 597 QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, 598 Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError), 599 Q_ARG(QString, tr("No suitable proxy found"))); 600 QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 587 601 return; 588 602 } … … 642 656 if (httpReply && httpReply->bytesAvailable() == 0 && httpReply->isFinished()) 643 657 replyFinished(); 658 } 659 660 void QNetworkAccessHttpBackend::setDownstreamLimited(bool b) 661 { 662 if (httpReply) 663 httpReply->setDownstreamLimited(b); 644 664 } 645 665 -
trunk/src/network/access/qnetworkaccesshttpbackend_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 83 83 84 84 virtual void downstreamReadyWrite(); 85 virtual void setDownstreamLimited(bool b); 86 85 87 virtual void copyFinished(QIODevice *); 86 88 #ifndef QT_NO_OPENSSL … … 105 107 void httpError(QNetworkReply::NetworkError error, const QString &errorString); 106 108 bool sendCacheContents(const QNetworkCacheMetaData &metaData); 109 void finished(); // override 107 110 108 111 private: … … 119 122 120 123 void disconnectFromHttp(); 121 void finished(); // override122 124 void setupConnection(); 123 125 void validateCache(QHttpNetworkRequest &httpRequest, bool &loadedFromCache); -
trunk/src/network/access/qnetworkaccessmanager.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 688 688 // The QNetworkAccessFileBackend will right now only be used 689 689 // for PUT or qrc:// 690 if ( op == QNetworkAccessManager::GetOperation690 if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) 691 691 && (req.url().scheme() == QLatin1String("file") 692 692 || req.url().scheme().isEmpty())) { 693 return new QFileNetworkReply(this, req );693 return new QFileNetworkReply(this, req, op); 694 694 } 695 695 … … 724 724 priv->backend = d->findBackend(op, request); 725 725 726 // fourth step: setup the reply727 priv->setup(op, request, outgoingData);728 726 #ifndef QT_NO_NETWORKPROXY 729 727 QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); … … 734 732 priv->backend->reply = priv; 735 733 } 734 // fourth step: setup the reply 735 priv->setup(op, request, outgoingData); 736 736 737 737 #ifndef QT_NO_OPENSSL -
trunk/src/network/access/qnetworkaccessmanager.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkaccessmanager_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookie.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookie.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookie_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookiejar.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookiejar.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkcookiejar_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkdiskcache.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkdiskcache.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkdiskcache_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkreply.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 240 240 signal. Use deleteLater(). 241 241 242 \sa QNetworkAccessManager::finished() 242 You can also use isFinished() to check if a QNetworkReply 243 has finished even before you receive the finished() signal. 244 245 \sa QNetworkAccessManager::finished(), isFinished() 243 246 */ 244 247 -
trunk/src/network/access/qnetworkreply.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkreply_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkreplyimpl.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 73 73 state = Working; 74 74 75 // note: if that method is called directly, it cannot happen that the backend is 0, 76 // because we just checked via a qobject_cast that we got a http backend (see 77 // QNetworkReplyImplPrivate::setup()) 75 78 if (!backend) { 76 79 error(QNetworkReplyImpl::ProtocolUnknownError, … … 203 206 } 204 207 } 205 206 208 207 209 void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, … … 247 249 // or no backend 248 250 // if no backend, _q_startOperation will handle the error of this 249 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); 251 252 // for HTTP, we want to send out the request as fast as possible to the network, without 253 // invoking methods in a QueuedConnection 254 if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) { 255 _q_startOperation(); 256 } else { 257 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); 258 } 250 259 } 251 260 … … 644 653 645 654 QNetworkReply::setReadBufferSize(size); 655 656 if (d->backend) 657 d->backend->setDownstreamLimited(d->readBufferMaxSize > 0); 646 658 } 647 659 -
trunk/src/network/access/qnetworkreplyimpl_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkrequest.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkrequest.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/network/access/qnetworkrequest_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com)
Note:
See TracChangeset
for help on using the changeset viewer.