1.修改js注入页面显示无效字符问题
This commit is contained in:
@@ -619,8 +619,8 @@ void policy_table_new_cb(int table_id, const char* key, const char* table_line,
|
||||
ply_obj->tpl = ctemplate::Template::GetTemplate(profile_path, ctemplate::DO_NOT_STRIP);
|
||||
}else
|
||||
{
|
||||
ply_obj->profile_msg = rt_read_file(profile_path, &ply_obj->msg_len);
|
||||
if (ply_obj->profile_msg == NULL || ply_obj->msg_len == 0)
|
||||
ply_obj->profile_msg = execute_read_file(profile_path, &ply_obj->msg_len);
|
||||
if (ply_obj->profile_msg == NULL)
|
||||
{
|
||||
TFE_LOG_ERROR(g_pangu_rt->local_logger, "Read file failed %d:%s:%s", cfg_id, profile_name, profile_path);
|
||||
}
|
||||
@@ -1149,14 +1149,15 @@ static int html_generate(int cfg_id, const char* msg, char ** page_buff, size_t
|
||||
else
|
||||
{
|
||||
*page_size = ply_obj->msg_len;
|
||||
*page_buff = tfe_strdup(ply_obj->profile_msg);
|
||||
*page_buff = ply_obj->profile_msg;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void html_free(char ** page_buff)
|
||||
{
|
||||
FREE(page_buff);
|
||||
if (*page_buff)
|
||||
FREE(page_buff);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1329,22 +1330,22 @@ void http_replace(const struct tfe_stream * stream, const struct tfe_http_sessio
|
||||
static void http_reject(const struct tfe_http_session * session, enum tfe_http_event events,
|
||||
struct pangu_http_ctx * ctx)
|
||||
{
|
||||
int resp_code = 0, ret = 0;
|
||||
int resp_code = 0;
|
||||
struct tfe_http_half * response = NULL;
|
||||
char * page_buff = NULL;
|
||||
size_t page_size = 0;
|
||||
|
||||
char cont_len_str[16];
|
||||
|
||||
char msg[TFE_STRING_MAX] = "";
|
||||
char *msg = NULL;
|
||||
struct tfe_http_session * to_write_sess = NULL;
|
||||
|
||||
ret = sscanf(ctx->enforce_para, "code=%d;content=%[^\n]", &resp_code, msg);
|
||||
if (ret != 1 && ret != 2)
|
||||
{
|
||||
TFE_LOG_ERROR(g_pangu_rt->local_logger, "Invalid reject rule %d paramter %s",
|
||||
ctx->enforce_rules[0].config_id, ctx->enforce_para);
|
||||
struct plolicy_param *param = ctx->param;
|
||||
|
||||
resp_code = param->status_code;
|
||||
msg = param->message;
|
||||
if (resp_code <= 0 || msg != NULL){
|
||||
TFE_LOG_ERROR(g_pangu_rt->local_logger, "Invalid block rule %d", ctx->enforce_rules[0].config_id);
|
||||
ctx->action = PG_ACTION_NONE;
|
||||
return;
|
||||
}
|
||||
@@ -1502,7 +1503,7 @@ static void http_hijack(const struct tfe_http_session * session, enum tfe_http_e
|
||||
size_t page_size = ply_obj->msg_len;
|
||||
|
||||
size_t frag_size=8192; size_t sendlen=0;
|
||||
unsigned char body_frag[frag_size];
|
||||
unsigned char body_frag[frag_size + 1];
|
||||
|
||||
tfe_http_session_response_set(to_write_sess, response);
|
||||
tfe_http_half_write_body_begin(response, 1);
|
||||
|
||||
Reference in New Issue
Block a user