summaryrefslogtreecommitdiff
path: root/plugin/business/tsg-http/src
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2024-08-30 11:13:04 +0800
committerfengweihao <[email protected]>2024-08-30 11:13:04 +0800
commitd6fd0f973d38eeeec38ecdd578f0c1392a614e22 (patch)
tree5fbc0520baf94ba240f142737bf8fbf1d60edc3f /plugin/business/tsg-http/src
parent80eed59202b83935d37a12e1b3fb1dc7414f808f (diff)
TSG-22258 HTTP/2解析层不在扫描HTTP Method为CONNECT的请求,提供edit_element_tool工具获取HTML/JSON的层级关系
Diffstat (limited to 'plugin/business/tsg-http/src')
-rw-r--r--plugin/business/tsg-http/src/edit_element.cpp25
-rw-r--r--plugin/business/tsg-http/src/tsg_http.cpp6
2 files changed, 28 insertions, 3 deletions
diff --git a/plugin/business/tsg-http/src/edit_element.cpp b/plugin/business/tsg-http/src/edit_element.cpp
index b77d544..03f3ed0 100644
--- a/plugin/business/tsg-http/src/edit_element.cpp
+++ b/plugin/business/tsg-http/src/edit_element.cpp
@@ -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;
}
diff --git a/plugin/business/tsg-http/src/tsg_http.cpp b/plugin/business/tsg-http/src/tsg_http.cpp
index 3a926d0..2f4e263 100644
--- a/plugin/business/tsg-http/src/tsg_http.cpp
+++ b/plugin/business/tsg-http/src/tsg_http.cpp
@@ -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)