summaryrefslogtreecommitdiff
path: root/test/http_decoder_gtest.cpp
diff options
context:
space:
mode:
author李佳 <[email protected]>2024-04-11 11:44:16 +0000
committer李佳 <[email protected]>2024-04-11 11:44:16 +0000
commit94ed075dda28fc975d9061f20de0dc594a35653c (patch)
tree5d397a7adf6d46be96dd4a50c25318f052ad53d4 /test/http_decoder_gtest.cpp
parent8be661adc385b843ca36769f71d43549848e4c7d (diff)
Test case based on stellar
Diffstat (limited to 'test/http_decoder_gtest.cpp')
-rw-r--r--test/http_decoder_gtest.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/http_decoder_gtest.cpp b/test/http_decoder_gtest.cpp
index 4f21955..cabba75 100644
--- a/test/http_decoder_gtest.cpp
+++ b/test/http_decoder_gtest.cpp
@@ -268,9 +268,14 @@ static void http_decoder_test_update_session_tuple4(struct session *sess, struct
{
if (gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION] == NULL)
{
+ const char *human_addr_cstr = session_get0_readable_addr(sess);
+ if(NULL == human_addr_cstr){
+ fprintf(stderr, "can't get readable_addr, to use session_get0_readable_addr() the sapp_log.conf level must <= INFO\n");
+ return;
+ }
char result_name[MAX_KEY_STR_LEN] = {0};
gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION] = cJSON_CreateObject();
- cJSON_AddStringToObject(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], GTEST_HTTP_TUPLE4_NAME, session_get0_readable_addr(sess));
+ cJSON_AddStringToObject(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], GTEST_HTTP_TUPLE4_NAME, human_addr_cstr);
sprintf(result_name, "%d", g_result_count++);
commit_test_result_json(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], result_name);
}