From de02b393b1cd4f6f4ee82e30ad554b3bae324c07 Mon Sep 17 00:00:00 2001 From: u5surf Date: Fri, 19 Sep 2025 14:48:35 +0900 Subject: [PATCH 1/2] refactor: remove unused register_log_phase_handler function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Function was not implementing any actual LOG_PHASE registration - Only returned Ok(()) without performing any real work - Nginx integration works correctly without this function - External LOG_PHASE integration can be handled separately if needed Verified that: - Module builds successfully without the function - All tests pass - Nginx configuration loads and validates correctly - VTS functionality remains intact 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/lib.rs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9d6dd81..f9e5bf9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1028,10 +1028,7 @@ unsafe extern "C" fn ngx_http_vts_init(cf: *mut ngx_conf_t) -> ngx_int_t { return NGX_ERROR as ngx_int_t; } - // Register LOG_PHASE handler for real-time statistics collection - if register_log_phase_handler(cf).is_err() { - return NGX_ERROR as ngx_int_t; - } + // LOG_PHASE handler registration is handled externally if needed NGX_OK as ngx_int_t } @@ -1087,24 +1084,6 @@ unsafe fn initialize_upstream_zones_from_config(_cf: *mut ngx_conf_t) -> Result< Ok(()) } -/// Register LOG_PHASE handler for real-time request statistics collection -/// -/// NOTE: Due to nginx-rust FFI limitations, this function exports the necessary -/// hooks for external integration. The actual LOG_PHASE registration should be -/// done by a companion C module that calls vts_track_upstream_request(). -unsafe fn register_log_phase_handler(_cf: *mut ngx_conf_t) -> Result<(), &'static str> { - // For now, we rely on external C code to register the LOG_PHASE handler - // The external handler should call vts_track_upstream_request() for each upstream request - // - // Future implementations can use direct nginx FFI once compatibility issues are resolved - // - // Alternative approaches: - // 1. nginx logging module extension that calls our C API - // 2. Custom nginx module that wraps our Rust functionality - // 3. Direct FFI integration when nginx-rust supports it - - Ok(()) -} /// Module context configuration #[no_mangle] From 91dc573e3e07034889b28d69674ea878c2ab711c Mon Sep 17 00:00:00 2001 From: u5surf Date: Fri, 19 Sep 2025 15:19:22 +0900 Subject: [PATCH 2/2] fix: apply cargo fmt formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f9e5bf9..3bbd410 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1084,7 +1084,6 @@ unsafe fn initialize_upstream_zones_from_config(_cf: *mut ngx_conf_t) -> Result< Ok(()) } - /// Module context configuration #[no_mangle] static NGX_HTTP_VTS_MODULE_CTX: ngx_http_module_t = ngx_http_module_t {