summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/http2/http2srv.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2017-10-18 11:59:21 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-10-26 04:13:40 +0000
commit76a6b3294223f52568cd8c6190edceedbdca70ce (patch)
tree4455b5b12b72c27238272903c47cf4da275e8dd7 /tests/auto/network/access/http2/http2srv.cpp
parentf174d31667dca184439f520b9624a1471d9556a6 (diff)
HTTP/2 - make protocol settings configurablev5.10.0-beta3
1. Recently we have updated our receive window size to a larger value. Unfortunately, this also results in auto-test pumping through more data, which probably takes more time on CI. At the moment we do not have any public API on QNAM's level to customize HTTP/2 parameters (aka 5.10/FF and so on). So we use the fact that QNAM is QObject and we can set a property on it. This property is our Http2::ProtocolParameters object that allows us to configure: - HPACK parameters (in 5.10 - noop) - session receive window size - different SETTINGS as described by RFC 7540, 6.5.2. 2. Undocumented environment variable to set ENABLE_PUSH is not needed anymore. 3. In 5.11 Http2::ProtocolParameter will become a public API and we'll introduce a new setter in QNAM. Change-Id: If08fd5e09e7c0b61cf9700b426b60b5837b6b2e6 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network/access/http2/http2srv.cpp')
-rw-r--r--tests/auto/network/access/http2/http2srv.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp
index 663f40cbae..69e480b164 100644
--- a/tests/auto/network/access/http2/http2srv.cpp
+++ b/tests/auto/network/access/http2/http2srv.cpp
@@ -76,13 +76,11 @@ void fill_push_header(const HttpHeader &originalRequest, HttpHeader &promisedReq
}
-Http2Server::Http2Server(bool h2c, const Http2Settings &ss, const Http2Settings &cs)
+Http2Server::Http2Server(bool h2c, const Http2::RawSettings &ss, const Http2::RawSettings &cs)
: serverSettings(ss),
+ expectedClientSettings(cs),
clearTextHTTP2(h2c)
{
- for (const auto &s : cs)
- expectedClientSettings[quint16(s.identifier)] = s.value;
-
responseBody = "<html>\n"
"<head>\n"
"<title>Sample \"Hello, World\" Application</title>\n"
@@ -159,11 +157,11 @@ void Http2Server::sendServerSettings()
return;
writer.start(FrameType::SETTINGS, FrameFlag::EMPTY, connectionStreamID);
- for (const auto &s : serverSettings) {
- writer.append(s.identifier);
- writer.append(s.value);
- if (s.identifier == Settings::INITIAL_WINDOW_SIZE_ID)
- streamRecvWindowSize = s.value;
+ for (auto it = serverSettings.cbegin(); it != serverSettings.cend(); ++it) {
+ writer.append(it.key());
+ writer.append(it.value());
+ if (it.key() == Settings::INITIAL_WINDOW_SIZE_ID)
+ streamRecvWindowSize = it.value();
}
writer.write(*socket);
// Now, let's update our peer on a session recv window size:
@@ -285,9 +283,9 @@ void Http2Server::incomingConnection(qintptr socketDescriptor)
quint32 Http2Server::clientSetting(Http2::Settings identifier, quint32 defaultValue)
{
- const auto it = expectedClientSettings.find(quint16(identifier));
+ const auto it = expectedClientSettings.find(identifier);
if (it != expectedClientSettings.end())
- return it->second;
+ return it.value();
return defaultValue;
}
@@ -623,7 +621,7 @@ void Http2Server::handleSETTINGS()
const auto notFound = expectedClientSettings.end();
while (src != end) {
- const auto id = qFromBigEndian<quint16>(src);
+ const auto id = Http2::Settings(qFromBigEndian<quint16>(src));
const auto value = qFromBigEndian<quint32>(src + 2);
if (expectedClientSettings.find(id) == notFound ||
expectedClientSettings[id] != value) {