In RedirectFollower, don't emit readyRead() from replies that contain a redirect header. Fixes issue 3000

This commit is contained in:
David Sansome 2012-06-14 13:50:49 +01:00
parent 4da488d6f0
commit 404deff537
2 changed files with 11 additions and 1 deletions

View File

@ -144,13 +144,22 @@ RedirectFollower::RedirectFollower(QNetworkReply* first_reply, int max_redirects
}
void RedirectFollower::ConnectReply(QNetworkReply* reply) {
connect(reply, SIGNAL(readyRead()), SIGNAL(readyRead()));
connect(reply, SIGNAL(readyRead()), SLOT(ReadyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SIGNAL(error(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(downloadProgress(qint64,qint64)));
connect(reply, SIGNAL(uploadProgress(qint64,qint64)), SIGNAL(uploadProgress(qint64,qint64)));
connect(reply, SIGNAL(finished()), SLOT(ReplyFinished()));
}
void RedirectFollower::ReadyRead() {
// Don't re-emit this signal for redirect replies.
if (current_reply_->attribute(QNetworkRequest::RedirectionTargetAttribute).isValid()) {
return;
}
emit readyRead();
}
void RedirectFollower::ReplyFinished() {
current_reply_->deleteLater();

View File

@ -104,6 +104,7 @@ signals:
void finished();
private slots:
void ReadyRead();
void ReplyFinished();
private: