summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttp2protocolhandler_p.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-10-10 15:29:26 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-10-21 14:27:06 +0000
commit512934f7e70592ed06a790fcb46dde1e435b488e (patch)
treef5fa91f8ce36289976e389ded3c155c45ac2ebb1 /src/network/access/qhttp2protocolhandler_p.h
parent016b5bc949b6dfb2f76db2e8b40a40e7eaee6828 (diff)
HTTP/2 - fix the handling of PUSH_PROMISE
HTTP/2 allows a server to pre-emptively send (or "push") responses (along with corresponding "promised" requests) to a client in association with a previous client-initiated request. This can be useful when the server knows the client will need to have those responses available in order to fully process the response to the original request. Server push is semantically equivalent to a server responding to a request; however, in this case, that request is also sent by the server, as a PUSH_PROMISE frame. The PUSH_PROMISE frame includes a header block that contains a complete set of request header fields that the server attributes to the request. After sending the PUSH_PROMISE frame, the server can begin delivering the pushed response as a response on a server-initiated stream that uses the promised stream identifier. This patch: - fixes the HPACK decompression of PUSH_PROMISE frames; - allows a user to enable PUSH_PROMISE; - processes and caches pushed data for promised streams; - updates auto-test - emulates a simple PUSH_PROMISE scenario. Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access/qhttp2protocolhandler_p.h')
-rw-r--r--src/network/access/qhttp2protocolhandler_p.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h
index 92c6851078..df0cf6a288 100644
--- a/src/network/access/qhttp2protocolhandler_p.h
+++ b/src/network/access/qhttp2protocolhandler_p.h
@@ -63,6 +63,7 @@
#include "http2/hpacktable_p.h"
#include "http2/hpack_p.h"
+#include <QtCore/qnamespace.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qglobal.h>
#include <QtCore/qobject.h>
@@ -123,9 +124,11 @@ private:
bool acceptSetting(Http2::Settings identifier, quint32 newValue);
- void updateStream(Stream &stream, const HPack::HttpHeader &headers);
- void updateStream(Stream &stream, const Http2::Frame &dataFrame);
- void finishStream(Stream &stream);
+ void updateStream(Stream &stream, const HPack::HttpHeader &headers,
+ Qt::ConnectionType connectionType = Qt::DirectConnection);
+ void updateStream(Stream &stream, const Http2::Frame &dataFrame,
+ Qt::ConnectionType connectionType = Qt::DirectConnection);
+ void finishStream(Stream &stream, Qt::ConnectionType connectionType = Qt::DirectConnection);
// Error code send by a peer (GOAWAY/RST_STREAM):
void finishStreamWithError(Stream &stream, quint32 errorCode);
// Locally encountered error:
@@ -194,7 +197,15 @@ private:
quint32 allocateStreamID();
bool validPeerStreamID() const;
bool goingAway = false;
-
+ bool pushPromiseEnabled = false;
+ quint32 lastPromisedID = Http2::connectionStreamID;
+ QHash<QString, Http2::PushPromise> promisedData;
+ bool tryReserveStream(const Http2::Frame &pushPromiseFrame,
+ const HPack::HttpHeader &requestHeader);
+ void resetPromisedStream(const Http2::Frame &pushPromiseFrame,
+ Http2::Http2Error reason);
+ void initReplyFromPushPromise(const HttpMessagePair &message,
+ const QString &cacheKey);
// Errors:
void connectionError(Http2::Http2Error errorCode,
const char *message);