FTP: Workaround for servers without HELP command support
Ignores errors produced by the HELP command. It will continue executing the commands sent to QFtp when a server does not have a HELP command implemented. Commands SIZE, MDTM, and PWD are not going to be used if the HELP command failed. [ChangeLog][QtNetwork][QNetworkAccessManager] Don't fail when FTP does not implement the HELP command. Task-number: QTBUG-69477 Change-Id: I0ebd51b134535730c6bef83de1abf1a427b8d2ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
9a6a847311
commit
8e82e536cd
@ -2122,6 +2122,17 @@ void QFtp::abort()
|
||||
d_func()->pi.abort();
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Clears the last error.
|
||||
|
||||
\sa currentCommand()
|
||||
*/
|
||||
void QFtp::clearError()
|
||||
{
|
||||
d_func()->error = NoError;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Returns the identifier of the FTP command that is being executed
|
||||
|
@ -157,6 +157,9 @@ Q_SIGNALS:
|
||||
void commandFinished(int, bool);
|
||||
void done(bool);
|
||||
|
||||
protected:
|
||||
void clearError();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(QFtp)
|
||||
Q_DECLARE_PRIVATE(QFtp)
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
connect(this, SIGNAL(done(bool)), this, SLOT(deleteLater()));
|
||||
close();
|
||||
}
|
||||
|
||||
using QFtp::clearError;
|
||||
};
|
||||
|
||||
QNetworkAccessFtpBackend::QNetworkAccessFtpBackend()
|
||||
@ -282,7 +284,10 @@ void QNetworkAccessFtpBackend::ftpDone()
|
||||
}
|
||||
|
||||
// check for errors:
|
||||
if (ftp->error() != QFtp::NoError) {
|
||||
if (state == CheckingFeatures && ftp->error() == QFtp::UnknownError) {
|
||||
qWarning("QNetworkAccessFtpBackend: HELP command failed, ignoring it");
|
||||
ftp->clearError();
|
||||
} else if (ftp->error() != QFtp::NoError) {
|
||||
QString msg;
|
||||
if (operation() == QNetworkAccessManager::GetOperation)
|
||||
msg = tr("Error while downloading %1: %2");
|
||||
|
Loading…
Reference in New Issue
Block a user