1.修复替换字符编码大小写匹配错误,造成页面替换失败
2.修复命中insert后,发送无效日志 3.修复正则表达式失败返回-1,size_t造成数据反转
This commit is contained in:
@@ -1412,7 +1412,8 @@ void http_replace(const struct tfe_stream * stream, const struct tfe_http_sessio
|
||||
rewrite_sz = 0;
|
||||
|
||||
if (tfe_http_in_response(events) && in_resp_spec->content_type != NULL
|
||||
&& strstr(in_resp_spec->content_type, "charset=utf-8"))
|
||||
&& (strstr(in_resp_spec->content_type, "charset=utf-8") ||
|
||||
(strstr(in_resp_spec->content_type, "charset=UTF-8"))))
|
||||
{
|
||||
options = 1;
|
||||
}
|
||||
@@ -2313,6 +2314,36 @@ void pangu_on_http_begin(const struct tfe_stream * stream,
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int ctx_actually_replaced(struct pangu_http_ctx * ctx)
|
||||
{
|
||||
|
||||
if(ctx->action == PG_ACTION_MANIPULATE &&
|
||||
ctx->param->action == MA_ACTION_REPLACE &&
|
||||
ctx->n_enforce==1 && ctx->rep_ctx->actually_replaced==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int ctx_actually_inserted(struct pangu_http_ctx * ctx)
|
||||
{
|
||||
|
||||
if(ctx->action == PG_ACTION_MANIPULATE &&
|
||||
ctx->param->action == MA_ACTION_INSERT &&
|
||||
ctx->n_enforce==1 && ctx->ins_ctx->actually_replaced==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void pangu_on_http_end(const struct tfe_stream * stream,
|
||||
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
|
||||
{
|
||||
@@ -2342,10 +2373,11 @@ 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,
|
||||
.req_body= ctx->log_req_body, .resp_body=ctx->log_resp_body};
|
||||
if (ctx->action != PG_ACTION_NONE&&
|
||||
!(ctx->action == PG_ACTION_MANIPULATE &&
|
||||
ctx->param->action == MA_ACTION_REPLACE &&
|
||||
ctx->n_enforce==1 && ctx->rep_ctx->actually_replaced==0))
|
||||
|
||||
if ((ctx->action != PG_ACTION_NONE&&
|
||||
!(ctx_actually_replaced(ctx))) ||
|
||||
(ctx->action != PG_ACTION_NONE&&
|
||||
!(ctx_actually_inserted(ctx))))
|
||||
{
|
||||
ret=pangu_send_log(g_pangu_rt->send_logger, &log_msg);
|
||||
ATOMIC_ADD(&(g_pangu_rt->stat_val[STAT_LOG_NUM]), ret);
|
||||
|
||||
Reference in New Issue
Block a user