TSG-22258 HTTP/2解析层不在扫描HTTP Method为CONNECT的请求,提供edit_element_tool工具获取HTML/JSON的层级关系

This commit is contained in:
fengweihao
2024-08-30 11:13:04 +08:00
parent 80eed59202
commit d6fd0f973d
6 changed files with 152 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ enum search_scope scope_name_to_id(const char * name)
return (enum search_scope) i;
}
int match_start_indicator(xmlNodePtr parent, char * start_indicator)
int match_start_indicator(xmlNodePtr parent, char * start_indicator, int debug_for_log)
{
if(parent->properties == NULL)
{
@@ -43,6 +43,7 @@ int match_start_indicator(xmlNodePtr parent, char * start_indicator)
{
return 0;
}
if(debug_for_log == 1) printf(" start indicator, parent name: %s\n", parent->name);
if(!strcasecmp((char *)parent->name, start_indicator))
{
return 1;
@@ -57,6 +58,7 @@ int match_start_indicator(xmlNodePtr parent, char * start_indicator)
}
xmlNodePtr children = properties->children;
if(debug_for_log == 1) printf(" start indicator, children content: %s\n", children->content);
if(!strcasecmp((char *)children->content, start_indicator))
{
return 1;
@@ -130,6 +132,10 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int *
{
if(a_element->type == cJSON_Object)
{
if(*node != NULL && rules->debug_for_log == 1)
{
printf(" start indicator: %s\n", *node);
}
if(*node != NULL && strcasecmp(*node, start_indicator) != 0)
{
return -2;
@@ -137,6 +143,10 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int *
}
if(a_element->type == cJSON_Array)
{
if(a_element->string != NULL && rules->debug_for_log == 1)
{
printf(" start indicator: %s\n", a_element->string);
}
if(a_element->string != NULL && strcasecmp(a_element->string, start_indicator))
{
return -2;
@@ -165,6 +175,10 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int *
{
if(a_element->type == cJSON_Object)
{
if(*node != NULL && rules->debug_for_log == 1)
{
printf(" start indicator: %s\n", *node);
}
if(*node != NULL && strcasecmp(*node, start_indicator) != 0)
{
return -2;
@@ -172,6 +186,10 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int *
}
if(a_element->type == cJSON_Array)
{
if(a_element->string != NULL && rules->debug_for_log == 1)
{
printf(" start indicator: %s\n", a_element->string);
}
if(a_element->string != NULL && strcasecmp(a_element->string, start_indicator))
{
return -2;
@@ -231,6 +249,7 @@ int construct_html_by_treatment(const struct edit_element_rule * rules, xmlNodeP
char * start_indicator = rules->start_indicator;
const char *element_treatment=rules->element_treatment;
int debug_for_log = rules->debug_for_log;
int distane_from_matching = (rules->distane_from_matching + 1);
if(element_treatment != NULL && !strcasecmp(element_treatment, "mark"))
@@ -241,7 +260,7 @@ int construct_html_by_treatment(const struct edit_element_rule * rules, xmlNodeP
{
if(k == distane_from_matching)
{
if (rules->scope == kScopeInside && match_start_indicator(parent, start_indicator) == 0)
if (rules->scope == kScopeInside && match_start_indicator(parent, start_indicator, debug_for_log) == 0)
{
break;
}
@@ -263,7 +282,7 @@ int construct_html_by_treatment(const struct edit_element_rule * rules, xmlNodeP
{
if(k == distane_from_matching)
{
if (rules->scope == kScopeInside && match_start_indicator(parent, start_indicator) == 0)
if (rules->scope == kScopeInside && match_start_indicator(parent, start_indicator, debug_for_log) == 0)
{
break;
}

View File

@@ -2936,6 +2936,12 @@ void proxy_on_http_begin(const struct tfe_stream *stream, const struct tfe_http_
{
hit_cnt += scan_ret;
}
scan_ret = tfe_scan_device(stream, result, ctx->scan_mid, hit_cnt, g_proxy_rt->local_logger);
if(scan_ret > 0)
{
hit_cnt += scan_ret;
}
addr_tfe2sapp(stream->addr, &sapp_addr);
if (sapp_addr.addrtype == ADDR_TYPE_IPV4)