TSG-6072 Deny动作和Redirect动作日志中存在非格式化日志HTTP.Request Body
TSG-6095 代理策略monitor动作产生的非格式化下载日志与策略配置不相符
This commit is contained in:
1
cache/include/tango_cache_client.h
vendored
1
cache/include/tango_cache_client.h
vendored
@@ -144,6 +144,7 @@ struct tango_cache_meta_put
|
||||
const char* std_hdr[HDR_CONTENT_NUM]; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"Content-Type: text/html"<22><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>NULL<4C><4C>ʾû<CABE>и<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
||||
const char* usertag; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>GETʱ<54><CAB1>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
size_t usertag_len; //<2F><><EFBFBD><EFBFBD>USER_TAG_MAX_LEN<45><4E>0<EFBFBD><30>ʾû<CABE>и<EFBFBD>ͷ<EFBFBD><CDB7>
|
||||
size_t user_log_name;
|
||||
struct response_freshness put;
|
||||
};
|
||||
|
||||
|
||||
9
cache/src/tango_cache_client.cpp
vendored
9
cache/src/tango_cache_client.cpp
vendored
@@ -414,7 +414,16 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
|
||||
if(instance->param->hash_object_key)
|
||||
{
|
||||
caculate_sha256(meta->url, strlen(meta->url), buffer, 72);
|
||||
if(meta->user_log_name)
|
||||
{
|
||||
struct timespec start_time;
|
||||
clock_gettime(CLOCK_REALTIME,&start_time);
|
||||
snprintf(ctx->object_key, 256, "%s/%lu_%c%c_%c%c_%s", instance->param->bucketname, start_time.tv_nsec, buffer[0], buffer[1], buffer[2], buffer[3], buffer+4);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(ctx->object_key, 256, "%s/%c%c_%c%c_%s", instance->param->bucketname, buffer[0], buffer[1], buffer[2], buffer[3], buffer+4);
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD>ԭʼURL
|
||||
snprintf(buffer, 2064, "x-amz-meta-url: %s", meta->url);
|
||||
ctx->headers = curl_slist_append(ctx->headers, buffer);
|
||||
|
||||
@@ -205,7 +205,7 @@ static void doh_maat_scan(const struct tfe_stream *stream, const struct tfe_http
|
||||
{
|
||||
int hit_cnt = 0;
|
||||
int scan_ret = 0;
|
||||
int app_id = 135;
|
||||
int app_id = 8006;
|
||||
struct ipaddr sapp_addr;
|
||||
struct Maat_rule_t *p_result = NULL;
|
||||
struct Maat_rule_t result[MAX_SCAN_RESULT];
|
||||
|
||||
@@ -2374,7 +2374,7 @@ void pangu_on_http_begin(const struct tfe_stream * stream,
|
||||
{
|
||||
hit_cnt+=scan_ret;
|
||||
}
|
||||
int scan_val=106;
|
||||
int scan_val=67;
|
||||
scan_ret=Maat_scan_intval(g_pangu_rt->maat, g_pangu_rt->scan_table_id[PXY_CTRL_APP_ID], scan_val, result+hit_cnt, MAX_SCAN_RESULT-hit_cnt, &(ctx->scan_mid), (int) thread_id);
|
||||
if(scan_ret>0)
|
||||
{
|
||||
|
||||
@@ -219,11 +219,19 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
||||
cJSON_AddStringToObject(common_obj,resp_fields[i].log_filed_name, tmp_val);
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t i=0; i<log_msg->result_num; i++)
|
||||
{
|
||||
if(log_msg->result[i].do_log!=1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char log_file_upload_path[TFE_STRING_MAX]={0}, cont_type_whole[TFE_STRING_MAX]={0};
|
||||
struct tango_cache_meta_put meta;
|
||||
char* log_file_key=NULL;;
|
||||
const char* cont_type_val;
|
||||
if(log_msg->req_body!=NULL && log_msg->result[0].do_log==1)
|
||||
if(log_msg->req_body!=NULL)
|
||||
{
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
asprintf(&log_file_key, "%s.reqbody", http->req->req_spec.url);
|
||||
@@ -234,6 +242,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
||||
snprintf(cont_type_whole, sizeof(cont_type_whole), "Content-Type:%s", cont_type_val);
|
||||
meta.std_hdr[0]=cont_type_whole;
|
||||
}
|
||||
meta.user_log_name=1;
|
||||
tmp=cache_evbase_upload_once_evbuf(handle->log_file_upload_instance, NULL,
|
||||
log_msg->req_body,
|
||||
&meta,
|
||||
@@ -248,7 +257,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
||||
}
|
||||
free(log_file_key);
|
||||
}
|
||||
if(log_msg->resp_body!=NULL && log_msg->result[0].do_log==1)
|
||||
if(log_msg->resp_body!=NULL)
|
||||
{
|
||||
memset(&meta, 0, sizeof(meta));
|
||||
asprintf(&log_file_key, "%s.respbody", http->req->req_spec.url);
|
||||
@@ -259,6 +268,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
||||
snprintf(cont_type_whole, sizeof(cont_type_whole), "Content-Type:%s", cont_type_val);
|
||||
meta.std_hdr[0]=cont_type_whole;
|
||||
}
|
||||
meta.user_log_name=1;
|
||||
tmp=cache_evbase_upload_once_evbuf(handle->log_file_upload_instance, NULL,
|
||||
log_msg->resp_body,
|
||||
&meta,
|
||||
@@ -274,6 +284,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
||||
}
|
||||
free(log_file_key);
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t i=0; i<log_msg->result_num; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user