summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-12-14 22:39:30 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-12-21 17:42:22 +0000
commit8cab1238d6ea14fa6a61ed4e0c5d39ccd0736ec2 (patch)
tree79f0a9f1e95dc80ba9b0d5cfaab9edddf27ec73f /Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
parent35655d5f4bad248ead1700b59c381cc568b4e98b (diff)
Import WebKit commit 3b024218447b7838f08ccd8cf2c8515387ae41c2
Change-Id: I0698c3862a53268111308c191c45167e36898dbb Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/platform/network/qt/ResourceRequestQt.cpp')
-rw-r--r--Source/WebCore/platform/network/qt/ResourceRequestQt.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
index b7f9447bc..c54a8115b 100644
--- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -27,6 +27,18 @@
#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)
+#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
+#endif
+
namespace WebCore {
// The limit can be found in qhttpnetworkconnection.cpp.
@@ -57,15 +69,19 @@ static inline QByteArray stringToByteArray(const String& string)
QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const
{
QNetworkRequest request;
- QUrl newurl = toQUrl(url());
- request.setUrl(newurl);
+ const URL& originalUrl = url();
+ request.setUrl(toQUrl(originalUrl));
request.setOriginatingObject(context ? context->originatingObject() : 0);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
- // HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397
- if (newurl.scheme().toLower() == QLatin1String("https"))
- request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
+#if USE(HTTP2)
+#if HTTP2_IS_BUGGY_WITHOUT_HTTPS
+ if (originalUrl.protocolIs("https"))
#endif
+ {
+ request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
+ }
+#endif // USE(HTTP2)
+
const HTTPHeaderMap &headers = httpHeaderFields();
for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end();