1
0
mirror of https://github.com/graygnuorg/pound.git synced 2026-10-23 22:28:53 +03:00
Files
Sergey Poznyakoff 0e5d6f999c Lua support
Lua functions can be used as checks in Service section (LuaMatch
statement) as well as to implement new backends (LuaBackend
statement).  Lua is configured and its sources are loaded in the
new Lua section statement.

This commit also fixes a minor bug in SendFile implementation.

* .github/workflows/testsuite.yml: Test Lua
* NEWS: Version 4.18.90
* configure.ac: Test for Lua. New option: --with-lua.
* src/pndlua.c: New file.
* src/Makefile.am [COND_LUA] (pound_SOURCES): Add pndlua.c
* src/pound.h (http_header_list_append): Mark text as const.
(http_header_list_remove_field)
(http_request_count_query_param): New proto.
(PNDLUA_CTX_GLOBAL, PNDLUA_CTX_THREAD)
(BE_LUA, COND_LUA): New constants.
(pndlua_closure): New struct.
(struct _backend): New member v.lua.
(_service_cond): New member: clua.
(pndlua_init, pndlua_match, pndlua_backend)
(pndlua_parse_config, pndlua_parse_closure): New protos.
* src/config.c: New section: Lua.
New statements: Lua.Path, Lua.CPath, Lua.Load, Lua.LoadGlobal,
LuaMatch, LuaBackend.
(parse_config_file): Call pndlua_init.
(pound_settings): Reflect Lua support.
* src/extern.h (parser_loop): New function.
* src/http.c (file_response): Don't use request.path, call
http_request_get_path instead.  This ensures the request has been
properly parsed.
(http_header_alloc, http_header_list_append): Mark text argument as
static.
(http_header_list_remove_field): New function.
(http_request_count_query_param): New function.
(match_cond): Handle COND_LUA conditionals.
(http_process_request): Handle BE_LUA (Lua backends).
* src/pound-mode.el: Support for Lua keywords.
* src/svc.c (str_be, backend_serialize): Handle BE_LUA.

* src/cfgparser.c (input_gettkn): Improve escape sequence
handling.

* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Likewise.
* tests/atlocal.in (LUA_AVAILABLE): New variable.
* tests/lua-be.at: New file.
* tests/lua-http.at: New file.
* tests/lua-load.at: New file.
* tests/lua-match.at: New file.
* tests/lua-path.at: New file.
* tests/sendfile.at: Test SendFile with unmodified path as well.
2025-11-02 13:46:38 +02:00
..
2025-11-02 13:46:38 +02:00