Skip to content

Draft: asynchronous phase handler#237

Open
ensh63 wants to merge 4 commits intonginx:mainfrom
ensh63:shirykalov/async
Open

Draft: asynchronous phase handler#237
ensh63 wants to merge 4 commits intonginx:mainfrom
ensh63:shirykalov/async

Conversation

@ensh63
Copy link
Contributor

@ensh63 ensh63 commented Jan 9, 2026

Draft implementations of the following items are added to SDK:

  • asynchronous phase handler;
  • asynchronous subrequest;
  • type-safe request context;
  • typed storage for Pool.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces asynchronous capabilities to the Rust SDK for nginx modules, including async phase handlers, subrequests, and type-safe request context management.

Key Changes:

  • Introduces AsyncHandler trait and supporting infrastructure for asynchronous HTTP request handling
  • Adds RequestContext trait for type-safe request-specific context data management
  • Implements TypeStorage trait for storing typed values in nginx memory pools
  • Refactors existing examples to use new HttpRequestHandler trait and add_phase_handler function

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/log.rs Extracts connection to intermediate variable in logging macro
src/http/status.rs Adds From<HTTPStatus> implementation for ngx_int_t
src/http/request_context.rs Implements RequestContext trait for managing request-specific context
src/http/request.rs Adds HttpHandlerReturn and HttpRequestHandler traits, new request methods
src/http/mod.rs Adds async_request module exports (feature-gated)
src/http/conf.rs Adds HttpPhase enum and add_phase_handler function
src/http/async_request.rs Implements async handler infrastructure and subrequest builder
src/core/type_storage.rs Implements TypeStorage trait for pool-based type storage
src/core/pool.rs Adds remove method for cleaning up pool-allocated values
src/core/mod.rs Exports new type_storage module
examples/*.rs Refactors examples to use new handler registration pattern
examples/config Adds async_request module configuration
examples/Cargo.toml Adds async-related dependencies
Cargo.toml Adds futures dependency
.github/workflows/nginx.yaml Updates CI to load async_request module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ensh63 ensh63 force-pushed the shirykalov/async branch 2 times, most recently from 78a97e6 to 27338b6 Compare January 9, 2026 23:48
@@ -50,6 +50,7 @@ env:
NGX_TEST_FILES: examples/t
NGX_TEST_GLOBALS_DYNAMIC: >-
load_module ${{ github.workspace }}/nginx/objs/ngx_http_async_module.so;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have native async support now, we should remove half-working ngx_http_async_module example and remove tokio dependency.

@ensh63 ensh63 force-pushed the shirykalov/async branch 8 times, most recently from fc28783 to 697c039 Compare February 4, 2026 00:12
Introduce RequestContext trait for managing request-specific context data:
- Provides create, remove, get, get_mut, and exists methods
- Uses pool allocation with cleanup handlers for memory management
- Add get_module_ctx_mut method to Request for mutable context access
- Update ngx_log_debug_http macro to use request.log() method
Add support for asynchronous phase handlers:
- Introduce async phase handler framework
- Add async request handling capabilities
- Implement async/await support for nginx phases
- Enable non-blocking request processing
@ensh63 ensh63 force-pushed the shirykalov/async branch 2 times, most recently from 75988d4 to 090268d Compare February 6, 2026 18:35
Add asynchronous subrequest functionality:
- Implement async subrequest handling
- Add support for non-blocking subrequest operations
- Enable concurrent subrequest processing
- Integrate with async phase handler framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants