summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpthreaddelegate.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-07-14 16:49:16 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-08-03 15:31:20 +0000
commit12d71f4ea20415ff2274e1e90f9e4d5a8b935d7f (patch)
tree8ba8d02c73305bb533267bbe3784fc6e607716ad /src/network/access/qhttpthreaddelegate.cpp
parentd7132c6c6d3bb9d1362744f36b2995b1d2daf4fe (diff)
Implement protocol upgrade for HTTP/2 enabled requests
Without ALPN/NPN (== without OpenSSL) we can negotiate HTTP/2 using the protocol upgrade procedure as described by RFC7540. Since there is no TLS handshake, after our http channel was connected we first send an 'augmented' HTTP/1.1 request - its header contains additional 'HTTP2-Settings' and 'Upgrade' (to 'h2c') fields. If we receive reponse 101 (switch protocol) we re-create a protocol handler and switch to HTTP/2. Task-number: QTBUG-50955 Change-Id: I36e9985e06ba76edaf7fdb22bb43770f8d593c61 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access/qhttpthreaddelegate.cpp')
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index e16519c2f2..8b200ebc04 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -286,9 +286,12 @@ void QHttpThreadDelegate::startRequest()
QHttpNetworkConnection::ConnectionType connectionType
= QHttpNetworkConnection::ConnectionTypeHTTP;
+
+ if (httpRequest.isHTTP2Allowed())
+ connectionType = QHttpNetworkConnection::ConnectionTypeHTTP2;
+
#ifndef QT_NO_SSL
if (httpRequest.isHTTP2Allowed() && ssl) {
- connectionType = QHttpNetworkConnection::ConnectionTypeHTTP2;
QList<QByteArray> protocols;
protocols << QSslConfiguration::ALPNProtocolHTTP2
<< QSslConfiguration::NextProtocolHttp1_1;