Skip to content

fix: function m.setvar not work in lua script #1859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/lua.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AC_DEFUN([CHECK_LUA],
[dnl

# Possible names for the lua library/package (pkg-config)
LUA_POSSIBLE_LIB_NAMES="lua lua53 lua5.3 lua52 lua5.2 lua51 lua5.1"
LUA_POSSIBLE_LIB_NAMES="lua lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1"

# Possible extensions for the library
LUA_POSSIBLE_EXTENSIONS="so so0 la sl dll dylib so.0.0.0"
Expand Down
18 changes: 12 additions & 6 deletions src/engine/lua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,26 +371,32 @@ int Lua::setvar(lua_State *L) {

if (collection == "TX") {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"TX:" + variableName, "", var_value);
variableName,
var_value);
}
else if (collection == "IP") {
t->m_collections.m_ip_collection->storeOrUpdateFirst(
"IP:" + variableName, t->m_collections.m_ip_collection_key,
variableName, t->m_collections.m_ip_collection_key,
t->m_rules->m_secWebAppId.m_value,
var_value);
}
else if (collection == "GLOBAL") {
t->m_collections.m_global_collection->storeOrUpdateFirst(
"GLOBAL:" + variableName, t->m_collections.m_global_collection_key,
variableName, t->m_collections.m_global_collection_key,
t->m_rules->m_secWebAppId.m_value,
var_value);
}
else if (collection == "RESOURCE") {
t->m_collections.m_resource_collection->storeOrUpdateFirst(
"RESOURCE:" + variableName,
t->m_collections.m_resource_collection_key, var_value);
variableName,
t->m_collections.m_resource_collection_key,
t->m_rules->m_secWebAppId.m_value,
var_value);
}
else if (collection == "SESSION") {
t->m_collections.m_session_collection->storeOrUpdateFirst(
"SESSION:" + variableName, t->m_collections.m_session_collection_key,
variableName, t->m_collections.m_session_collection_key,
t->m_rules->m_secWebAppId.m_value,
var_value);
}

Expand Down