diff options
Diffstat (limited to 'Source/WebCore/platform/network/qt/ResourceRequestQt.cpp')
-rw-r--r-- | Source/WebCore/platform/network/qt/ResourceRequestQt.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index c54a8115b..694e2a764 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -27,16 +27,20 @@ #include <QNetworkRequest> #include <QUrl> -// HTTP/2 is implemented since Qt 5.8, but QTBUG-64359 makes it unusable in browser -#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 4) +// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 +// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be +// enabled manually by user application via custom QNAM subclass +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#include <QSslSocket> #define USE_HTTP2 1 -#endif -// HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397 -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 1 -#else -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 0 +// Don't enable HTTP/2 when ALPN support status is unknown +// Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version +static bool alpnIsSupported() +{ + return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && + QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); +} #endif namespace WebCore { @@ -74,15 +78,11 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co request.setOriginatingObject(context ? context->originatingObject() : 0); #if USE(HTTP2) -#if HTTP2_IS_BUGGY_WITHOUT_HTTPS - if (originalUrl.protocolIs("https")) -#endif - { + static const bool NegotiateHttp2ForHttps = alpnIsSupported(); + if (originalUrl.protocolIs("https") && NegotiateHttp2ForHttps) request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); - } #endif // USE(HTTP2) - const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) { |