summaryrefslogtreecommitdiff
path: root/plugin/business/tsg-http/src/http_lua.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2023-07-11 16:28:52 +0800
committerfengweihao <[email protected]>2023-07-11 16:28:52 +0800
commit2451bd795c801ac4bf961a28978fdf8a34dfcbfc (patch)
treef1769b096c84c1201e0653ed39e87511aee965bf /plugin/business/tsg-http/src/http_lua.cpp
parent868da4f642615eced38f6c5e9247fcc5be4c67cd (diff)
TSG-16056 修复deny动作,修复tsg_lua多线程调用问题和tfe编译告警v4.8.32-20230711
Diffstat (limited to 'plugin/business/tsg-http/src/http_lua.cpp')
-rw-r--r--plugin/business/tsg-http/src/http_lua.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugin/business/tsg-http/src/http_lua.cpp b/plugin/business/tsg-http/src/http_lua.cpp
index 05cbb1f..aba6204 100644
--- a/plugin/business/tsg-http/src/http_lua.cpp
+++ b/plugin/business/tsg-http/src/http_lua.cpp
@@ -824,14 +824,21 @@ finish:
size_t execute_lua_script_rule(struct tsg_lua_script *lua_script, int profile_id, struct elua_context *elua_ctx, unsigned int thread_id, void *user_data)
{
int ret=0;
+ char *profile_msg=NULL;
+ size_t msg_len=0; int timeout=0;
struct elua_script **escript=NULL;
- ret=lua_script->http_lua_profile(profile_id, &escript);
+ ret=lua_script->http_lua_profile(profile_id, &escript, &profile_msg, &msg_len, &timeout);
if(ret<0)
{
return ret;
}
+ if(*escript == NULL)
+ {
+ escript[thread_id]=http_lua_map_cache_script(lua_script->http_lua_handle[thread_id], profile_msg, msg_len, timeout);
+ }
+
const char *input="tfe";
size_t input_len=strlen(input);
@@ -844,6 +851,11 @@ size_t execute_lua_script_rule(struct tsg_lua_script *lua_script, int profile_id
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, error_code:%d, error: %s", tsg_ctx->config_id, tsg_ctx->profile_id, ret, elua_get_last_error_string(lua_script->http_lua_handle[thread_id]));
}
}
+ if(profile_msg != NULL)
+ {
+ FREE(&profile_msg);
+ }
+
return ret;
}