diff --git a/plugin/business/tsg-http/src/tsg_http.cpp b/plugin/business/tsg-http/src/tsg_http.cpp index f98fc31..9da3642 100644 --- a/plugin/business/tsg-http/src/tsg_http.cpp +++ b/plugin/business/tsg-http/src/tsg_http.cpp @@ -965,7 +965,7 @@ void ma_hijack_profile_table_new_cb(const char *table_name, const char* key, con { ply_profile->profile_uuid = tfe_strdup(uuid->valuestring); } - cJSON *profile_name = cJSON_GetObjectItem(hihijack_files, "profile_name"); + cJSON *profile_name = cJSON_GetObjectItem(hihijack_files, "content_name"); if(profile_name && profile_name->type==cJSON_String) { ply_profile->profile_name=tfe_strdup(profile_name->valuestring); @@ -2214,10 +2214,10 @@ static int http_regex_replace(const struct tfe_stream * stream, char *message, c return 0; } - if(strcasestr(message,"{{tsg_policy_id}}") != NULL) + if(strcasestr(message,"{{tsg_policy_uuid}}") != NULL) { rule[n_rule].zone = kZoneRequestUri; - rule[n_rule].find = tfe_strdup("{{tsg_policy_id}}"); + rule[n_rule].find = tfe_strdup("{{tsg_policy_uuid}}"); snprintf(replace_with, TFE_SYMBOL_MAX, "%s", profile_id_str); rule[n_rule].replace_with = tfe_strdup(replace_with); n_rule++; @@ -2892,6 +2892,19 @@ enum proxy_action http_scan(const struct tfe_http_session * session, enum tfe_ht { hit_cnt += n_hit_result; } + + const char * str_field_name = http_field_name_to_string(&field_name); + if(str_field_name == NULL) + { + break; + } + + scan_ret = maat_scan_string(g_proxy_rt->feather, "TSG_OBJ_KEYWORD", attribute_name, str_field_name, strlen(str_field_name), + result + hit_cnt, MAX_SCAN_RESULT - hit_cnt, &n_hit_result, ctx->scan_mid); + if (scan_ret == MAAT_SCAN_HIT) + { + hit_cnt += n_hit_result; + } } scan_ret = maat_scan_not_logic(g_proxy_rt->feather, "TSG_OBJ_KEYWORD", attribute_name, result + hit_cnt, MAX_SCAN_RESULT - hit_cnt, &n_hit_result, ctx->scan_mid); diff --git a/plugin/business/tsg-http/test/test_pattern_replace.cpp b/plugin/business/tsg-http/test/test_pattern_replace.cpp index 50fd239..0756313 100644 --- a/plugin/business/tsg-http/test/test_pattern_replace.cpp +++ b/plugin/business/tsg-http/test/test_pattern_replace.cpp @@ -183,15 +183,15 @@ TEST(PatternReplace, UrlReplace) char replace_with[TFE_SYMBOL_MAX]={0}; char *rewrite_uri=NULL; - const char *rd_url = "http://www.example.com/query?pageid=12345&policy_id={{tsg_policy_id}}&user_id={{tsg_subscriber_id}}&source_ip={{tsg_client_ip}}"; + const char *rd_url = "http://www.example.com/query?pageid=12345&policy_id={{tsg_policy_uuid}}&user_id={{tsg_subscriber_id}}&source_ip={{tsg_client_ip}}"; struct replace_rule rule[3]; memset(rule, 0, sizeof(struct replace_rule)); - if(strcasestr(rd_url,"{{tsg_policy_id}}") != NULL) + if(strcasestr(rd_url,"{{tsg_policy_uuid}}") != NULL) { rule[n_rule].zone = kZoneRequestUri; - rule[n_rule].find = tfe_strdup("{{tsg_policy_id}}"); + rule[n_rule].find = tfe_strdup("{{tsg_policy_uuid}}"); snprintf(replace_with, TFE_SYMBOL_MAX, "%d", 23); rule[n_rule].replace_with = tfe_strdup(replace_with); n_rule++;