mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
always enable http2
Nextcloud server documentation is recommending enabling http2 for performance resons https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-http-2-for-faster-loading Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
ab06ecbc4d
commit
b47d09bc30
1 changed files with 1 additions and 10 deletions
|
@ -66,16 +66,7 @@ QNetworkReply *AccessManager::createRequest(QNetworkAccessManager::Operation op,
|
||||||
QByteArray requestId = generateRequestId();
|
QByteArray requestId = generateRequestId();
|
||||||
qInfo(lcAccessManager) << op << verb << newRequest.url().toString() << "has X-Request-ID" << requestId;
|
qInfo(lcAccessManager) << op << verb << newRequest.url().toString() << "has X-Request-ID" << requestId;
|
||||||
newRequest.setRawHeader("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);
|
const auto reply = QNetworkAccessManager::createRequest(op, newRequest, outgoingData);
|
||||||
HttpLogger::logRequest(reply, op, outgoingData);
|
HttpLogger::logRequest(reply, op, outgoingData);
|
||||||
|
|
Loading…
Reference in a new issue