diff --git a/conf/pangu/pangu_pxy.conf b/conf/pangu/pangu_pxy.conf index 73d2eec..94663df 100644 --- a/conf/pangu/pangu_pxy.conf +++ b/conf/pangu/pangu_pxy.conf @@ -1,5 +1,6 @@ [debug] log_level=10 +enable_plugin=1 [log] entrance_id=0 diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index c196d5f..bb65058 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -154,7 +154,7 @@ struct pangu_rt int ctrl_compile_idx; int ca_store_reseting; - + int enable_plugin; }; struct pangu_rt * g_pangu_rt; @@ -919,6 +919,11 @@ int pangu_http_init(struct tfe_proxy * proxy) int temp=0; g_pangu_rt = ALLOC(struct pangu_rt, 1); + MESA_load_profile_int_def(profile_path, "DEBUG", "enable_plugin", &(g_pangu_rt->enable_plugin), 1); + if (!g_pangu_rt->enable_plugin) + { + return 0; + } g_pangu_rt->thread_num = tfe_proxy_get_work_thread_count(); g_pangu_rt->gc_evbase=tfe_proxy_get_gc_evbase(); @@ -2548,6 +2553,11 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct void pangu_on_http_begin(const struct tfe_stream * stream, const struct tfe_http_session * session, unsigned int thread_id, void ** pme) { + if (!g_pangu_rt->enable_plugin) + { + return; + } + struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme; struct Maat_rule_t result[MAX_SCAN_RESULT]; struct ipaddr sapp_addr; @@ -2662,6 +2672,11 @@ static inline int ctx_actually_manipulate(struct pangu_http_ctx * ctx) void pangu_on_http_end(const struct tfe_stream * stream, const struct tfe_http_session * session, unsigned int thread_id, void ** pme) { + if (!g_pangu_rt->enable_plugin) + { + return; + } + struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme; size_t i=0, j=0; int ret=0; @@ -2723,6 +2738,11 @@ void pangu_on_http_end(const struct tfe_stream * stream, int pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_session * session, enum tfe_http_event events, const unsigned char * body_frag, size_t frag_size, unsigned int thread_id, void ** pme) { + if (!g_pangu_rt->enable_plugin) + { + return CALL_NEXT_PLUGIN; + } + struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme; int ret=0; if(ctx->resumed_cb)