diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-01-12 14:45:47 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-07-08 16:22:32 +0000 |
commit | b2c0f9713c1c39bc3214df49f0d2b44bcc84d790 (patch) | |
tree | 6a8eee65f90dd67968fd239606354d49f2202342 /src/network/access/qhttpnetworkconnectionchannel.cpp | |
parent | 6f61cfc33810054173a17443b20bfa2dce737285 (diff) |
HTTP2 protocol handler
Add HTTP2 support in QNAM - QHttp2ProtocolHandler + aux. classes.
[ChangeLog][QtNetwork] Added support for HTTP/2 protocol
Task-number: QTBUG-50956
Change-Id: I3a119cfbb1fb3118d9003225f5e54b46ae2829b6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 2f7be01078..791a7495c0 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -47,6 +47,7 @@ #ifndef QT_NO_HTTP +#include <private/qhttp2protocolhandler_p.h> #include <private/qhttpprotocolhandler_p.h> #include <private/qspdyprotocolhandler_p.h> @@ -971,7 +972,8 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket } while (!connection->d_func()->highPriorityQueue.isEmpty() || !connection->d_func()->lowPriorityQueue.isEmpty()); #ifndef QT_NO_SSL - if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || + connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values(); for (int a = 0; a < spdyPairs.count(); ++a) { // emit error for all replies @@ -1003,7 +1005,8 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth) { #ifndef QT_NO_SSL - if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || + connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); } else { // HTTP #endif // QT_NO_SSL @@ -1043,6 +1046,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted() // no need to re-queue requests, if SPDY was enabled on the request it // has gone to the SPDY queue already break; + } else if (nextProtocol == QSslConfiguration::ALPNProtocolHTTP2) { + protocolHandler.reset(new QHttp2ProtocolHandler(this)); + connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP2); + break; } else { emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); @@ -1066,7 +1073,8 @@ void QHttpNetworkConnectionChannel::_q_encrypted() state = QHttpNetworkConnectionChannel::IdleState; pendingEncrypt = false; - if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || + connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { // we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent if (spdyRequestsToSend.count() > 0) // wait for data from the server first (e.g. initial window, max concurrent requests) |