diff options
Diffstat (limited to 'src/network/access/qnetworkreplyimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index b201380..8505a41 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -67,6 +67,8 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() void QNetworkReplyImplPrivate::_q_startOperation() { + Q_Q(QNetworkReplyImpl); + // ensure this function is only being called once if (state == Working) { qDebug("QNetworkReplyImpl::_q_startOperation was called more than once"); @@ -93,6 +95,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() QNetworkSession *session = manager->d_func()->networkSession; if (session) { + QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), + q, SLOT(_q_networkSessionFailed())); + if (!session->isOpen()) session->open(); } else { @@ -247,6 +252,17 @@ void QNetworkReplyImplPrivate::_q_networkSessionOnline() } } +void QNetworkReplyImplPrivate::_q_networkSessionFailed() +{ + // Abort waiting replies. + if (state == WaitingForSession) { + state = Working; + error(QNetworkReplyImpl::UnknownNetworkError, + QCoreApplication::translate("QNetworkReply", "Network session error.")); + finished(); + } +} + void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) { @@ -707,6 +723,13 @@ void QNetworkReplyImpl::close() d->finished(); } +bool QNetworkReplyImpl::canReadLine () const +{ + Q_D(const QNetworkReplyImpl); + return QNetworkReply::canReadLine() || d->readBuffer.canReadLine(); +} + + /*! Returns the number of bytes available for reading with QIODevice::read(). The number of bytes available may grow until |