From e8d961860e0779c4fa5941a460b92b2646b9e62e Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Sun, 22 Sep 2024 16:43:22 +0800 Subject: [PATCH] Revert "Merge pull request #6986 from nextcloud/feature/alwaysEnableHttp2" This reverts commit 5baec6f128734bc8ed0845ac7a8c269904c1027e, reversing changes made to ab06ecbc4d02c4b18174e8280a8f242da9ea7970. Signed-off-by: Claudio Cambra --- src/libsync/accessmanager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libsync/accessmanager.cpp b/src/libsync/accessmanager.cpp index 52e0d67b53eb8..46d8559f7a596 100644 --- a/src/libsync/accessmanager.cpp +++ b/src/libsync/accessmanager.cpp @@ -66,7 +66,16 @@ QNetworkReply *AccessManager::createRequest(QNetworkAccessManager::Operation op, QByteArray requestId = generateRequestId(); qInfo(lcAccessManager) << op << verb << newRequest.url().toString() << "has X-Request-ID" << requestId; newRequest.setRawHeader("X-Request-ID", requestId); - newRequest.setAttribute(QNetworkRequest::Http2AllowedAttribute, true); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 4) + // only enable HTTP2 with Qt 5.9.4 because old Qt have too many bugs (e.g. QTBUG-64359 is fixed in >= Qt 5.9.4) + if (newRequest.url().scheme() == "https") { // Not for "http": QTBUG-61397 + // http2 seems to cause issues, as with our recommended server setup we don't support http2, disable it by default for now + static const bool http2EnabledEnv = qEnvironmentVariableIntValue("OWNCLOUD_HTTP2_ENABLED") == 1; + + newRequest.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2EnabledEnv); + } +#endif const auto reply = QNetworkAccessManager::createRequest(op, newRequest, outgoingData); HttpLogger::logRequest(reply, op, outgoingData);