diff options
Diffstat (limited to 'plugin/business/tsg-http/src/tsg_http.cpp')
| -rw-r--r-- | plugin/business/tsg-http/src/tsg_http.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/plugin/business/tsg-http/src/tsg_http.cpp b/plugin/business/tsg-http/src/tsg_http.cpp index dbbcd94..4d8a287 100644 --- a/plugin/business/tsg-http/src/tsg_http.cpp +++ b/plugin/business/tsg-http/src/tsg_http.cpp @@ -683,7 +683,6 @@ void policy_action_param_new(const char *table_name, int table_id, const char* k } *ad=param; TFE_LOG_INFO(g_proxy_rt->local_logger, "Add ctrl policy: %lld", config_id); -error_out: cJSON_Delete(json); return; } @@ -890,15 +889,8 @@ void ma_lua_profile_table_new_cb(const char *table_name, int table_id, const cha return; } - int i=0, thread_num = g_proxy_rt->thread_num; - struct tsg_lua_script *lua_script = &(g_proxy_rt->lua_script); - + int thread_num = g_proxy_rt->thread_num; ply_profile->escript_ctx = ALLOC(struct elua_script *, thread_num); - for(i=0; i<thread_num; i++) - { - ply_profile->escript_ctx[i]=http_lua_map_cache_script(lua_script->http_lua_handle[i], ply_profile->profile_msg, ply_profile->msg_len, timeout); - } - TFE_LOG_INFO(g_proxy_rt->local_logger, "Policy table add success %d", profile_id); *ad = ply_profile; @@ -933,7 +925,12 @@ void ma_profile_table_free_cb(int table_id, void **ad, long argl, void *argp) int i=0; for(i=0; i<g_proxy_rt->thread_num; i++) { - elua_cleanup_script(ply_obj->escript_ctx[i]); + if(ply_obj->escript_ctx[i]) + { + elua_cleanup_script(ply_obj->escript_ctx[i]); + FREE(&ply_obj->escript_ctx[i]); + ply_obj->escript_ctx[i]=NULL; + } } free(ply_obj->escript_ctx); ply_obj->escript_ctx=NULL; @@ -1686,7 +1683,7 @@ static int http_enforcement_ratio(float enforcement_ratio) return 0; } -int http_lua_profile(int profile_id, struct elua_script ***elua_ctx) +int http_lua_profile(int profile_id, struct elua_script ***elua_ctx, char **profile_msg, size_t *msg_len, int *timeout) { int ret = 0; @@ -1698,6 +1695,9 @@ int http_lua_profile(int profile_id, struct elua_script ***elua_ctx) } *elua_ctx=lua_profile->escript_ctx; + *profile_msg=tfe_strdup(lua_profile->profile_msg); + *msg_len=lua_profile->msg_len; + *timeout=lua_profile->timeout; ma_profile_table_free(lua_profile); lua_profile = NULL; return ret; @@ -2178,7 +2178,7 @@ static void http_block(const struct tfe_stream * stream, const struct tfe_http_s int profile_id = param->profile_id; char *message = param->message; - if (resp_code <= 0 || profile_id < 0){ + if (profile_id < 0){ TFE_LOG_ERROR(g_proxy_rt->local_logger, "Invalid block rule %lld", ctx->enforce_rules[0].config_id); ctx->action = PX_ACTION_NONE; return; |
