Close #106 修正当命中关键字阻断时,在发送现场文件处Coredump的问题

* 原实现在命中应答关键字时,认为BODY_BEGIN时已经创建过evbuffer,直接使用
* 现修正,当evbuf为空时,创建evbuffer.
This commit is contained in:
luqiuwen
2019-01-05 18:17:47 +06:00
parent 43646e60be
commit a91feaf7ed

View File

@@ -1152,25 +1152,26 @@ void enforce_control_policy(const struct tfe_stream * stream, const struct tfe_h
default: assert(0);
break;
}
if(ctx->action!=PG_ACTION_NONE && ctx->action!=PG_ACTION_WHITELIST)
/* Don't store reqeust/response body when NOT hit or hit whitelist */
if(ctx->action == PG_ACTION_NONE || ctx->action == PG_ACTION_WHITELIST)
{
if (events & EV_HTTP_REQ_BODY_BEGIN)
{
ctx->log_req_body=evbuffer_new();
}
if (events & EV_HTTP_RESP_BODY_BEGIN)
{
ctx->log_resp_body=evbuffer_new();
return;
}
/* Otherwise, store body */
if(events & EV_HTTP_REQ_BODY_CONT)
{
if(ctx->log_req_body == NULL) ctx->log_req_body = evbuffer_new();
evbuffer_add(ctx->log_req_body, body_frag, frag_size);
}
if(events & EV_HTTP_RESP_BODY_CONT)
{
if(ctx->log_resp_body == NULL) ctx->log_resp_body = evbuffer_new();
evbuffer_add(ctx->log_resp_body, body_frag, frag_size);
}
}
return;
}
#define RESUMED_CB_NO_MORE_CALLS 0