1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-04-25 19:15:47 +02:00

Merge pull request from nextcloud/backport/1495/stable-2.6

[stable-2.6] Add a 'Content-Length: 0' header to initial POST requests
This commit is contained in:
Michael Schuster 2019-10-10 08:11:43 +02:00 committed by GitHub
commit 913894eaa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,11 @@ void Flow2Auth::openBrowser()
// Step 1: Initiate a login, do an anonymous POST request
QUrl url = Utility::concatUrlPath(_account->url().toString(), QLatin1String("/index.php/login/v2"));
auto job = _account->sendRequest("POST", url);
// add 'Content-Length: 0' header (see https://github.com/nextcloud/desktop/issues/1473)
QNetworkRequest req;
req.setHeader(QNetworkRequest::ContentLengthHeader, "0");
auto job = _account->sendRequest("POST", url, req);
job->setTimeout(qMin(30 * 1000ll, job->timeoutMsec()));
QObject::connect(job, &SimpleNetworkJob::finishedSignal, this, [this](QNetworkReply *reply) {