2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,12 @@ http_request_handler!(async_access_handler, |request: &mut http::Request| {
136
136
}
137
137
138
138
let event_data = unsafe {
139
- let ctx = request. get_inner ( ) . ctx. add( ngx_http_async_module. ctx_index) ;
139
+ let ctx = request. as_ref ( ) . ctx. add( ngx_http_async_module. ctx_index) ;
140
140
if ( * ctx) . is_null( ) {
141
141
let ctx_data = & mut * ( request. pool( ) . alloc( std:: mem:: size_of:: <RequestCTX >( ) ) as * mut RequestCTX ) ;
142
142
ctx_data. event_data = Some ( Arc :: new( EventData {
143
143
done_flag: AtomicBool :: new( false ) ,
144
- request: & request. get_inner ( ) as * const _ as * mut _,
144
+ request: & request. as_ref ( ) as * const _ as * mut _,
145
145
} ) ) ;
146
146
* ctx = ctx_data as * const _ as _;
147
147
ctx_data. event_data. as_ref( ) . unwrap( ) . clone( )
@@ -191,7 +191,7 @@ http_request_handler!(async_access_handler, |request: &mut http::Request| {
191
191
} ) ;
192
192
193
193
unsafe {
194
- ( * request. get_inner ( ) . main) . set_count( ( * request. get_inner ( ) . main) . count( ) + 1 ) ;
194
+ ( * request. as_ref ( ) . main) . set_count( ( * request. as_ref ( ) . main) . count( ) + 1 ) ;
195
195
}
196
196
core:: Status :: NGX_DONE
197
197
} ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,18 @@ impl<'a> From<&'a mut Request> for *mut ngx_http_request_t {
101
101
}
102
102
}
103
103
104
+ impl AsRef < ngx_http_request_t > for Request {
105
+ fn as_ref ( & self ) -> & ngx_http_request_t {
106
+ & self . 0
107
+ }
108
+ }
109
+
110
+ impl AsMut < ngx_http_request_t > for Request {
111
+ fn as_mut ( & mut self ) -> & mut ngx_http_request_t {
112
+ & mut self . 0
113
+ }
114
+ }
115
+
104
116
impl Request {
105
117
/// Create a [`Request`] from an [`ngx_http_request_t`].
106
118
///
@@ -402,11 +414,6 @@ impl Request {
402
414
pub fn headers_out_iterator ( & self ) -> NgxListIterator {
403
415
unsafe { list_iterator ( & self . 0 . headers_out . headers ) }
404
416
}
405
-
406
- /// Returns the inner data structure that the Request object is wrapping.
407
- pub fn get_inner ( & self ) -> & ngx_http_request_t {
408
- & self . 0
409
- }
410
417
}
411
418
412
419
// trait OnSubRequestDone {
0 commit comments