Allow reading http2 bodies
This allows http2 connections to now host authenticated endpoints.
Note, this work exposed that the http2 path was not calling
preparePayload() and responses were therefore missing the
Content-Length header. preparePayload is now called, and Content-Length
is added to the unit tests.
This commit also allows a full Redfish Service Validator test to pass
entirely using HTTP2.
Tested: Unit tests pass.
Curl /redfish/v1/Managers/bmc/LogServices/Journal/Entries
(which returns a payload larger than 16kB) succeeds and returns the
data.
Manually logging in with both basic and session authentication succeeds
over http2.
A modified Redfish-Service-Validator, changed to use httpx as its
backend, (thus using http2) succeeds.
Change-Id: I956f3ff8f442e9826312c6147d7599ab136a8e7c
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/test/http/http2_connection_test.cpp b/test/http/http2_connection_test.cpp
index 1c6ae6c..72f985c 100644
--- a/test/http/http2_connection_test.cpp
+++ b/test/http/http2_connection_test.cpp
@@ -127,8 +127,8 @@
// Settings ACK from server to client
"\x00\x00\x00\x04\x01\x00\x00\x00\x00"
- // Start Headers frame stream 1, size 0x0346
- "\x00\x03\x46\x01\x04\x00\x00\x00\x01"sv;
+ // Start Headers frame stream 1, size 0x034b
+ "\x00\x03\x4b\x01\x04\x00\x00\x00\x01"sv;
std::string_view expectedPostfix =
// Data Frame, Length 12, Stream 1, End Stream flag set
@@ -137,7 +137,7 @@
"StringOutput"sv;
std::string_view outStr;
- constexpr size_t headerSize = 0x346;
+ constexpr size_t headerSize = 0x34b;
// Run until we receive the expected amount of data
while (outStr.size() <
@@ -149,7 +149,7 @@
EXPECT_TRUE(handler.called);
// check the stream output against expected
- EXPECT_TRUE(outStr.starts_with(expectedPrefix));
+ EXPECT_EQ(outStr.substr(0, expectedPrefix.size()), expectedPrefix);
outStr.remove_prefix(expectedPrefix.size());
std::vector<std::pair<std::string, std::string>> headers;
unpackHeaders(outStr.substr(0, headerSize), headers);
@@ -158,7 +158,7 @@
EXPECT_THAT(
headers,
UnorderedElementsAre(
- Pair(":status", "200"),
+ Pair(":status", "200"), Pair("content-length", "12"),
Pair("strict-transport-security",
"max-age=31536000; includeSubdomains"),
Pair("x-frame-options", "DENY"), Pair("pragma", "no-cache"),