TSG-7141 修复非格式日志部分下载失败问题

修复重定向指定用户自定义域无法替换问题
This commit is contained in:
fengweihao
2021-07-23 15:55:42 +08:00
parent d18b647ec5
commit 9745251b2a
5 changed files with 19 additions and 16 deletions

View File

@@ -1532,7 +1532,7 @@ static void http_get_client_id(const struct tfe_stream * stream, char *replace_r
tfe_stream_addr_str_split((char *)stream->str_stream_info, &sip, &sport, &dip, &dport);
snprintf(replace_regex, TFE_SYMBOL_MAX, "%s=%s", "source_ip", sip);
snprintf(replace_regex, TFE_SYMBOL_MAX, "%s", sip);
}
static void http_get_subscriber_id(const struct tfe_stream * stream, char *replace_regex)
@@ -1549,7 +1549,7 @@ static void http_get_subscriber_id(const struct tfe_stream * stream, char *repla
TFE_LOG_ERROR(g_pangu_rt->local_logger, "fetch src sub id from cmsg failed, ret: %d addr: %s", ret, stream->str_stream_info);
}
}
snprintf(replace_regex, TFE_SYMBOL_MAX, "%s=%s", "user_id", source_subscribe_id);
snprintf(replace_regex, TFE_SYMBOL_MAX, "%s", source_subscribe_id);
}
static int http_decoder_url(const struct tfe_stream * stream, char *rd_url, int profile_id, char **rewrite_uri)
@@ -1558,7 +1558,7 @@ static int http_decoder_url(const struct tfe_stream * stream, char *rd_url, int
char replace_with[TFE_SYMBOL_MAX]={0};
struct replace_rule *rule;
if(strstr(rd_url, "policy_id")==NULL && strstr(rd_url, "user_id")==NULL && strstr(rd_url, "source_ip")==NULL)
if(strstr(rd_url, "tsg_policy_id")==NULL && strstr(rd_url, "tsg_subscriber_id")==NULL && strstr(rd_url, "tsg_client_ip")==NULL)
{
return 0;
}
@@ -1566,21 +1566,21 @@ static int http_decoder_url(const struct tfe_stream * stream, char *rd_url, int
rule = ALLOC(struct replace_rule, 3);
n_rule=0;
rule[n_rule].zone = kZoneRequestUri;
rule[n_rule].find = tfe_strdup("policy_id={{tsg_policy_id}}");
snprintf(replace_with, TFE_SYMBOL_MAX, "policy_id=%d", profile_id);
rule[n_rule].find = tfe_strdup("{{tsg_policy_id}}");
snprintf(replace_with, TFE_SYMBOL_MAX, "%d", profile_id);
rule[n_rule].replace_with = tfe_strdup(replace_with);
n_rule=1;
memset(replace_with, TFE_SYMBOL_MAX, 0);
rule[n_rule].zone = kZoneRequestUri;
rule[n_rule].find = tfe_strdup("user_id={{tsg_subscriber_id}}");
rule[n_rule].find = tfe_strdup("{{tsg_subscriber_id}}");
http_get_subscriber_id(stream, replace_with);
rule[n_rule].replace_with = tfe_strdup(replace_with);
n_rule=2;
memset(replace_with, TFE_SYMBOL_MAX, 0);
rule[n_rule].zone = kZoneRequestUri;
rule[n_rule].find = tfe_strdup("source_ip={{tsg_client_ip}}");
rule[n_rule].find = tfe_strdup("{{tsg_client_ip}}");
http_get_client_id(stream, replace_with);
rule[n_rule].replace_with = tfe_strdup(replace_with);