Skip to content

Instantly share code, notes, and snippets.

@xeioex
Created January 24, 2026 00:54
Show Gist options
  • Select an option

  • Save xeioex/a6f517a36bfa5ccc7bf0487c62b2a8c1 to your computer and use it in GitHub Desktop.

Select an option

Save xeioex/a6f517a36bfa5ccc7bf0487c62b2a8c1 to your computer and use it in GitHub Desktop.
diff --git a/examples/async_request.rs b/examples/async_request.rs
index a616b7d3..507268a3 100644
--- a/examples/async_request.rs
+++ b/examples/async_request.rs
@@ -63,20 +63,12 @@ impl AsyncHandler for SampleAsyncHandler {
let request_ptr: *mut ngx_http_request_t = request.as_mut();
let fut = AsyncSubRequestBuilder::new("/proxy")
- //.args("arg1=val1&arg2=val2")
+ .args("arg1=val1&arg2=val2")
.in_memory()
.waited()
.build(request)?;
- let subrc = fut.await;
-
- ngx_log_error!(nginx_sys::NGX_LOG_INFO, log, "Subrequest rc {}", subrc.0);
-
- if subrc.0 != nginx_sys::NGX_OK as _ || subrc.1.is_none() {
- return Err(SampleAsyncHandlerError::from(subrc.0));
- }
-
- let sr = subrc.1.unwrap();
+ let sr = fut.await?;
ngx_log_error!(
nginx_sys::NGX_LOG_INFO,
diff --git a/nginx-src/nginx b/nginx-src/nginx
index 95078974..481d28cb 160000
--- a/nginx-src/nginx
+++ b/nginx-src/nginx
@@ -1 +1 @@
-Subproject commit 95078974cfe998ec4095ac2c504c5c92bbc9a326
+Subproject commit 481d28cb4e04c8096b9b6134856891dc52ecc68f
diff --git a/src/http/async_request.rs b/src/http/async_request.rs
index 83ac81b4..82355e87 100644
--- a/src/http/async_request.rs
+++ b/src/http/async_request.rs
@@ -317,7 +317,7 @@ impl<'sr> AsyncSubRequest<'sr> {
}
impl<'sr> core::future::Future for AsyncSubRequest<'sr> {
- type Output = (ngx_int_t, Option<&'sr Request>);
+ type Output = Result<&'sr Request, ngx_int_t>;
fn poll(
self: Pin<&mut Self>,
@@ -332,7 +332,7 @@ impl<'sr> core::future::Future for AsyncSubRequest<'sr> {
ngx_cycle_log().as_ptr(),
"Subrequest not created"
);
- return core::task::Poll::Ready((nginx_sys::NGX_ERROR as _, None));
+ return core::task::Poll::Ready(Err(nginx_sys::NGX_ERROR as _));
}
if this.rc.is_none() {
@@ -341,8 +341,8 @@ impl<'sr> core::future::Future for AsyncSubRequest<'sr> {
}
// let request: &Request = unsafe { Request::from_ngx_http_request(this.sr.take().unwrap()) };
- let rc = this.rc.unwrap();
+ // let rc = this.rc.unwrap();
// ngx_log_debug_http!(request, "subrequest poll: ready({rc})");
- core::task::Poll::Ready((rc, Some(this.sr.take().unwrap())))
+ core::task::Poll::Ready(Ok(this.sr.take().unwrap()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment