1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-04 12:11:33 +02:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Daniel Molkentin
f84e0010ee NSIS: ICU rebumped to 5.3 as per build service change 2014-07-24 10:07:46 +02:00
Klaas Freitag
c97f46d403 Bump version to 1.6.2 rc2 plus Changelog 2014-07-24 09:58:23 +02:00
Klaas Freitag
1fb52f0d8b HTTPCreds: Do delete the WritePasswordJob to not leak memory. 2014-07-23 17:59:02 +02:00
Klaas Freitag
d4de024f15 Propagator: Fix local file name clash detection.
Need to normalize the output of QFileInfo::canonicalFilePath() before
comparing to a server side path.
See https://bugreports.qt-project.org/browse/QTBUG-39622

This fixes #1998 and #1999
2014-07-23 17:56:46 +02:00
Olivier Goffart
1d9d88ca85 Always use the dummy crendential while trying to determine the credentials
Otherwise the SHibbolethCredential may be set and it has hook to intercept 401

This should fix issue #1908
2014-07-23 14:38:50 +02:00
Olivier Goffart
beb9300b4e network limit: Never wait more than 10 seconds
When using the "Limit automatically" limit, we wait for 25% of the time
it took to upload something.
However, if we go to sleep while uploading, the time it took to upload may take
days. And waiting for 25% of a day is too long.
So never wait for more than 10 seconds

This may be related to issue #1880
2014-07-18 12:27:02 +02:00
Olivier Goffart
c35880d4f1 Fix corruption while trying to resume and the server don't suport it
Issue #1982
2014-07-18 12:03:45 +02:00
Klaas Freitag
d8ebebaf12 WinInstaller: No hardcoded www in front of the url on final page. 2014-07-16 18:39:51 +02:00
11 changed files with 100 additions and 26 deletions

View File

@@ -1,6 +1,11 @@
ChangeLog
=========
version 1.6.2 (release 2014-07-x )
* Another small mem leak fixed in HTTP Credentials.
* Fix local file name clash detection for MacOSX.
* Limit maximum wait time to ten seconds in network limiting.
* Fix data corruption while trying to resume and the server does
not support it.
* HTTP Credentials: Read password from legacy place if not found.
* Shibboleth: Fix the waiting curser that would not disapear (#1915)
* Limit memory usage to avoid mem wasting and crashes

View File

@@ -4,7 +4,7 @@ set( MIRALL_VERSION_PATCH 2 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
set( MIRALL_VERSION_SUFFIX "rc1") #e.g. beta1, beta2, rc1
set( MIRALL_VERSION_SUFFIX "rc2") #e.g. beta1, beta2, rc1
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
if( NOT DEFINED MIRALL_VERSION_BUILD )

View File

@@ -111,8 +111,8 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/page_header.bmp
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_LINK "www.${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_LINK "${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_LINK_LOCATION "http://${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
@@ -414,9 +414,9 @@ Section "${APPLICATION_NAME}" SEC_APPLICATION
;Qt deps
File "${MING_BIN}\libpng16-16.dll"
File "${MING_BIN}\icudata51.dll"
File "${MING_BIN}\icui18n51.dll"
File "${MING_BIN}\icuuc51.dll"
File "${MING_BIN}\icudata53.dll"
File "${MING_BIN}\icui18n53.dll"
File "${MING_BIN}\icuuc53.dll"
File "${MING_BIN}\libEGL.dll"
File "${MING_BIN}\libGLESv2.dll"
File "${MING_BIN}\libjpeg-8.dll"

View File

@@ -366,6 +366,8 @@ void HttpCredentials::slotWriteJobDone(QKeychain::Job *job)
default:
qDebug() << "Error while writing password" << job->errorString();
}
WritePasswordJob *wjob = qobject_cast<WritePasswordJob*>(job);
wjob->deleteLater();
}
void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* authenticator)

View File

