TSG-20527 http解析层支持zstd编解码

This commit is contained in:
fengweihao
2024-04-28 17:37:08 +08:00
parent 397a6aba93
commit a8313580e1
6 changed files with 159 additions and 1 deletions

View File

@@ -317,6 +317,22 @@ TEST_P(HttpConvertCompress, MonkeyToGzipStreamWithNullEnd)
EXPECT_EQ(memcmp(uncompress_buf.data(), monkey, sizeof(monkey)), 0);
}
TEST_P(HttpConvertCompress, MonkeyToZstd)
{
int ret = hf_content_compress_write(cv_compress_object, monkey, sizeof(monkey), buf, 1);
ASSERT_EQ(ret, 0);
unsigned char * __raw_buf_ptr = evbuffer_pullup(buf, -1);
size_t __raw_buf_length = evbuffer_get_length(buf);
ret = hf_content_uncompress_write(cv_uncompress_object, NULL, EV_HTTP_REQ_BODY_CONT,
__raw_buf_ptr, __raw_buf_length);
ASSERT_TRUE(__raw_buf_ptr != NULL);
ASSERT_EQ(ret, 1);
EXPECT_EQ(uncompress_buf.size(), sizeof(monkey));
EXPECT_EQ(memcmp(uncompress_buf.data(), monkey, sizeof(monkey)), 0);
}
INSTANTIATE_TEST_CASE_P(HttpConvertCompressGroup, HttpConvertCompress,
::testing::Values(HTTP_ACCEPT_ENCODING_GZIP, HTTP_ACCEPT_ENCODING_DEFLATE, HTTP_ACCEPT_ENCODING_BR));