summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuwentan <[email protected]>2024-01-08 13:47:59 +0800
committerliuwentan <[email protected]>2024-01-08 13:47:59 +0800
commitc659bbd0da9b3f630c2666e5d4a83c2f90d9504a (patch)
treef1f4be4b858d3d91518803bd2961357464345ae5
parent9f81cecf1f2e1ea26191784709b5f3ab6d3804de (diff)
[PATCH]add http2 test case
-rw-r--r--test/http_decoder/CMakeLists.txt4
-rw-r--r--test/http_decoder/http_pcap/http_upgrade_http2.pcapbin0 -> 1617 bytes
-rw-r--r--test/http_decoder/test_result_json/http_upgrade_http2.json28
3 files changed, 32 insertions, 0 deletions
diff --git a/test/http_decoder/CMakeLists.txt b/test/http_decoder/CMakeLists.txt
index abca12d..ad4d966 100644
--- a/test/http_decoder/CMakeLists.txt
+++ b/test/http_decoder/CMakeLists.txt
@@ -97,6 +97,9 @@ add_test(NAME HTTP_HEADER_VALUE_EMPTY_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_
add_test(NAME HTTP_UPGRADE_WEBSOCKET_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_upgrade_websocket.json
-f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_upgrade_websocket.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
+add_test(NAME HTTP_UPGRADE_HTTP2_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_upgrade_http2.json
+ -f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_upgrade_http2.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
+
add_test(NAME HTTP_MULTI_PARSE_ERROR_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_multi_parse_error.json
-f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_multi_parse_error.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR})
@@ -122,4 +125,5 @@ set_tests_properties(HTTP_GET_SINGLE_TRANS_TEST
HTTP_HEADER_VALUE_EMPTY_TEST
HTTP_MULTI_PARSE_ERROR_TEST
HTTP_UPGRADE_WEBSOCKET_TEST
+ HTTP_UPGRADE_HTTP2_TEST
PROPERTIES FIXTURES_REQUIRED TestFixture) \ No newline at end of file
diff --git a/test/http_decoder/http_pcap/http_upgrade_http2.pcap b/test/http_decoder/http_pcap/http_upgrade_http2.pcap
new file mode 100644
index 0000000..a77847a
--- /dev/null
+++ b/test/http_decoder/http_pcap/http_upgrade_http2.pcap
Binary files differ
diff --git a/test/http_decoder/test_result_json/http_upgrade_http2.json b/test/http_decoder/test_result_json/http_upgrade_http2.json
new file mode 100644
index 0000000..54d7638
--- /dev/null
+++ b/test/http_decoder/test_result_json/http_upgrade_http2.json
@@ -0,0 +1,28 @@
+[
+ {
+ "Tuple4": "10.9.0.2.58038>139.162.123.134.80",
+ "method": "GET",
+ "uri": "/robots.txt",
+ "req_version": "1.1",
+ "major_version": 1,
+ "minor_version": 1,
+ "Host": "nghttp2.org",
+ "User-Agent": "curl/7.61.0",
+ "Accept": "*/*",
+ "Connection": "Upgrade, HTTP2-Settings",
+ "Upgrade": "h2c",
+ "HTTP2-Settings": "AAMAAABkAARAAAAAAAIAAAAA",
+ "name": "HTTP_DECODER_RESULT_1"
+ },
+ {
+ "Tuple4": "10.9.0.2.58038>139.162.123.134.80",
+ "res_version": "1.1",
+ "res_status": "Switching Protocols",
+ "major_version": 1,
+ "minor_version": 1,
+ "status_code": 101,
+ "Connection": "Upgrade",
+ "Upgrade": "h2c",
+ "name": "HTTP_DECODER_RESULT_2"
+ }
+] \ No newline at end of file