tests: net: lib: http_server: core: Add tests for header with priority

Add test cases verifying that request containing header frame with
priority flag set is processed properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2024-07-17 15:47:32 +02:00 committed by Anas Nashif
commit 71e0b9fac2

View file

@ -69,6 +69,21 @@
0x86, 0x62, 0x4f, 0x55, 0x0e, 0x93, 0x13, 0x7a, 0x88, 0x25, 0xb6, 0x50, \ 0x86, 0x62, 0x4f, 0x55, 0x0e, 0x93, 0x13, 0x7a, 0x88, 0x25, 0xb6, 0x50, \
0xc3, 0xcb, 0xbc, 0xb8, 0x3f, 0x53, 0x03, 0x2a, 0x2f, 0x2a, 0x5f, 0x87, \ 0xc3, 0xcb, 0xbc, 0xb8, 0x3f, 0x53, 0x03, 0x2a, 0x2f, 0x2a, 0x5f, 0x87, \
0x49, 0x7c, 0xa5, 0x8a, 0xe8, 0x19, 0xaa, 0x0f, 0x0d, 0x02, 0x31, 0x37 0x49, 0x7c, 0xa5, 0x8a, 0xe8, 0x19, 0xaa, 0x0f, 0x0d, 0x02, 0x31, 0x37
#define TEST_HTTP2_HEADERS_POST_DYNAMIC_STREAM_1_PRIORITY \
0x00, 0x00, 0x35, 0x01, 0x24, 0x00, 0x00, 0x00, TEST_STREAM_ID_1, \
0x00, 0x00, 0x00, 0x00, 0x64, \
0x83, 0x86, 0x41, 0x87, 0x0b, 0xe2, 0x5c, 0x0b, 0x89, 0x70, 0xff, 0x04, \
0x86, 0x62, 0x4f, 0x55, 0x0e, 0x93, 0x13, 0x7a, 0x88, 0x25, 0xb6, 0x50, \
0xc3, 0xcb, 0xbc, 0xb8, 0x3f, 0x53, 0x03, 0x2a, 0x2f, 0x2a, 0x5f, 0x87, \
0x49, 0x7c, 0xa5, 0x8a, 0xe8, 0x19, 0xaa, 0x0f, 0x0d, 0x02, 0x31, 0x37
#define TEST_HTTP2_HEADERS_POST_DYNAMIC_STREAM_1_PRIORITY_PADDED \
0x00, 0x00, 0x40, 0x01, 0x2c, 0x00, 0x00, 0x00, TEST_STREAM_ID_1, \
0x0a, 0x00, 0x00, 0x00, 0x00, 0xc8,\
0x83, 0x86, 0x41, 0x87, 0x0b, 0xe2, 0x5c, 0x0b, 0x89, 0x70, 0xff, 0x04, \
0x86, 0x62, 0x4f, 0x55, 0x0e, 0x93, 0x13, 0x7a, 0x88, 0x25, 0xb6, 0x50, \
0xc3, 0xcb, 0xbc, 0xb8, 0x3f, 0x53, 0x03, 0x2a, 0x2f, 0x2a, 0x5f, 0x87, \
0x49, 0x7c, 0xa5, 0x8a, 0xe8, 0x19, 0xaa, 0x0f, 0x0d, 0x02, 0x31, 0x37, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
#define TEST_HTTP2_DATA_POST_DYNAMIC_STREAM_1 \ #define TEST_HTTP2_DATA_POST_DYNAMIC_STREAM_1 \
0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, TEST_STREAM_ID_1, \ 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, TEST_STREAM_ID_1, \
0x54, 0x65, 0x73, 0x74, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, \ 0x54, 0x65, 0x73, 0x74, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, \
@ -692,6 +707,36 @@ ZTEST(server_function_tests, test_http2_post_data_with_padding)
sizeof(request_post_dynamic)); sizeof(request_post_dynamic));
} }
ZTEST(server_function_tests, test_http2_post_headers_with_priority)
{
static const uint8_t request_post_dynamic[] = {
TEST_HTTP2_MAGIC,
TEST_HTTP2_SETTINGS,
TEST_HTTP2_SETTINGS_ACK,
TEST_HTTP2_HEADERS_POST_DYNAMIC_STREAM_1_PRIORITY,
TEST_HTTP2_DATA_POST_DYNAMIC_STREAM_1_PADDED,
TEST_HTTP2_GOAWAY,
};
common_verify_http2_dynamic_post_request(request_post_dynamic,
sizeof(request_post_dynamic));
}
ZTEST(server_function_tests, test_http2_post_headers_with_priority_and_padding)
{
static const uint8_t request_post_dynamic[] = {
TEST_HTTP2_MAGIC,
TEST_HTTP2_SETTINGS,
TEST_HTTP2_SETTINGS_ACK,
TEST_HTTP2_HEADERS_POST_DYNAMIC_STREAM_1_PRIORITY_PADDED,
TEST_HTTP2_DATA_POST_DYNAMIC_STREAM_1_PADDED,
TEST_HTTP2_GOAWAY,
};
common_verify_http2_dynamic_post_request(request_post_dynamic,
sizeof(request_post_dynamic));
}
ZTEST(server_function_tests, test_http2_get_headers_with_padding) ZTEST(server_function_tests, test_http2_get_headers_with_padding)
{ {
static const uint8_t request_get_dynamic[] = { static const uint8_t request_get_dynamic[] = {