From b459f1b3e5355b30a51e9d12a35d8aee6a842886 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 12 May 2017 12:55:39 +0900 Subject: BaseJob: Do not leak access token into the job configuration Before the access token was added to Private::requestQuery on every sendRequest() invocation, leading to the same access token being added up to the request once more with each retry. --- jobs/basejob.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'jobs/basejob.cpp') diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 3e2ecd54..c71616a6 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -125,9 +125,10 @@ void BaseJob::Private::sendRequest() { QUrl url = connection->baseUrl(); url.setPath( url.path() + "/" + apiEndpoint ); + QUrlQuery q = requestQuery; if (needsToken) - requestQuery.addQueryItem("access_token", connection->accessToken()); - url.setQuery(requestQuery); + q.addQueryItem("access_token", connection->accessToken()); + url.setQuery(q); QNetworkRequest req {url}; req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); @@ -234,6 +235,9 @@ void BaseJob::finishJob() if ((error() == NetworkError || error() == TimeoutError) && d->retriesTaken < d->maxRetries) { + // TODO: The whole retrying thing should be put to ConnectionManager + // otherwise independently retrying jobs make a bit of notification + // storm towards the UI. const auto retryInterval = getNextRetryInterval(); ++d->retriesTaken; qCWarning(JOBS) << this << "will take retry" << d->retriesTaken -- cgit v1.2.3