From b1363d1a79113d78890fa9bada78c3e89b6e8dd0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 13 Jun 2017 15:29:01 +0200 Subject: [PATCH] AccessManager: Disable HTTP/2 without TLS Qt would otherwise still try to do HTTP/2 connection even over "http://". And that does not work with server that does not support it --- src/libsync/accessmanager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libsync/accessmanager.cpp b/src/libsync/accessmanager.cpp index e9f485d93..fb131b02c 100644 --- a/src/libsync/accessmanager.cpp +++ b/src/libsync/accessmanager.cpp @@ -94,8 +94,11 @@ QNetworkReply *AccessManager::createRequest(QNetworkAccessManager::Operation op, newRequest.setRawHeader("X-Request-ID", requestId); #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) - // only enable HTTP2 with Qt 5.9 because Qt 5.8.0 has too many bugs (only use one connection if the server does not support HTTP2) - newRequest.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); + // only enable HTTP2 with Qt 5.9 because Qt 5.8.0 has too many bugs + // (only use one connection if the server does not support HTTP2) + if (newRequest.url().scheme() == "https") { // Not for "http": QTBUG-61397 + newRequest.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); + } #endif return QNetworkAccessManager::createRequest(op, newRequest, outgoingData);