INNER CODE UNIT · Rust
cmcf
nginx/nginx-gateway-fabric · internal/controller/nginx/modules/rust/ai-guardrails/src/lib.rs:83
let cmcf = *(*http_ctx).main_conf.add(core_ctx_index) as *mut ngx_http_core_main_conf_t;
if cmcf.is_null() {
ngx_conf_log_error!(NGX_LOG_ERR, cf, "guardrails: could not get core main conf");
return Status::NGX_ERROR.into();
}
let handlers =
&mut (*cmcf).phases[ngx_http_phases_NGX_HTTP_ACCESS_PHASE as usize].handlers;
let h = ngx::ffi::ngx_array_push(handlers) as *mut ngx_http_handler_pt;
if h.is_null() {
ngx_conf_log_error!(
NGX_LOG_ERR,
cf,
"guardrails: could not push access-phase handler"
);
return Status::NGX_ERROR.into();
}
*h = Some(guardrails_access_handler);