From 1de244ea65f1b40c488fe92b29170c1b1d447233 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 22 Jan 2014 14:54:21 +0100 Subject: network: add support for the SPDY protocol Currently the only supported SPDY version is 3.0. The feature needs to be enabled explicitly via QNetworkRequest::SpdyAllowedAttribute. Whether SPDY actually was used can be determined via QNetworkRequest::SpdyWasUsedAttribute from a QNetworkReply once it has been started (i.e. after the encrypted() signal has been received). Whether SPDY can be used will be determined during the SSL handshake through the TLS NPN extension (see separate commit). The following things from SPDY have not been enabled currently: * server push is not implemented, it has never been seen in the wild; in that case we just reject a stream pushed by the server, which is legit. * settings are not persisted across SPDY sessions. In practice this means that the server sends a small message upon session start telling us e.g. the number of concurrent connections. * SSL client certificates are not supported. Task-number: QTBUG-18714 [ChangeLog][QtNetwork] Added support for the SPDY protocol (version 3.0). Change-Id: I81bbe0495c24ed84e9cf8af3a9dbd63ca1e93d0d Reviewed-by: Richard J. Moore --- src/network/access/qhttpnetworkconnection_p.h | 37 ++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'src/network/access/qhttpnetworkconnection_p.h') diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 526326c3fd..9d4257e217 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -94,12 +94,27 @@ class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject Q_OBJECT public: + enum ConnectionType { + ConnectionTypeHTTP, + ConnectionTypeSPDY + }; + #ifndef QT_NO_BEARERMANAGEMENT - explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0, QSharedPointer networkSession = QSharedPointer()); - QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0, QSharedPointer networkSession = QSharedPointer()); + explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, + ConnectionType connectionType = ConnectionTypeHTTP, + QObject *parent = 0, QSharedPointer networkSession + = QSharedPointer()); + QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, + bool encrypt = false, QObject *parent = 0, + QSharedPointer networkSession = QSharedPointer(), + ConnectionType connectionType = ConnectionTypeHTTP); #else - explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0); - QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0); + explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, + QObject *parent = 0, + ConnectionType connectionType = ConnectionTypeHTTP); + QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, + bool encrypt = false, QObject *parent = 0, + ConnectionType connectionType = ConnectionTypeHTTP); #endif ~QHttpNetworkConnection(); @@ -123,6 +138,9 @@ public: QHttpNetworkConnectionChannel *channels() const; + ConnectionType connectionType(); + void setConnectionType(ConnectionType type); + #ifndef QT_NO_SSL void setSslConfiguration(const QSslConfiguration &config); void ignoreSslErrors(int channel = -1); @@ -140,6 +158,7 @@ private: friend class QHttpNetworkReplyPrivate; friend class QHttpNetworkConnectionChannel; friend class QHttpProtocolHandler; + friend class QSpdyProtocolHandler; Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest()) Q_PRIVATE_SLOT(d_func(), void _q_hostLookupFinished(QHostInfo)) @@ -155,7 +174,7 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QHttpNetworkConnection) public: - static const int defaultChannelCount; + static const int defaultHttpChannelCount; static const int defaultPipelineLength; static const int defaultRePipelineLength; @@ -172,8 +191,10 @@ public: IPv4or6 }; - QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt); - QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt); + QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt, + QHttpNetworkConnection::ConnectionType type); + QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt, + QHttpNetworkConnection::ConnectionType type); ~QHttpNetworkConnectionPrivate(); void init(); @@ -245,6 +266,8 @@ public: int preConnectRequests; + QHttpNetworkConnection::ConnectionType connectionType; + #ifndef QT_NO_SSL QSharedPointer sslContext; #endif -- cgit v1.2.3