http response body位置命中阻断规则时,不调用tfe_http_session_allow_write。

This commit is contained in:
zhengchao
2018-12-09 20:31:04 +06:00
committed by luqiuwen
parent 76f0efe3cb
commit 5ebceac0c0

View File

@@ -863,9 +863,11 @@ static void http_reject(const struct tfe_http_session * session, enum tfe_http_e
ctx->enforce_rules[0].config_id, ctx->enforce_para); ctx->enforce_rules[0].config_id, ctx->enforce_para);
ctx->action = PG_ACTION_NONE; ctx->action = PG_ACTION_NONE;
goto error_out; return;
} }
if(events & EV_HTTP_RESP_HDR || tfe_http_in_request(events))
{
to_write_sess = tfe_http_session_allow_write(session); to_write_sess = tfe_http_session_allow_write(session);
response = tfe_http_session_response_create(to_write_sess, resp_code); response = tfe_http_session_response_create(to_write_sess, resp_code);
@@ -878,10 +880,14 @@ static void http_reject(const struct tfe_http_session * session, enum tfe_http_e
tfe_http_half_append_body(response, NULL, 0, 0); tfe_http_half_append_body(response, NULL, 0, 0);
tfe_http_session_response_set(to_write_sess, response); tfe_http_session_response_set(to_write_sess, response);
tfe_http_session_detach(session); tfe_http_session_detach(session);
error_out:
html_free(&page_buff); html_free(&page_buff);
} }
else
{
//TODO: close http session.
}
return;
}
static void http_redirect(const struct tfe_http_session * session, enum tfe_http_event events, static void http_redirect(const struct tfe_http_session * session, enum tfe_http_event events,
struct pangu_http_ctx * ctx) struct pangu_http_ctx * ctx)