Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/libsync/abstractnetworkjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "common/asserts.h"

Check failure on line 7 in src/libsync/abstractnetworkjob.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/abstractnetworkjob.cpp:7:10 [clang-diagnostic-error]

'common/asserts.h' file not found
#include "networkjobs.h"
#include "account.h"
#include "owncloudpropagator.h"
Expand Down Expand Up @@ -211,6 +211,12 @@
}

if (_reply->error() != QNetworkReply::NoError) {
if (!_wasRetriedAfterConnectionClosed && _reply->error() == QNetworkReply::RemoteHostClosedError) {
qCWarning(lcNetworkJob()) << "Will retry sending the request once when we detect a remote host closed error";
_wasRetriedAfterConnectionClosed = true;
retry();
return;
}

if (_account->credentials()->retryIfNeeded(this))
return;
Expand Down
1 change: 1 addition & 0 deletions src/libsync/abstractnetworkjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include "owncloudlib.h"

Check failure on line 9 in src/libsync/abstractnetworkjob.h

View workflow job for this annotation

GitHub Actions / build

src/libsync/abstractnetworkjob.h:9:10 [clang-diagnostic-error]

'owncloudlib.h' file not found

#include "accountfwd.h"
#include "common/asserts.h"
Expand Down Expand Up @@ -210,6 +210,7 @@
QNetworkReply *addTimer(QNetworkReply *reply);
bool _ignoreCredentialFailure = false;
QPointer<QNetworkReply> _reply; // (QPointer because the NetworkManager may be destroyed before the jobs at exit)
bool _wasRetriedAfterConnectionClosed = false;

Check warning on line 213 in src/libsync/abstractnetworkjob.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this identifier to be shorter or equal to 31 characters.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-vB0g92NhhPqB0kzS7&open=AZ-vB0g92NhhPqB0kzS7&pullRequest=10486
QString _path;
QTimer _timer;
int _redirectCount = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/libsync/accessmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <QLoggingCategory>

Check failure on line 7 in src/libsync/accessmanager.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/accessmanager.cpp:7:10 [clang-diagnostic-error]

'QLoggingCategory' file not found
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkProxy>
Expand All @@ -20,6 +20,8 @@
#include "common/utility.h"
#include "httplogger.h"

using namespace Qt::StringLiterals;

namespace OCC {

Q_LOGGING_CATEGORY(lcAccessManager, "nextcloud.sync.accessmanager", QtInfoMsg)
Expand Down Expand Up @@ -117,6 +119,14 @@

const auto reply = QNetworkAccessManager::createRequest(op, newRequest, outgoingData);
HttpLogger::logRequest(reply, op, outgoingData);
QObject::connect(reply, &QNetworkReply::requestSent, reply, [reply] {
qCInfo(lcAccessManager()) << "Request has been sent"
<< reply->url().toString()
<< reply->request().rawHeader("X-Request-ID"_ba)
<< reply->header(QNetworkRequest::ContentTypeHeader).toString()
<< reply->rawHeaderPairs()
<< reply;
});
return reply;
}

Expand Down
Loading