diff options
| author | liuwentan <[email protected]> | 2023-12-29 18:03:45 +0800 |
|---|---|---|
| committer | liuwentan <[email protected]> | 2023-12-29 18:03:45 +0800 |
| commit | c19e0ea5d9a59aaabf580568a1fb421eb4421051 (patch) | |
| tree | e4a7dc040bd2d3874626c0b1c379f740039e4147 | |
| parent | 21d1d573ad84bf782f288f25cda25fe0f0aa2e15 (diff) | |
[PATCH]Add TCP 1-byte sliding window test
| -rw-r--r-- | src/http_decoder/http_decoder.c | 2 | ||||
| -rw-r--r-- | test/http_decoder/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | test/http_decoder/http_pcap/http_req_window_1.pcap | bin | 0 -> 31724 bytes | |||
| -rw-r--r-- | test/http_decoder/http_pcap/http_res_window_1.pcap | bin | 0 -> 55449 bytes | |||
| -rw-r--r-- | test/http_decoder/http_pcap/non_http.pcap | bin | 0 -> 27850 bytes | |||
| -rw-r--r-- | test/http_decoder/test_result_json/http_req_window_1.json | 29 | ||||
| -rw-r--r-- | test/http_decoder/test_result_json/http_res_window_1.json | 29 | ||||
| -rw-r--r-- | test/http_decoder/test_result_json/non_http.json | 1 |
8 files changed, 71 insertions, 2 deletions
diff --git a/src/http_decoder/http_decoder.c b/src/http_decoder/http_decoder.c index 1bfbcad..f29a6cd 100644 --- a/src/http_decoder/http_decoder.c +++ b/src/http_decoder/http_decoder.c @@ -343,8 +343,6 @@ int http_decoder_entry(struct session *sess, int events, const struct packet *pk struct http_decoder_result_queue *queue = session_get_ex_data(sess, ctx->ex_data_idx);; - const char *tmp_payload = session_get0_current_payload(sess, &payload_len); - if (events & SESS_EV_CLOSING) { if (queue != NULL) { http_decoder_result_queue_free(queue); diff --git a/test/http_decoder/CMakeLists.txt b/test/http_decoder/CMakeLists.txt index c048edb..7465cdc 100644 --- a/test/http_decoder/CMakeLists.txt +++ b/test/http_decoder/CMakeLists.txt @@ -67,6 +67,15 @@ add_test(NAME HTTP_OVER_PPPOE_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_D add_test(NAME HTTP_OVER_TLS_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_over_tls.json -f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_over_tls.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR}) +add_test(NAME NON_HTTP_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/non_http.json + -f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name non_http.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR}) + +add_test(NAME HTTP_REQ_WINDOW_1_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_req_window_1.json + -f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_req_window_1.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR}) + +add_test(NAME HTTP_RES_WINDOW_1_TEST COMMAND ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_result_json/http_res_window_1.json + -f "find ${CMAKE_CURRENT_SOURCE_DIR}/http_pcap/ -name http_res_window_1.pcap|sort -V" WORKING_DIRECTORY ${TEST_RUN_DIR}) + set_tests_properties(HTTP_GET_SINGLE_TRANS_TEST HTTP_GET_MULTI_TRANS_TEST HTTP_GET_REQ_PIPELINE_TEST @@ -78,4 +87,7 @@ set_tests_properties(HTTP_GET_SINGLE_TRANS_TEST HTTP_TUNNEL_FOR_POP3_TEST HTTP_OVER_PPPOE_TEST HTTP_OVER_TLS_TEST + NON_HTTP_TEST + HTTP_REQ_WINDOW_1_TEST + HTTP_RES_WINDOW_1_TEST PROPERTIES FIXTURES_REQUIRED TestFixture)
\ No newline at end of file diff --git a/test/http_decoder/http_pcap/http_req_window_1.pcap b/test/http_decoder/http_pcap/http_req_window_1.pcap Binary files differnew file mode 100644 index 0000000..632c676 --- /dev/null +++ b/test/http_decoder/http_pcap/http_req_window_1.pcap diff --git a/test/http_decoder/http_pcap/http_res_window_1.pcap b/test/http_decoder/http_pcap/http_res_window_1.pcap Binary files differnew file mode 100644 index 0000000..6d1d6a4 --- /dev/null +++ b/test/http_decoder/http_pcap/http_res_window_1.pcap diff --git a/test/http_decoder/http_pcap/non_http.pcap b/test/http_decoder/http_pcap/non_http.pcap Binary files differnew file mode 100644 index 0000000..931b43b --- /dev/null +++ b/test/http_decoder/http_pcap/non_http.pcap diff --git a/test/http_decoder/test_result_json/http_req_window_1.json b/test/http_decoder/test_result_json/http_req_window_1.json new file mode 100644 index 0000000..1612574 --- /dev/null +++ b/test/http_decoder/test_result_json/http_req_window_1.json @@ -0,0 +1,29 @@ +[ + { + "Tuple4": "192.168.40.137.46180>192.168.42.40.80", + "method": "GET", + "uri": "/index.html", + "req_version": "1.1", + "major_version": 1, + "minor_version": 1, + "User-Agent": "Wget/1.14 (linux-gnu)", + "Accept": "*/*", + "Host": "192.168.42.40", + "Connection": "Keep-Alive", + "name": "HTTP_DECODER_RESULT_1" + }, + { + "Tuple4": "192.168.40.137.46180>192.168.42.40.80", + "res_version": "1.0", + "res_status": "OK", + "major_version": 1, + "minor_version": 0, + "status_code": 200, + "Server": "SimpleHTTP/0.6 Python/2.7.5", + "Date": "Fri, 29 Dec 2023 09:11:12 GMT", + "Content-type": "text/html", + "Content-Length": "144", + "Last-Modified": "Fri, 29 Dec 2023 08:50:53 GMT", + "name": "HTTP_DECODER_RESULT_2" + } +]
\ No newline at end of file diff --git a/test/http_decoder/test_result_json/http_res_window_1.json b/test/http_decoder/test_result_json/http_res_window_1.json new file mode 100644 index 0000000..845e1b2 --- /dev/null +++ b/test/http_decoder/test_result_json/http_res_window_1.json @@ -0,0 +1,29 @@ +[ + { + "Tuple4": "192.168.42.40.36338>192.168.40.137.80", + "method": "GET", + "uri": "/index.html", + "req_version": "1.1", + "major_version": 1, + "minor_version": 1, + "User-Agent": "Wget/1.14 (linux-gnu)", + "Accept": "*/*", + "Host": "192.168.40.137", + "Connection": "Keep-Alive", + "name": "HTTP_DECODER_RESULT_1" + }, + { + "Tuple4": "192.168.42.40.36338>192.168.40.137.80", + "res_version": "1.0", + "res_status": "OK", + "major_version": 1, + "minor_version": 0, + "status_code": 200, + "Server": "SimpleHTTP/0.6 Python/2.7.5", + "Date": "Fri, 29 Dec 2023 09:32:21 GMT", + "Content-type": "text/html", + "Content-Length": "144", + "Last-Modified": "Fri, 29 Dec 2023 08:50:53 GMT", + "name": "HTTP_DECODER_RESULT_2" + } +]
\ No newline at end of file diff --git a/test/http_decoder/test_result_json/non_http.json b/test/http_decoder/test_result_json/non_http.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/test/http_decoder/test_result_json/non_http.json @@ -0,0 +1 @@ +[]
\ No newline at end of file |
