Merge remote-tracking branch 'origin/1.6' into il

Conflicts:
	VERSION.cmake
	src/mirall/propagator_qnam.cpp
	src/mirall/propagator_qnam.h
This commit is contained in:
Olivier Goffart 2014-07-18 16:59:29 +02:00
Родитель 336e74b992 beb9300b4e
Коммит 81d786733d
8 изменённых файлов: 112 добавлений и 28 удалений

Просмотреть файл

@ -1,5 +1,14 @@
ChangeLog
=========
version 1.6.2 (release 2014-07-x )
* 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
* Propagator: Fix crash when logging out during upload (#1957)
* Propagator_qnam: Fix signal slot connection (#1963)
* Use more elaborated way to detect that the server was reconfigured (#1948)
* Setup Wizard: Reconfigure Server also if local path was changed (#1948)
version 1.6.1 (release 2014-06-26 )
* Fix 'precondition failed' bug with broken upload
* Fix openSSL problems for windows deployment

Просмотреть файл

@ -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

Просмотреть файл

@ -111,6 +111,15 @@ void OwncloudSetupWizard::startWizard()
}
_ocWizard->setProperty("localFolder", localFolder);
// remember the local folder to compare later if it changed, but clean first
QString lf = QDir::fromNativeSeparators(localFolder);
if( !lf.endsWith(QLatin1Char('/'))) {
lf.append(QLatin1Char('/'));
}
_initLocalFolder = lf;
_ocWizard->setRemoteFolder(_remoteFolder);
_ocWizard->setStartId(WizardCommon::Page_ServerSetup);
@ -392,10 +401,17 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
Account *newAccount = _ocWizard->account();
Account *origAccount = AccountManager::instance()->account();
const QString localFolder = _ocWizard->localFolder();
QString localFolder = QDir::fromNativeSeparators(_ocWizard->localFolder());
if( !localFolder.endsWith(QLatin1Char('/'))) {
localFolder.append(QLatin1Char('/'));
}
bool isInitialSetup = (origAccount == 0);
bool reinitRequired = newAccount->changed(origAccount, true /* ignoreProtocol, allows http->https */);
// check if either the account or the local folder changed, than reinit
bool reinitRequired = _initLocalFolder != localFolder ||
newAccount->changed(origAccount, true /* ignoreProtocol, allows http->https */);
bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool();
// This distinguishes three possibilities:

Просмотреть файл

@ -94,6 +94,7 @@ private:
Account* _account;
OwncloudWizard* _ocWizard;
QString _initLocalFolder;
QString _remoteFolder;
};

Просмотреть файл

@ -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)
{
@ -525,6 +549,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,

Просмотреть файл

@ -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);
};
}

Просмотреть файл

@ -395,20 +395,20 @@ void PropagateUploadFileQNAM::abort()
///////////////////////////////////////////////////////////////////////////////////////////////////
// DOES NOT take owncership of the device.
GETFileJob::GETFileJob(Account* account, const QString& path, QIODevice *device,
GETFileJob::GETFileJob(Account* account, const QString& path, QFile *device,
const QMap<QByteArray, QByteArray> &headers, QByteArray expectedEtagForResume,
QObject* parent)
quint64 _resumeStart, QObject* parent)
: AbstractNetworkJob(account, path, parent),
_device(device), _headers(headers), _expectedEtagForResume(expectedEtagForResume),
_errorStatus(SyncFileItem::NoStatus)
_resumeStart(_resumeStart) , _errorStatus(SyncFileItem::NoStatus)
{
}
GETFileJob::GETFileJob(Account* account, const QUrl& url, QIODevice *device,
GETFileJob::GETFileJob(Account* account, const QUrl& url, QFile *device,
const QMap<QByteArray, QByteArray> &headers,
QObject* parent)
: AbstractNetworkJob(account, url.toEncoded(), parent),
_device(device), _headers(headers),
_device(device), _headers(headers), _resumeStart(0),
_errorStatus(SyncFileItem::NoStatus), _directDownloadUrl(url)
{
}
@ -467,6 +467,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()
@ -579,8 +607,8 @@ void PropagateDownloadFileQNAM::start()
if (_item._directDownloadUrl.isEmpty()) {
// Normal job, download from oC instance
_job = new GETFileJob(AccountManager::instance()->account(),
_propagator->_remoteFolder + _item._file,
&_tmpFile, headers, expectedEtagForResume);
_propagator->_remoteFolder + _item._file,
&_tmpFile, headers, expectedEtagForResume, _startSize);
} else {
// We were provided a direct URL, use that one
if (!_item._directDownloadCookies.isEmpty()) {

Просмотреть файл

@ -105,21 +105,22 @@ 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;
QUrl _directDownloadUrl;
QByteArray _etag;
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);
// For directDownloadUrl:
explicit GETFileJob(Account* account, const QUrl& url, QIODevice *device,
explicit GETFileJob(Account* account, const QUrl& url, QFile *device,
const QMap<QByteArray, QByteArray> &headers,
QObject* parent = 0);