diff options
author | Ed Tanous <ed@tanous.net> | 2024-01-29 19:34:59 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-02-16 20:34:04 +0300 |
commit | 52dd6932dea23ed6f6ae24caec12c9a7f19c2284 (patch) | |
tree | 386e7fed2b1343a3f38b99ee9f8f2b77437f95ff /http | |
parent | d088218997348f27272a61a7f892a2291a6c2d6d (diff) | |
download | bmcweb-52dd6932dea23ed6f6ae24caec12c9a7f19c2284.tar.xz |
Write unit tests for http2 connection
This unit test currently only tests a simple connect and settings frame
transfer, but should form the basis for more complex testing in the
future.
Tested: Unit tests pass
Change-Id: Ieb803dbe490129ec5fe99fb3d4505a06202e282e
Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'http')
-rw-r--r-- | http/nghttp2_adapters.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/http/nghttp2_adapters.hpp b/http/nghttp2_adapters.hpp index 05ea68d388..aeb18d60ab 100644 --- a/http/nghttp2_adapters.hpp +++ b/http/nghttp2_adapters.hpp @@ -152,3 +152,42 @@ struct nghttp2_session private: nghttp2_session* ptr = nullptr; }; + +class nghttp2_hd_inflater +{ + nghttp2_hd_inflater* ptr = nullptr; + + public: + nghttp2_hd_inflater() + { + if (nghttp2_hd_inflate_new(&ptr) != 0) + { + BMCWEB_LOG_ERROR("nghttp2_hd_inflater_new failed"); + } + } + + ssize_t hd2(nghttp2_nv* nvOut, int* inflateFlags, const uint8_t* in, + size_t inlen, int inFinal) + { + return nghttp2_hd_inflate_hd2(ptr, nvOut, inflateFlags, in, inlen, + inFinal); + } + + int endHeaders() + { + return nghttp2_hd_inflate_end_headers(ptr); + } + + nghttp2_hd_inflater(const nghttp2_hd_inflater&) = delete; + nghttp2_hd_inflater& operator=(const nghttp2_hd_inflater&) = delete; + nghttp2_hd_inflater& operator=(nghttp2_hd_inflater&&) = delete; + nghttp2_hd_inflater(nghttp2_hd_inflater&& other) = delete; + + ~nghttp2_hd_inflater() + { + if (ptr != nullptr) + { + nghttp2_hd_inflate_del(ptr); + } + } +}; |