@@ -337,8 +337,15 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile )
QFileInfo fileInfo(file);
if (!fileInfo.exists()) {
re = false;
qDebug() << Q_FUNC_INFO << "No valid fileinfo";
} else {
re = ( ! fileInfo.canonicalFilePath().endsWith(relFile, Qt::CaseSensitive) );
// Need to normalize to composited form because of
// https://bugreports.qt-project.org/browse/QTBUG-39622
const QString cName = fileInfo.canonicalFilePath().normalized(QString::NormalizationForm_C);
// qDebug() << Q_FUNC_INFO << "comparing " << cName << " with " << file;
bool equal = (file == cName);
re = (!equal && ! cName.endsWith(relFile, Qt::CaseSensitive) );
// qDebug() << Q_FUNC_INFO << "Returning for localFileNameClash: " << re;
}
#elif defined(Q_OS_WIN)
const QString file( _localDir + relFile );

View File

@@ -144,6 +144,8 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString)
}
Account *account = _ocWizard->account();
account->setUrl(url);
// Set fake credentials beforfe we check what credidential it actually is.
account->setCredentials(CredentialsFactory::create("dummy"));
CheckServerJob *job = new CheckServerJob(_ocWizard->account(), false, this);
job->setIgnoreCredentialFailure(true);
connect(job, SIGNAL(instanceFound(QUrl,QVariantMap)), SLOT(slotOwnCloudFoundAuth(QUrl,QVariantMap)));

View File

@@ -328,8 +328,7 @@ void PropagateNeonJob::limitBandwidth(qint64 progress, qint64 bandwidth_limit)
// -bandwidth_limit is the % of bandwidth
int64_t wait_time = -diff * (1 + 100.0 / bandwidth_limit);
if (wait_time > 0) {
Mirall::Utility::usleep(wait_time);
Mirall::Utility::usleep(qMin(wait_time, int64_t(1000000*10)));
}
}
_lastTime.start();
@@ -397,24 +396,39 @@ void PropagateDownloadFileLegacy::install_content_reader( ne_request *req, void
if (etag.isEmpty()) {
qDebug() << Q_FUNC_INFO << "No E-Tag reply by server, considering it invalid" << ne_get_response_header(req, "etag");
that->errorString = tr("No E-Tag received from server, check Proxy/Gateway");
ne_set_error(that->_propagator->_session, "%s", that->errorString.toUtf8().data());
ne_add_response_body_reader( req, do_not_accept,
do_not_download_content_reader,
(void*) that );
that->abortTransfer(req, tr("No E-Tag received from server, check Proxy/Gateway"));
return;
} else if (!that->_expectedEtagForResume.isEmpty() && that->_expectedEtagForResume != etag) {
qDebug() << Q_FUNC_INFO << "We received a different E-Tag for resuming!"
<< QString::fromLatin1(that->_expectedEtagForResume.data()) << "vs"
<< QString::fromLatin1(etag.data());
that->errorString = tr("We received a different E-Tag for resuming. Retrying next time.");
ne_set_error(that->_propagator->_session, "%s", that->errorString.toUtf8().data());
ne_add_response_body_reader( req, do_not_accept,
do_not_download_content_reader,
(void*) that );
that->abortTransfer(req, tr("We received a different E-Tag for resuming. Retrying next time."));
return;
}
quint64 start = 0;
QByteArray ranges = ne_get_response_header(req, "content-range");
if (!ranges.isEmpty()) {
QRegExp rx("bytes (\\d+)-");
if (rx.indexIn(ranges) >= 0) {
start = rx.cap(1).toULongLong();
}
}
if (start != that->_resumeStart) {
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << that->_resumeStart;
if (start == 0) {
// device don't support range, just stry again from scratch
that->_file->close();
if (!that->_file->open(QIODevice::WriteOnly)) {
that->abortTransfer(req, that->_file->errorString());
return;
}
} else {
that->abortTransfer(req, tr("Server returned wrong content-range"));
return;
}
}
const char *enc = ne_get_response_header( req, "Content-Encoding" );
qDebug("Content encoding ist <%s> with status %d", enc ? enc : "empty",
@@ -431,6 +445,16 @@ void PropagateDownloadFileLegacy::install_content_reader( ne_request *req, void
}
}
void PropagateDownloadFileLegacy::abortTransfer(ne_request* req, const QString& error)
{
errorString = error;
ne_set_error(_propagator->_session, "%s", errorString.toUtf8().data());
ne_add_response_body_reader( req, do_not_accept,
do_not_download_content_reader,
this);
}
void PropagateDownloadFileLegacy::notify_status_cb(void* userdata, ne_session_status status,
const ne_session_status_info* info)
{
@@ -521,6 +545,7 @@ void PropagateDownloadFileLegacy::start()
ne_add_request_header(req.data(), "Range", rangeRequest.constData());
ne_add_request_header(req.data(), "Accept-Ranges", "bytes");
qDebug() << "Retry with range " << rangeRequest;
_resumeStart = done;
}
/* hook called before the content is parsed to set the correct reader,

View File

@@ -53,13 +53,14 @@ class PropagateDownloadFileLegacy: public PropagateNeonJob {
Q_OBJECT
public:
explicit PropagateDownloadFileLegacy(OwncloudPropagator* propagator,const SyncFileItem& item)
: PropagateNeonJob(propagator, item), _file(0) {}
: PropagateNeonJob(propagator, item), _file(0), _resumeStart(0) {}
void start();
private:
QFile *_file;
QScopedPointer<ne_decompress, ScopedPointerHelpers> _decompress;
QString errorString;
QByteArray _expectedEtagForResume;
quint64 _resumeStart;
static int do_not_accept (void *userdata, ne_request *req, const ne_status *st)
{
@@ -78,6 +79,9 @@ private:
static void install_content_reader( ne_request *req, void *userdata, const ne_status *status );
static void notify_status_cb(void* userdata, ne_session_status status,
const ne_session_status_info* info);
/** To be called from install_content_reader if we want to abort the transfer */
void abortTransfer(ne_request *req, const QString &error);
};
}

