From e7a14f4a8edb5671d9c0c48255493c807ff2c743 Mon Sep 17 00:00:00 2001 From: yangwei Date: Fri, 29 Jul 2022 11:18:18 +0800 Subject: 🐞 fix(http_doWithACompleteRegion): MESA_htable_search前判断key长度,避免告警 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/HTTP_Message_Region.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/HTTP_Message_Region.c') diff --git a/src/HTTP_Message_Region.c b/src/HTTP_Message_Region.c index 4fa5aeb..b1f2022 100644 --- a/src/HTTP_Message_Region.c +++ b/src/HTTP_Message_Region.c @@ -339,7 +339,8 @@ uchar http_doWithConnection(http_parser_t* a_http, http_stream *a_http_stream, c } else if(0==strncasecmp((char*)value,"close",sizeof("close")-1)) { - FLAG_SET(a_http->flag, HTTP_FLAG_CONNECT_CLOSE); + FLAG_SET(a_http->flag, HTTP_FLAG_CONNECT_CLOSE); + } a_http->session.buf = value; a_http->session.buflen = valuelen; @@ -662,7 +663,15 @@ uchar http_doWithACompleteRegion(http_parser_t *cur_http_node, http_stream *a_ht { memcpy(copy_region_name, region_name, reg_name_len); stringA_to_stringa(copy_region_name, reg_name_len); - region_id_hash = (int*)MESA_htable_search(g_http_prog_para.region_hash, (const uchar*)copy_region_name, reg_name_len); + if(strlen(copy_region_name) > 0 && reg_name_len > 0) + { + region_id_hash = (int*)MESA_htable_search(g_http_prog_para.region_hash, (const uchar*)copy_region_name, reg_name_len); + } + else + { + MESA_handle_runtime_log(g_http_prog_para.http_log_handle, RLOG_LV_FATAL, HTTP_PLUGIN_NAME, "region name invalid, addr:%s", + printaddr(&a_tcp->addr,thread_seq)); + } } /*expand region*/ -- cgit v1.2.3