Skip to content

Commit

Permalink
Request: get_module_*_conf are unsafe for the noted reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchickey committed Feb 12, 2025
1 parent c764960 commit 7b2c5aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Request {
///
/// # Safety
/// Caller must ensure that type `T` matches the configuration type for the specified module.
pub fn get_module_main_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
pub unsafe fn get_module_main_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
// SAFETY: main conf is either NULL or allocated with ngx_p(c)alloc and
// explicitly initialized by the module
unsafe {
Expand All @@ -174,7 +174,7 @@ impl Request {
///
/// # Safety
/// Caller must ensure that type `T` matches the configuration type for the specified module.
pub fn get_module_srv_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
pub unsafe fn get_module_srv_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
// SAFETY: server conf is either NULL or allocated with ngx_p(c)alloc and
// explicitly initialized by the module
unsafe {
Expand All @@ -189,7 +189,7 @@ impl Request {
///
/// # Safety
/// Caller must ensure that type `T` matches the configuration type for the specified module.
pub fn get_module_loc_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
pub unsafe fn get_module_loc_conf<T>(&self, module: &ngx_module_t) -> Option<&'static T> {
// SAFETY: location conf is either NULL or allocated with ngx_p(c)alloc and
// explicitly initialized by the module
unsafe {
Expand Down

0 comments on commit 7b2c5aa

Please sign in to comment.