summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2017-07-31 14:58:29 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-09-04 07:27:03 +0000
commit50eb44cc9bd47fd91e01d36e0cb0d124cfc6e736 (patch)
treec8f95518f7a9b2ac6842d365f019fbc6ab935817 /src/network/access/qnetworkreplyhttpimpl.cpp
parent75b5db3ce69e981132c86e90820d59becb874d4a (diff)
Introduce Http2DirectAttribute
Now that we have a proper ALPN/NPN + Protocol Upgrade, we can also add H2Direct - this can be useful for our users that have to work with either Secure Transport or a TLS implementation not supporting ALPN/NPN and with 'h2direct' servers in case they have prior knowledge of HTTP/2 support. The difference with RFC 7540 is the fact we also allow this 'direct' in case of 'https' scheme (it appears existing HTTP/2 server implementations support such mode too). [ChangeLog][QtNetwork] Add Http2DirectAttribute to enable 'direct' HTTP/2 protocol without ALPN/NPN and without protocol upgrade negotiations. Task-number: QTBUG-61397 Change-Id: I0499d33ec45dede765890059fd9542dab236bd5d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 84b1ddf5ac..55eb7d4f08 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -762,6 +762,12 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
if (request.attribute(QNetworkRequest::HTTP2AllowedAttribute).toBool())
httpRequest.setHTTP2Allowed(true);
+ if (request.attribute(QNetworkRequest::Http2DirectAttribute).toBool()) {
+ // Intentionally mutually exclusive - cannot be both direct and 'allowed'
+ httpRequest.setHTTP2Direct(true);
+ httpRequest.setHTTP2Allowed(false);
+ }
+
if (static_cast<QNetworkRequest::LoadControl>
(newHttpRequest.attribute(QNetworkRequest::AuthenticationReuseAttribute,
QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
@@ -1239,7 +1245,9 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
const QVariant http2Allowed = request.attribute(QNetworkRequest::HTTP2AllowedAttribute);
- if (http2Allowed.isValid() && http2Allowed.toBool()) {
+ const QVariant http2Direct = request.attribute(QNetworkRequest::Http2DirectAttribute);
+ if ((http2Allowed.isValid() && http2Allowed.toBool())
+ || (http2Direct.isValid() && http2Direct.toBool())) {
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, spdyWasUsed);
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, false);
} else {