日志接口、扫描接口修复
1)日志发送接口:增加对非结构化日志判断 2)扫描接口:对客户端请求中HOST字段为空情况,扫描不在扫FQDN域
This commit is contained in:
@@ -1937,13 +1937,15 @@ enum pangu_action http_scan(const struct tfe_http_session * session, enum tfe_ht
|
|||||||
if (events & EV_HTTP_REQ_HDR)
|
if (events & EV_HTTP_REQ_HDR)
|
||||||
{
|
{
|
||||||
const char *str_host = session->req->req_spec.host;
|
const char *str_host = session->req->req_spec.host;
|
||||||
int str_host_length = (int) (strlen(session->req->req_spec.host));
|
if (str_host != NULL)
|
||||||
|
|
||||||
scan_ret = Maat_full_scan_string(g_pangu_rt->maat, g_pangu_rt->scan_table_id[PXY_CTRL_HTTP_FQDN],
|
|
||||||
CHARSET_UTF8, str_host, str_host_length, result, NULL, MAX_SCAN_RESULT, &(ctx->scan_mid), ctx->thread_id);
|
|
||||||
if (scan_ret > 0)
|
|
||||||
{
|
{
|
||||||
hit_cnt += scan_ret;
|
int str_host_length = (int) (strlen(session->req->req_spec.host));
|
||||||
|
scan_ret = Maat_full_scan_string(g_pangu_rt->maat, g_pangu_rt->scan_table_id[PXY_CTRL_HTTP_FQDN],
|
||||||
|
CHARSET_UTF8, str_host, str_host_length, result, NULL, MAX_SCAN_RESULT, &(ctx->scan_mid), ctx->thread_id);
|
||||||
|
if (scan_ret > 0)
|
||||||
|
{
|
||||||
|
hit_cnt += scan_ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * str_url = session->req->req_spec.url;
|
const char * str_url = session->req->req_spec.url;
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
|||||||
int ret=tfe_cmsg_get_value(cmsg, TFE_CMSG_STREAM_TRACE_ID, (unsigned char *) opt_val, sizeof(opt_val), &opt_out_size);
|
int ret=tfe_cmsg_get_value(cmsg, TFE_CMSG_STREAM_TRACE_ID, (unsigned char *) opt_val, sizeof(opt_val), &opt_out_size);
|
||||||
if (ret==0)
|
if (ret==0)
|
||||||
{
|
{
|
||||||
cJSON_AddStringToObject(common_obj, "common_stream_trace_id", opt_val);
|
cJSON_AddNumberToObject(common_obj, "common_stream_trace_id", atoll(opt_val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
|||||||
struct tango_cache_meta_put meta;
|
struct tango_cache_meta_put meta;
|
||||||
char* log_file_key=NULL;;
|
char* log_file_key=NULL;;
|
||||||
const char* cont_type_val;
|
const char* cont_type_val;
|
||||||
if(log_msg->req_body!=NULL)
|
if(log_msg->req_body!=NULL && log_msg->result[0].do_log==1)
|
||||||
{
|
{
|
||||||
memset(&meta, 0, sizeof(meta));
|
memset(&meta, 0, sizeof(meta));
|
||||||
asprintf(&log_file_key, "%s.reqbody", http->req->req_spec.url);
|
asprintf(&log_file_key, "%s.reqbody", http->req->req_spec.url);
|
||||||
@@ -321,7 +321,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
|||||||
}
|
}
|
||||||
free(log_file_key);
|
free(log_file_key);
|
||||||
}
|
}
|
||||||
if(log_msg->resp_body!=NULL)
|
if(log_msg->resp_body!=NULL && log_msg->result[0].do_log==1)
|
||||||
{
|
{
|
||||||
memset(&meta, 0, sizeof(meta));
|
memset(&meta, 0, sizeof(meta));
|
||||||
asprintf(&log_file_key, "%s.respbody", http->req->req_spec.url);
|
asprintf(&log_file_key, "%s.respbody", http->req->req_spec.url);
|
||||||
|
|||||||
Reference in New Issue
Block a user