@@ -53,11 +53,11 @@ impl http::HttpModule for Module {
5353
5454 unsafe extern "C" fn preconfiguration ( cf : * mut ngx_conf_t ) -> ngx_int_t {
5555 // Register $inference_upstream variable so it can be used in NGINX config (e.g. proxy_pass http://$inference_upstream;)
56- let cf_ref = & mut * cf;
56+ let cf_ref = unsafe { & mut * cf } ;
5757 // Allocate variable name from configuration pool
58- let name = & mut ngx_str_t:: from_str ( cf_ref. pool , "inference_upstream" ) as * mut _ ;
58+ let name = unsafe { & mut ngx_str_t:: from_str ( cf_ref. pool , "inference_upstream" ) as * mut _ } ;
5959 // Add variable with no special flags
60- let v = ngx_http_add_variable ( cf, name, 0 ) ;
60+ let v = unsafe { ngx_http_add_variable ( cf, name, 0 ) } ;
6161 if v. is_null ( ) {
6262 return core:: Status :: NGX_ERROR . into ( ) ;
6363 }
@@ -71,17 +71,19 @@ impl http::HttpModule for Module {
7171
7272 unsafe extern "C" fn postconfiguration ( cf : * mut ngx_conf_t ) -> ngx_int_t {
7373 // SAFETY: called by NGINX with non-null cf
74- let cf = & mut * cf;
74+ let cf = unsafe { & mut * cf } ;
7575 let cmcf = NgxHttpCoreModule :: main_conf_mut ( cf) . expect ( "http core main conf" ) ;
7676
7777 // Register an Access phase handler to run before upstream selection.
78- let h = ngx_array_push (
79- & mut cmcf. phases [ ngx_http_phases_NGX_HTTP_ACCESS_PHASE as usize ] . handlers ,
80- ) as * mut ngx_http_handler_pt ;
78+ let h = unsafe {
79+ ngx_array_push (
80+ & mut cmcf. phases [ ngx_http_phases_NGX_HTTP_ACCESS_PHASE as usize ] . handlers ,
81+ ) as * mut ngx_http_handler_pt
82+ } ;
8183 if h. is_null ( ) {
8284 return core:: Status :: NGX_ERROR . into ( ) ;
8385 }
84- * h = Some ( inference_access_handler) ;
86+ unsafe { * h = Some ( inference_access_handler) } ;
8587 core:: Status :: NGX_OK . into ( )
8688 }
8789}
0 commit comments