diff options
author | Ed Tanous <ed@tanous.net> | 2024-03-15 19:05:04 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-03-21 21:46:05 +0300 |
commit | 325310d3c5b7de591533a00d9cf26054fa0c0f9d (patch) | |
tree | 07c7171868a833fe552b5581ae680ac4e2347c6d /test | |
parent | 8983cf565b1695040938a30adcfb4f32f7972ae0 (diff) | |
download | bmcweb-325310d3c5b7de591533a00d9cf26054fa0c0f9d.tar.xz |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/http/http2_connection_test.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/http/http2_connection_test.cpp b/test/http/http2_connection_test.cpp index 1c6ae6ce0d..72f985c761 100644 --- a/test/http/http2_connection_test.cpp +++ b/test/http/http2_connection_test.cpp @@ -127,8 +127,8 @@ TEST(http_connection, RequestPropogates) // 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 @@ TEST(http_connection, RequestPropogates) "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 @@ TEST(http_connection, RequestPropogates) 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 @@ TEST(http_connection, RequestPropogates) 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"), |