TSG-1167 proxy-event-log增加注入文件大小
This commit is contained in:
@@ -1041,6 +1041,7 @@ struct pangu_http_ctx
|
|||||||
struct policy_action_param *param;
|
struct policy_action_param *param;
|
||||||
struct evbuffer* log_req_body, *log_resp_body;
|
struct evbuffer* log_req_body, *log_resp_body;
|
||||||
|
|
||||||
|
size_t inject_sz;
|
||||||
struct replace_ctx * rep_ctx;
|
struct replace_ctx * rep_ctx;
|
||||||
struct insert_ctx * ins_ctx;
|
struct insert_ctx * ins_ctx;
|
||||||
|
|
||||||
@@ -1696,6 +1697,7 @@ static void http_hijack(const struct tfe_http_session * session, enum tfe_http_e
|
|||||||
ctx->action = PG_ACTION_NONE;
|
ctx->action = PG_ACTION_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ctx->inject_sz = hijack_size;
|
||||||
|
|
||||||
char cont_len_str[16];
|
char cont_len_str[16];
|
||||||
|
|
||||||
@@ -1748,6 +1750,7 @@ static int format_insert_rule(int profile_id, struct insert_rule *rule)
|
|||||||
rule->script = tfe_strdup(insert_profile->profile_msg);
|
rule->script = tfe_strdup(insert_profile->profile_msg);
|
||||||
rule->type = tfe_strdup(insert_profile->profile_type);
|
rule->type = tfe_strdup(insert_profile->profile_type);
|
||||||
rule->position = tfe_strdup(insert_profile->profile_position);
|
rule->position = tfe_strdup(insert_profile->profile_position);
|
||||||
|
rule->inject_sz = insert_profile->msg_len;
|
||||||
|
|
||||||
ma_profile_table_free(insert_profile);
|
ma_profile_table_free(insert_profile);
|
||||||
insert_profile = NULL;
|
insert_profile = NULL;
|
||||||
@@ -1787,6 +1790,7 @@ static void http_insert(const struct tfe_stream * stream, const struct tfe_http_
|
|||||||
ctx->action = PG_ACTION_NONE;
|
ctx->action = PG_ACTION_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ctx->inject_sz = ins_ctx->rule->inject_sz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2474,7 +2478,7 @@ void pangu_on_http_end(const struct tfe_stream * stream,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct pangu_log log_msg = {.stream=stream, .http=session, .result=ctx->enforce_rules, .result_num=ctx->n_enforce,
|
struct pangu_log log_msg = {.stream=stream, .http=session, .result=ctx->enforce_rules, .result_num=ctx->n_enforce,
|
||||||
.req_body= ctx->log_req_body, .resp_body=ctx->log_resp_body, .action=0};
|
.req_body=ctx->log_req_body, .resp_body=ctx->log_resp_body, .action=0, .inject_sz=ctx->inject_sz};
|
||||||
|
|
||||||
if(ctx->action == PG_ACTION_MANIPULATE)
|
if(ctx->action == PG_ACTION_MANIPULATE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
|||||||
if(log_msg->result[i].action == LG_ACTION_MANIPULATE)
|
if(log_msg->result[i].action == LG_ACTION_MANIPULATE)
|
||||||
{
|
{
|
||||||
cJSON_AddStringToObject(per_hit_obj, "common_sub_action", manipulate_action_map[log_msg->action]);
|
cJSON_AddStringToObject(per_hit_obj, "common_sub_action", manipulate_action_map[log_msg->action]);
|
||||||
|
cJSON_AddNumberToObject(per_hit_obj, "http_action_file_sz", log_msg->inject_sz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ struct pangu_log
|
|||||||
size_t result_num;
|
size_t result_num;
|
||||||
struct evbuffer* req_body, *resp_body;
|
struct evbuffer* req_body, *resp_body;
|
||||||
unsigned char action;
|
unsigned char action;
|
||||||
|
size_t inject_sz;
|
||||||
};
|
};
|
||||||
struct pangu_logger;
|
struct pangu_logger;
|
||||||
struct pangu_logger* pangu_log_handle_create(const char* profile, const char* section, void* local_logger);
|
struct pangu_logger* pangu_log_handle_create(const char* profile, const char* section, void* local_logger);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ struct replace_rule
|
|||||||
|
|
||||||
struct insert_rule
|
struct insert_rule
|
||||||
{
|
{
|
||||||
|
int inject_sz;
|
||||||
char * script;
|
char * script;
|
||||||
char * type;
|
char * type;
|
||||||
char * position;
|
char * position;
|
||||||
|
|||||||
Reference in New Issue
Block a user