View File

@@ -438,6 +438,34 @@ void GETFileJob::slotMetaDataChanged()
reply()->abort();
return;
}
quint64 start = 0;
QByteArray ranges = parseEtag(reply()->rawHeader("Content-Range"));
if (!ranges.isEmpty()) {
QRegExp rx("bytes (\\d+)-");
if (rx.indexIn(ranges) >= 0) {
start = rx.cap(1).toULongLong();
}
}
if (start != _resumeStart) {
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << _resumeStart;
if (start == 0) {
// device don't support range, just stry again from scratch
_device->close();
if (!_device->open(QIODevice::WriteOnly)) {
_errorString = _device->errorString();
_errorStatus = SyncFileItem::NormalError;
reply()->abort();
return;
}
} else {
_errorString = tr("Server returned wrong content-range");
_errorStatus = SyncFileItem::NormalError;
reply()->abort();
return;
}
}
}
void GETFileJob::slotReadyRead()
@@ -544,7 +572,7 @@ void PropagateDownloadFileQNAM::start()
_job = new GETFileJob(AccountManager::instance()->account(),
_propagator->_remoteFolder + _item._file,
&_tmpFile, headers, expectedEtagForResume);
&_tmpFile, headers, expectedEtagForResume, _startSize);
_job->setTimeout(_propagator->httpTimeout() * 1000);
connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotGetFinished()));
connect(_job, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(slotDownloadProgress(qint64,qint64)));

View File

@@ -105,20 +105,21 @@ private slots:
class GETFileJob : public AbstractNetworkJob {
Q_OBJECT
QIODevice* _device;
QFile* _device;
QMap<QByteArray, QByteArray> _headers;
QString _errorString;
QByteArray _expectedEtagForResume;
quint64 _resumeStart;
SyncFileItem::Status _errorStatus;
public:
// DOES NOT take owncership of the device.
explicit GETFileJob(Account* account, const QString& path, QIODevice *device,
explicit GETFileJob(Account* account, const QString& path, QFile *device,
const QMap<QByteArray, QByteArray> &headers, QByteArray expectedEtagForResume,
QObject* parent = 0)
quint64 resumeStart, QObject* parent = 0)
: AbstractNetworkJob(account, path, parent),
_device(device), _headers(headers), _expectedEtagForResume(expectedEtagForResume),
_errorStatus(SyncFileItem::NoStatus) {}
_resumeStart(resumeStart), _errorStatus(SyncFileItem::NoStatus) {}
virtual void start();
virtual bool finished() {