summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/business/pangu-http/src/pangu_http.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp
index ff9bd9c..33b44eb 100644
--- a/plugin/business/pangu-http/src/pangu_http.cpp
+++ b/plugin/business/pangu-http/src/pangu_http.cpp
@@ -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();
- }
- if(events & EV_HTTP_REQ_BODY_CONT)
- {
- evbuffer_add(ctx->log_req_body, body_frag, frag_size);
- }
- if(events & EV_HTTP_RESP_BODY_CONT)
- {
- evbuffer_add(ctx->log_resp_body, body_frag, frag_size);
- }
+ 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