shukitchan opened a new pull request, #12651:
URL: https://github.com/apache/trafficserver/pull/12651

   This pull request adds support for accessing PROXY protocol information in 
the Lua plugin API, enabling Lua scripts to retrieve details such as version, 
source/destination addresses and ports, protocol family, and socket type from 
incoming connections. The changes include new Lua API functions, updates to 
documentation, and comprehensive tests to ensure correct behavior with and 
without PROXY protocol.
   
   **Lua API enhancements for PROXY protocol:**
   
   * Added new Lua API functions `ts.client_request.get_pp_info` and 
`ts.client_request.get_pp_info_int` for retrieving PROXY protocol information 
as string or integer values, respectively. Constants for key types (e.g., 
`TS_LUA_PP_INFO_VERSION`, `TS_LUA_PP_INFO_SRC_ADDR`) are also exposed to Lua. 
(`plugins/lua/ts_lua_client_request.cc`, 
[[1]](diffhunk://#diff-2ba4d71a58c393bc7b54367d933fcb20e045fa7ac1dd8376fbfee8461e6813dfR23-R40)
 
[[2]](diffhunk://#diff-2ba4d71a58c393bc7b54367d933fcb20e045fa7ac1dd8376fbfee8461e6813dfR97-R100)
 
[[3]](diffhunk://#diff-2ba4d71a58c393bc7b54367d933fcb20e045fa7ac1dd8376fbfee8461e6813dfR121)
 
[[4]](diffhunk://#diff-2ba4d71a58c393bc7b54367d933fcb20e045fa7ac1dd8376fbfee8461e6813dfR1165-R1253)
   * Updated the Lua plugin documentation to describe the new API functions, 
their usage, and example code snippets. (`doc/admin-guide/plugins/lua.en.rst`, 
[doc/admin-guide/plugins/lua.en.rstR1259-R1327](diffhunk://#diff-0739161b3c546929527676380ebcbd47545e14a305b63013b37f951ffcb63f89R1259-R1327))
   
   **Testing and validation:**
   
   * Added a Lua script (`proxy_protocol.lua`) that demonstrates usage of the 
new API by logging PROXY protocol details and setting a custom header. 
(`tests/gold_tests/pluginTest/lua/proxy_protocol.lua`, 
[tests/gold_tests/pluginTest/lua/proxy_protocol.luaR1-R62](diffhunk://#diff-36103cb1e20949da419da360dbf71d4654a4972817cda842376aa698713a8638R1-R62))
   * Introduced a new automated test (`lua_proxy_protocol.test.py`) to verify 
PROXY protocol support, checking for correct logging and header behavior both 
when PROXY protocol is present and absent. 
(`tests/gold_tests/pluginTest/lua/lua_proxy_protocol.test.py`, 
[tests/gold_tests/pluginTest/lua/lua_proxy_protocol.test.pyR1-R103](diffhunk://#diff-2ccf1c372b6246b6104d4bdfa07c62f3831b4604adbe2833913285c2d4d9f428R1-R103))
   * Created a gold file for expected test output. 
(`tests/gold_tests/pluginTest/lua/gold/lua_proxy_protocol.gold`, 
[tests/gold_tests/pluginTest/lua/gold/lua_proxy_protocol.goldR1](diffhunk://#diff-308e87db1651bb627afe08d71104dade2ffacc576fe2f186c86f779dabcee5c1R1))


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to